/* ===== MODALS V2 - Premium Design ===== */
/* Based on hub-v2-gold-premium.html prototype */

/* ===== MODAL OVERLAY ===== */
.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    padding: 20px;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* ===== MODAL CONTAINER ===== */
.modal-container {
    background: #1a1a1a;
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7);
    position: relative;
    max-width: 720px;
    width: 100%;
    max-height: 90vh;
    overflow: hidden;
    transform: scale(0.95) translateY(20px);
    transition: transform 0.2s ease;
}

.modal-overlay.active .modal-container {
    transform: scale(1) translateY(0);
}

/* ===== MODAL HEADER ===== */
.modal-header {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 24px 28px;
    border-bottom: 1px solid var(--glass-border);
    background: linear-gradient(180deg, rgba(255, 154, 31, 0.08) 0%, transparent 100%);
}

.modal-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.2s ease;
}

.modal-icon.gold {
    background: linear-gradient(135deg, #FF9A1F, #F28C0C);
}

.modal-icon svg {
    width: 24px;
    height: 24px;
    color: white;
}

.modal-header-text {
    flex: 1;
}

.modal-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.modal-subtitle {
    font-size: 13px;
    color: var(--text-muted);
    margin: 4px 0 0 0;
}

.modal-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.modal-close:hover {
    background: var(--glass-bg-hover);
    color: var(--text-primary);
}

/* ===== MODAL BODY ===== */
.modal-body {
    padding: 24px 28px;
}

/* ===== MODAL FOOTER ===== */
.modal-footer {
    padding: 16px 28px 24px;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

/* ===== MODAL BUTTONS ===== */
.modal-btn {
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
}

.modal-btn-cancel {
    background: transparent;
    border: 1px solid var(--glass-border);
    color: var(--text-secondary);
}

.modal-btn-cancel:hover {
    background: var(--glass-bg);
    color: var(--text-primary);
}

.modal-btn-primary {
    background: linear-gradient(135deg, var(--accent-gold) 0%, #F28C0C 100%);
    border: none;
    color: white;
    font-weight: 600;
}

.modal-btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(255, 154, 31, 0.35);
}

/* ===== MODAL DIVIDER ===== */
.modal-divider {
    display: flex;
    align-items: center;
    gap: 16px;
    margin: 20px 0;
}

.modal-divider::before,
.modal-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--glass-border);
}

.modal-divider span {
    font-size: 12px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ===== SELECT FOLDER MODAL ===== */
.select-folder-modal {
    max-width: 480px;
}

.folder-list-v2 {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 280px;
    overflow-y: auto;
    padding-right: 4px;
}

.folder-list-v2::-webkit-scrollbar {
    width: 6px;
}

.folder-list-v2::-webkit-scrollbar-track {
    background: transparent;
}

.folder-list-v2::-webkit-scrollbar-thumb {
    background: var(--glass-border);
    border-radius: 3px;
}

.folder-list-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    background: var(--bg-primary);
    border: 1px solid var(--glass-border);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.folder-list-item:hover {
    border-color: var(--accent-gold);
    background: rgba(255, 154, 31, 0.05);
}

.folder-list-item.loading {
    opacity: 0.6;
    pointer-events: none;
}

.folder-list-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    flex-shrink: 0;
}

.folder-list-icon svg {
    width: 20px;
    height: 20px;
}

.folder-list-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.folder-list-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.folder-list-desc {
    font-size: 12px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.folder-list-count {
    font-size: 12px;
    color: var(--text-muted);
    white-space: nowrap;
    flex-shrink: 0;
}

.folder-list-create {
    width: 100%;
    padding: 14px 20px;
    background: var(--glass-bg);
    border: 1px dashed var(--glass-border);
    color: var(--text-secondary);
    border-radius: 10px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.folder-list-create svg {
    width: 20px;
    height: 20px;
}

.folder-list-create:hover {
    border-color: var(--accent-gold);
    border-style: solid;
    color: var(--accent-gold);
    background: rgba(255, 154, 31, 0.05);
}

/* ===== CREATE FOLDER MODAL - Premium Design ===== */
.create-folder-modal {
    max-width: 900px;
}

.cf-modal-header {
    background: linear-gradient(180deg, rgba(255, 154, 31, 0.08) 0%, transparent 100%);
}

.cf-modal-header-text {
    flex: 1;
}

.cf-modal-subtitle {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 2px;
}

/* Two Column Layout */
.create-folder-layout {
    display: grid;
    grid-template-columns: 1fr 380px;
    min-height: 480px;
}

/* Form Side */
.cf-form-side {
    padding: 28px 32px 32px;
    display: flex;
    flex-direction: column;
}

.cf-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
    flex: 1;
}

.cf-form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.cf-label {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
}

.cf-label-optional {
    font-size: 12px;
    font-weight: 400;
    color: var(--text-muted);
}

.cf-input,
.cf-textarea {
    padding: 12px 16px;
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 14px;
    font-family: inherit;
    transition: all 0.15s ease;
}

.cf-input::placeholder,
.cf-textarea::placeholder {
    color: var(--text-muted);
}

.cf-input:hover,
.cf-textarea:hover {
    border-color: var(--text-muted);
}

.cf-input:focus,
.cf-textarea:focus {
    outline: none;
    border-color: var(--cf-selected-color, #00A3FF);
    box-shadow: 0 0 0 3px var(--cf-selected-dim, rgba(0, 163, 255, 0.15));
}

.cf-textarea {
    resize: vertical;
    min-height: 80px;
}

/* Color Picker */
.cf-color-picker {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.cf-color-option {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    border: 2px solid transparent;
    cursor: pointer;
    transition: all 0.15s ease;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cf-color-option[data-color="blue"] { background: linear-gradient(135deg, #00A3FF, #0088DD); }
.cf-color-option[data-color="green"] { background: linear-gradient(135deg, #00D26A, #00B359); }
.cf-color-option[data-color="purple"] { background: linear-gradient(135deg, #9B59B6, #8E44AD); }
.cf-color-option[data-color="orange"] { background: linear-gradient(135deg, #FF9A1F, #F28C0C); }
.cf-color-option[data-color="gold"] { background: linear-gradient(135deg, #FFD700, #FFA500); }
.cf-color-option[data-color="red"] { background: linear-gradient(135deg, #FF4757, #E84142); }
.cf-color-option[data-color="cyan"] { background: linear-gradient(135deg, #22D3EE, #06B6D4); }
.cf-color-option[data-color="pink"] { background: linear-gradient(135deg, #FF69B4, #FF1493); }

.cf-color-option:hover {
    transform: scale(1.1);
}

.cf-color-option.selected {
    border-color: var(--text-primary);
    box-shadow: 0 0 0 2px var(--bg-primary), 0 0 12px currentColor;
}

.cf-color-check {
    display: none;
}

.cf-color-option.selected .cf-color-check {
    display: flex;
    align-items: center;
    justify-content: center;
}

.cf-color-check svg {
    width: 18px;
    height: 18px;
    color: white;
    filter: drop-shadow(0 1px 2px rgba(0,0,0,0.3));
}

/* Icon Picker */
.cf-icon-picker {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.cf-icon-option {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    border: 1px solid var(--glass-border);
    background: var(--glass-bg);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
}

.cf-icon-option:hover {
    border-color: var(--cf-selected-color, #00A3FF);
    color: var(--cf-selected-color, #00A3FF);
    background: var(--cf-selected-dim, rgba(0, 163, 255, 0.1));
}

.cf-icon-option.selected {
    border-color: var(--cf-selected-color, #00A3FF);
    background: var(--cf-selected-dim, rgba(0, 163, 255, 0.15));
    color: var(--cf-selected-color, #00A3FF);
}

.cf-icon-option svg {
    width: 20px;
    height: 20px;
}

/* Form Actions */
.cf-actions {
    display: flex;
    gap: 12px;
    margin-top: auto;
    padding-top: 8px;
}

.cf-btn-secondary {
    flex: 1;
    padding: 12px 20px;
    background: transparent;
    border: 1px solid var(--glass-border);
    color: var(--text-secondary);
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
}

.cf-btn-secondary:hover {
    background: var(--glass-bg);
    color: var(--text-primary);
    border-color: var(--text-muted);
}

.cf-btn-primary {
    flex: 1.5;
    padding: 12px 20px;
    border: none;
    color: white;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.cf-btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    filter: brightness(1.1);
}

.cf-btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.cf-btn-primary svg {
    width: 18px;
    height: 18px;
}

/* Preview Side */
.cf-preview-side {
    background: var(--bg-primary);
    border-left: 1px solid var(--glass-border);
    padding: 32px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 20px;
}

.cf-preview-label {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1.2px;
}

.cf-preview-card {
    width: 100%;
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 24px;
    position: relative;
    overflow: hidden;
}

.cf-preview-gradient {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    opacity: 0.12;
    z-index: 0;
    pointer-events: none;
    transition: background 0.2s ease;
}

.cf-preview-header {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 16px;
    position: relative;
    z-index: 1;
}

.cf-preview-icon {
    width: 52px;
    height: 52px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.2s ease;
}

.cf-preview-icon svg {
    width: 26px;
    height: 26px;
    color: white;
}

.cf-preview-info {
    flex: 1;
    min-width: 0;
}

.cf-preview-name {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 4px 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cf-preview-meta {
    font-size: 13px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 5px;
}

.cf-preview-meta svg {
    width: 14px;
    height: 14px;
}

.cf-preview-desc {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.5;
    margin: 0 0 16px 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    position: relative;
    z-index: 1;
}

.cf-preview-footer {
    display: flex;
    align-items: center;
    position: relative;
    z-index: 1;
}

.cf-preview-tag {
    display: inline-flex;
    padding: 4px 10px;
    border-radius: 9999px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    transition: all 0.2s ease;
}

/* ===== DELETE MODAL ===== */
.delete-modal {
    max-width: 400px;
}

.delete-modal .modal-header {
    background: linear-gradient(180deg, rgba(239, 68, 68, 0.08) 0%, transparent 100%);
}

.modal-icon.danger {
    background: rgba(239, 68, 68, 0.15);
    color: var(--accent-red);
}

.modal-icon.danger svg {
    color: var(--accent-red);
}

.delete-item-preview {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    background: var(--bg-primary);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    margin-bottom: 12px;
}

.delete-item-preview svg {
    color: var(--text-secondary);
    flex-shrink: 0;
    width: 18px;
    height: 18px;
}

.delete-item-preview span {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
}

.delete-warning {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: rgba(239, 68, 68, 0.06);
    border: 1px solid rgba(239, 68, 68, 0.15);
    border-radius: 8px;
    margin-bottom: 20px;
}

.delete-warning svg {
    color: var(--accent-red);
    flex-shrink: 0;
    width: 16px;
    height: 16px;
}

.delete-warning span {
    font-size: 12px;
    font-weight: 500;
    color: var(--accent-red);
}

.btn-modal-danger {
    padding: 11px 20px;
    background: var(--accent-red);
    border: none;
    color: white;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.btn-modal-danger:hover:not(:disabled) {
    background: #dc2626;
}

.btn-modal-danger:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

/* ===== SPINNING ANIMATION ===== */
.spinning {
    animation: spin 0.8s linear infinite;
}
/* @keyframes spin is defined in variables.css */

/* ===== RESPONSIVE ===== */
@media (max-width: 900px) {
    .create-folder-modal {
        max-width: 100%;
    }

    .create-folder-layout {
        grid-template-columns: 1fr;
        min-height: auto;
    }

    .cf-preview-side {
        display: none;
    }

    .cf-form-side {
        padding: 24px;
    }
}

@media (max-width: 480px) {
    .modal-container {
        margin: 16px;
        max-height: calc(100vh - 32px);
    }

    .modal-header {
        padding: 20px;
    }

    .modal-body {
        padding: 20px;
    }

    .modal-footer {
        padding: 16px 20px 20px;
    }

    .cf-actions {
        flex-direction: column-reverse;
    }

    .cf-btn-secondary,
    .cf-btn-primary {
        flex: none;
        width: 100%;
    }
}
