/* Flag Header Actions */
.cdp-flag-header-actions {
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.cdp-flag-header-actions .cdp-icon-round-btn {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: none;
    background: #ffffff;
    color: #111827;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 3px 8px rgba(15, 23, 42, 0.15);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.cdp-flag-header-actions .cdp-icon-round-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(15, 23, 42, 0.25);
}

.cdp-flag-header-actions .cdp-icon-round-btn i {
    font-size: calc(var(--cdp-font-scale, 1) * 16px);
    color: inherit;
}

body.dark-mode .cdp-flag-header-actions .cdp-icon-round-btn {
    background: #1f2937;
    color: #f8fafc;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.5);
}

/* Flag Grid - same as icon grid */
.cdp-flag-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 8px;
}

.cdp-flag-item {
    width: 80px;
    height: 60px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    background: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 4px;
    overflow: hidden;
}

.cdp-flag-item img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.cdp-flag-item:hover {
    border-color: #d9a300;
    background: #eff6ff;
}

.cdp-flag-item.cdp-flag-item--selected {
    border-color: #d9a300;
    background: #dbeafe;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

/* Flag Element on Canvas */
.cdp-flag-element {
    position: absolute;
    cursor: grab;
    user-select: none;
    -webkit-user-select: none;
    z-index: 9999;
    pointer-events: auto;
}

.cdp-flag-element:active {
    cursor: grabbing;
}

.cdp-flag-element:hover {
    outline: 2px dashed #d9a300;
    outline-offset: 4px;
}

.cdp-flag-element img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

/* Flag Tutorial Toast */
.cdp-flag-tutorial-toast {
    position: fixed;
    bottom: 32px;
    right: 32px;
    background: rgba(17, 24, 39, 0.95);
    color: #f3f4f6;
    padding: 14px 20px;
    border-radius: 999px;
    font-size: calc(var(--cdp-font-scale, 1) * 14px);
    font-weight: 600;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.25);
    z-index: 200000;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.2s ease, transform 0.2s ease;
    pointer-events: none;
}

.cdp-flag-tutorial-toast[data-visible="true"] {
    opacity: 1;
    transform: translateY(0);
}

body.dark-mode .cdp-flag-tutorial-toast {
    background: rgba(15, 23, 42, 0.98);
    color: #fbbf24;
}

@media (max-width: 768px) {
    .cdp-flag-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }

    .cdp-flag-item {
        width: 100%;
        height: auto;
        aspect-ratio: 4 / 3;
    }
}

@media (max-width: 480px) {
    .cdp-flag-grid {
        gap: 6px;
    }
}