/* =========================
   Fill Color Modal
   ========================= */

.cdp-fill-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 12000;
    display: none;
    pointer-events: none;
    background: none !important;
}

.cdp-fill-modal[data-visible="true"] {
    display: block;
    pointer-events: auto;
    background: none !important;
}

.cdp-fill-container {
    position: absolute;
    top: 50%;
    left: 80px;
    transform: translateY(-50%);
    width: 400px;
    max-height: 90vh;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.25);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* Header */
.cdp-fill-header {
    padding: 20px 24px;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #fff;
    flex-shrink: 0;
}

.cdp-fill-header h3 {
    margin: 0;
    font-size: calc(var(--cdp-font-scale, 1) * 20px);
    font-weight: 600;
    color: #111827;
    display: flex;
    align-items: center;
    gap: 10px;
}

.cdp-fill-header-actions {
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.cdp-fill-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-fill-round-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(15, 23, 42, 0.25);
}

.cdp-fill-round-btn i {
    font-size: calc(var(--cdp-font-scale, 1) * 16px);
    color: inherit;
}

.cdp-fill-close-btn {
    background: transparent;
    color: #6b7280;
    box-shadow: none;
}

.cdp-fill-close-btn:hover {
    background: #f3f4f6;
    color: #111827;
}

/* Body with colors */
.cdp-fill-body {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    background: #f9fafb;
}

.cdp-fill-body::-webkit-scrollbar {
    width: 8px;
}

.cdp-fill-body::-webkit-scrollbar-track {
    background: transparent;
}

.cdp-fill-body::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 4px;
}

.cdp-fill-body::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}

/* Color Grid */
.cdp-fill-colors {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 20px;
}

.cdp-fill-color-btn {
    padding: 16px;
    background: #fff;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: all 0.2s;
    text-align: left;
}

.cdp-fill-color-btn:hover {
    border-color: #d9a300;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.15);
    transform: translateY(-2px);
}

.cdp-fill-color-btn.active {
    border-color: #d9a300;
    background: #eff6ff;
}

.cdp-fill-color-dot {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    flex-shrink: 0;
    border: 2px solid #e5e7eb;
}

.cdp-fill-color-name {
    font-size: calc(var(--cdp-font-scale, 1) * 14px);
    font-weight: 600;
    color: #111827;
}

/* Custom Color Picker */
.cdp-fill-custom {
    padding: 20px;
    background: #fff;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
}

.cdp-fill-custom-label {
    display: block;
    font-size: calc(var(--cdp-font-scale, 1) * 14px);
    font-weight: 600;
    color: #111827;
    margin-bottom: 12px;
}

.cdp-fill-color-input {
    width: 100%;
    height: 50px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    cursor: pointer;
}

/* =========================
   Responsive Behaviour
   ========================= */

@media (max-width: 1024px) {
    .cdp-fill-container {
        left: 50%;
        transform: translate(-50%, -50%);
    }
}

@media (max-width: 768px) {
    .cdp-fill-container {
        width: min(480px, 92vw);
        max-height: calc(100vh - 32px);
        border-radius: 20px;
    }

    .cdp-fill-body {
        padding: 16px;
    }

    .cdp-fill-colors {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .cdp-fill-header,
    .cdp-fill-footer {
        padding: 16px;
    }

    .cdp-fill-footer {
        flex-direction: column;
    }

    .cdp-fill-btn {
        width: 100%;
    }

    .cdp-fill-color-btn {
        padding: 12px;
    }

    .cdp-fill-color-dot {
        width: 32px;
        height: 32px;
    }
}

@media (max-width: 768px) {
    .cdp-fill-container {
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        width: min(80vw, 384px);
        max-width: calc(100vw - 24px);
        max-height: min(80svh, 620px);
        height: auto;
        border-radius: 20px;
    }

    .cdp-fill-header {
        padding: 14px 16px 12px;
    }

    .cdp-fill-body {
        padding: 14px 16px 16px;
    }

    .cdp-fill-footer {
        position: static;
        bottom: auto;
        padding: 12px 16px 16px;
        background: #ffffff;
    }
}

@media (max-width: 480px) {
    .cdp-fill-container {
        width: min(78vw, 320px);
        max-width: calc(100vw - 20px);
        max-height: min(76svh, 560px);
    }

    .cdp-fill-header h3 {
        font-size: calc(var(--cdp-font-scale, 1) * 18px);
    }

    .cdp-fill-btn {
        width: 100%;
        justify-content: center;
    }
}

/* Footer */
.cdp-fill-footer {
    padding: 16px 24px;
    border-top: 1px solid #e5e7eb;
    background: #fff;
    display: flex;
    gap: 12px;
    flex-shrink: 0;
}
body.dark-mode .cdp-fill-footer {
    background: #23272f !important;
}

.cdp-fill-btn {
    flex: 1;
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: calc(var(--cdp-font-scale, 1) * 15px);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.cdp-fill-btn--secondary {
    background: #f3f4f6;
    color: #374151;
}

.cdp-fill-btn--secondary:hover {
    background: #e5e7eb;
}

.cdp-fill-btn--primary {
    background: #d9a300;
    color: #fff;
}

.cdp-fill-btn--primary:hover {
    background: #d8a712;
}

.cdp-fill-btn--primary:disabled {
    background: #9ca3af;
    cursor: not-allowed;
}

/* Draggable Layer Item */
.cdp-layer-item {
    cursor: move;
    transition: all 0.2s;
}

.cdp-layer-item:hover {
    background: #f9fafb;
}

.cdp-layer-item.dragging {
    opacity: 0.5;
    background: #d9a300;
    color: #fff;
}

.cdp-layer-item.drag-over {
    border-top: 3px solid #d9a300;
}

/* Dark Mode */
body.dark-mode .cdp-fill-modal {
    background: #1a1a1a;
    box-shadow: -4px 0 24px rgba(0, 0, 0, 0.5);
}

body.dark-mode .cdp-fill-header {
    background: #1a1a1a;
    border-bottom-color: #333333;
}

body.dark-mode .cdp-fill-header h3 {
    color: #ffffff;
}

body.dark-mode .cdp-fill-close-btn {
    color: #9ca3af;
}

body.dark-mode .cdp-fill-close-btn:hover {
    background: #2a2a2a;
    color: #ffffff;
}

body.dark-mode .cdp-fill-body {
    background: #1a1a1a;
}

body.dark-mode .cdp-fill-round-btn {
    background: #1f2937;
    color: #f8fafc;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.5);
}

body.dark-mode .cdp-fill-color-btn {
    background: #2a2a2a;
    border-color: #444444;
}

body.dark-mode .cdp-fill-color-btn:hover {
    background: #333333;
    border-color: #555555;
}

body.dark-mode .cdp-fill-color-btn.active {
    border-color: #d9a300;
    background: #1e3a5f;
}

body.dark-mode .cdp-fill-color-name {
    color: #ffffff;
}

body.dark-mode .cdp-fill-custom-label {
    color: #ffffff;
}

.cdp-fill-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-fill-tutorial-toast[data-visible="true"] {
    opacity: 1;
    transform: translateY(0);
}

body.dark-mode .cdp-fill-tutorial-toast {
    background: rgba(15, 23, 42, 0.98);
    color: #fbbf24;
}




