/* 
   ===== THE IVORY GALLERY: LIGHT & SOPHISTICATED DESIGN SYSTEM =====
   Architected for Clarity, Readability, and Professionalism
*/

:root {
    /* The Ivory Palette */
    --ivory-bg: #FDFCFB;
    --ivory-surface: #FFFFFF;
    --ivory-text: #111827;
    --ivory-text-muted: #4B5563;
    --ivory-gold: #B45309;
    --ivory-gold-light: #FDE68A;
    --ivory-border: #E5E7EB;

    /* Semantic Tokens */
    --admin-bg: var(--ivory-bg);
    --admin-surface: var(--ivory-surface);
    --admin-text: var(--ivory-text);
    --admin-text-muted: var(--ivory-text-muted);
    --admin-border: var(--ivory-border);
    --admin-accent: var(--ivory-gold);

    /* Effects & Depth */
    --admin-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    --admin-shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.05), 0 10px 10px -5px rgba(0, 0, 0, 0.02);
    --admin-radius: 12px;
    --admin-radius-lg: 24px;

    /* Transitions */
    --admin-transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Global Reset & Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background: var(--admin-bg);
    color: var(--admin-text);
    min-height: 100vh;
    line-height: 1.6;
}

h1,
h2,
h3,
.dashboard-title,
.page-title {
    font-family: 'Playfair Display', serif;
    font-weight: 700;
    color: var(--admin-text);
    letter-spacing: -0.01em;
}

/* ===== LAYOUT COMPONENTS ===== */
.dashboard-container,
.page-container {
    padding: 40px 24px;
    max-width: 1400px;
    margin: 0 auto;
}

.dashboard-header,
.page-header {
    margin-bottom: 40px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid var(--admin-border);
    padding-bottom: 24px;
}

.dashboard-title,
.page-title {
    font-size: 2.5rem;
    margin-bottom: 4px;
}

.dashboard-subtitle,
.page-subtitle {
    color: var(--admin-text-muted);
    font-size: 1.1rem;
}

/* ===== BUTTONS ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    border: 1px solid transparent;
    transition: var(--admin-transition);
    text-decoration: none;
}

.btn-primary {
    background: var(--admin-accent);
    color: white;
}

.btn-primary:hover {
    background: #92400E;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(180, 83, 9, 0.2);
}

.btn-success {
    background: #059669;
    color: white;
}

.btn-success:hover {
    background: #047857;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(5, 150, 105, 0.2);
}

.btn-danger {
    background: #DC2626;
    color: white;
}

.btn-danger:hover {
    background: #B91C1C;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(220, 38, 38, 0.2);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.85rem;
}

/* ===== STATS GRID ===== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 24px;
    margin-bottom: 40px;
}

.stat-card {
    background: var(--admin-surface);
    padding: 24px;
    border-radius: var(--admin-radius);
    border: 1px solid var(--admin-border);
    box-shadow: var(--admin-shadow);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.stat-icon {
    font-size: 1.5rem;
}

.stat-value {
    font-size: 2rem;
    font-weight: 800;
    color: var(--admin-text);
}

.stat-label {
    font-size: 0.9rem;
    color: var(--admin-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
}

/* ===== TABLE SECTION ===== */
.full-table-section {
    background: var(--admin-surface);
    border: 1px solid var(--admin-border);
    border-radius: var(--admin-radius);
    box-shadow: var(--admin-shadow);
    overflow: hidden;
}

.table-header {
    padding: 24px;
    border-bottom: 1px solid var(--admin-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #F9FAFB;
}

.table-controls {
    display: flex;
    gap: 16px;
}

.search-wrapper {
    position: relative;
}

.search-input {
    padding: 10px 16px 10px 40px;
    border: 1px solid var(--admin-border);
    border-radius: 8px;
    width: 300px;
    font-size: 0.95rem;
}

.search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    opacity: 0.5;
}

.filter-select {
    padding: 10px 16px;
    border: 1px solid var(--admin-border);
    border-radius: 8px;
    background: white;
    font-size: 0.95rem;
}

/* Table Mastery */
.paintings-table {
    width: 100%;
    overflow-x: auto;
    /* Ensure horizontal scroll if content overflows */
}

.table {
    width: 100%;
    border-collapse: collapse;
    min-width: 1000px;
    /* Minimum width to prevent crushing columns */
}

.table th {
    background: #F9FAFB;
    padding: 16px 24px;
    text-align: left;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 700;
    color: var(--admin-text-muted);
    border-bottom: 2px solid var(--admin-border);
}

.table td {
    padding: 16px 24px;
    border-bottom: 1px solid var(--admin-border);
    vertical-align: middle;
}

.table tr:hover td {
    background: #FDFCFB;
}

.dashboard-thumbnail {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid var(--admin-border);
}

.price-cell strong {
    color: var(--admin-accent);
    font-size: 1.1rem;
}

/* Action Buttons Fix */
.table-actions {
    display: flex;
    gap: 8px;
    min-width: 200px;
    /* Ensure buttons don't wrap or get cut */
}

/* ===== LOGIN PAGE ===== */
.login-page {
    background: #F3F4F6;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
}

.login-form {
    background: white;
    padding: 48px;
    border-radius: var(--admin-radius-lg);
    box-shadow: var(--admin-shadow-lg);
    width: 100%;
    max-width: 440px;
    text-align: center;
}

.form-group {
    margin-bottom: 24px;
    text-align: left;
}

.form-group label {
    display: block;
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--admin-text);
}

.form-group input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--admin-border);
    border-radius: 8px;
    font-size: 1rem;
}

.form-group input:focus {
    outline: none;
    border-color: var(--admin-accent);
    box-shadow: 0 0 0 3px rgba(180, 83, 9, 0.1);
}

/* ===== WIZARD COMPONENTS ===== */
.creation-wizard {
    background: var(--admin-surface);
    padding: 0;
    border-radius: var(--admin-radius-lg);
    border: 1px solid var(--admin-border);
    box-shadow: var(--admin-shadow-lg);
    overflow: hidden;
    margin-top: 24px;
}

.wizard-header {
    background: #F9FAFB;
    padding: 40px 40px 20px;
    border-bottom: 1px solid var(--admin-border);
}

.progress-bar {
    height: 6px;
    background: #E5E7EB;
    border-radius: 3px;
    margin-bottom: 32px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--admin-accent);
    transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.wizard-steps {
    display: flex;
    justify-content: space-between;
    position: relative;
    max-width: 800px;
    margin: 0 auto;
}

.wizard-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    z-index: 1;
}

.step-circle {
    width: 44px;
    height: 44px;
    background: white;
    border: 2px solid #D1D5DB;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: #6B7280;
    transition: var(--admin-transition);
}

.step-circle.active {
    border-color: var(--admin-accent);
    background: var(--admin-accent);
    color: white;
    box-shadow: 0 0 0 4px rgba(180, 83, 9, 0.1);
}

.step-circle.completed {
    border-color: #059669;
    background: #059669;
    color: white;
}

.step-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: #6B7280;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.step-label.active {
    color: var(--admin-text);
}

.wizard-content {
    padding: 40px;
}

.step-section {
    display: none;
    animation: fadeIn 0.4s ease-out;
}

.step-section.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Form Sections */
.form-section {
    margin-bottom: 40px;
}

.section-title {
    font-size: 1.5rem;
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--admin-text);
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 24px;
    margin-bottom: 24px;
}

/* Premium Inputs */
.form-group-premium {
    margin-bottom: 24px;
    position: relative;
}

.form-label-premium {
    display: block;
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--admin-text);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.form-input-premium {
    width: 100%;
    padding: 14px 16px;
    border: 1px solid var(--admin-border);
    border-radius: 10px;
    background: #FDFCFB;
    font-size: 1rem;
    color: var(--admin-text);
    transition: var(--admin-transition);
}

.form-input-premium:focus {
    outline: none;
    border-color: var(--admin-accent);
    background: white;
    box-shadow: 0 0 0 4px rgba(180, 83, 9, 0.05);
}

.textarea-premium {
    min-height: 150px;
    resize: vertical;
}

.field-counter {
    position: absolute;
    right: 12px;
    bottom: -20px;
    font-size: 0.75rem;
    color: #9CA3AF;
}

/* Upload & Previews */
.upload-zone {
    background: #F9FAFB;
    border: 2px dashed #D1D5DB;
    border-radius: var(--admin-radius);
    padding: 60px 40px;
    text-align: center;
    cursor: pointer;
    transition: var(--admin-transition);
}

.upload-zone:hover,
.upload-zone.dragover {
    border-color: var(--admin-accent);
    background: #FFFBEB;
}

.upload-icon {
    font-size: 3rem;
    margin-bottom: 16px;
    opacity: 0.7;
}

.upload-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--admin-text);
    margin-bottom: 8px;
}

.upload-subtitle {
    color: var(--admin-text-muted);
    font-size: 0.95rem;
    margin-bottom: 24px;
}

.upload-specs {
    font-size: 0.8rem;
    color: #9CA3AF;
    background: white;
    display: inline-block;
    padding: 8px 16px;
    border-radius: 20px;
    border: 1px solid var(--admin-border);
}

.preview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 16px;
    margin-top: 24px;
}

.preview-item {
    position: relative;
    aspect-ratio: 1;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--admin-border);
    box-shadow: var(--admin-shadow);
}

.preview-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.remove-preview {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(220, 38, 38, 0.9);
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.75rem;
    border: none;
}

/* Wizard Summary */
.review-summary-card {
    background: #F9FAFB;
    border: 1px solid var(--admin-border);
    border-radius: 16px;
    padding: 32px;
}

.review-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 24px;
    margin-bottom: 24px;
}

.review-item-box {
    background: white;
    padding: 20px;
    border-radius: 12px;
    border: 1px solid var(--admin-border);
    box-shadow: var(--admin-shadow);
}

.review-label {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--admin-accent);
    margin-bottom: 8px;
}

.review-value {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--admin-text);
}

/* Wizard Actions */
.wizard-actions {
    margin-top: 40px;
    padding-top: 32px;
    border-top: 1px solid var(--admin-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.btn-wizard {
    padding: 12px 24px;
    font-size: 1rem;
    border-radius: 10px;
    font-weight: 700;
    cursor: pointer;
    transition: var(--admin-transition);
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-primary-wizard {
    background: var(--admin-text);
    color: white;
    border: none;
}

.btn-primary-wizard:hover {
    background: #000;
    transform: translateY(-1px);
}

.btn-secondary-wizard {
    background: white;
    color: var(--admin-text);
    border: 1px solid var(--admin-border);
}

.btn-success-wizard {
    background: #059669;
    color: white;
    border: none;
}

/* Alerts Premium */
.alert-premium {
    padding: 20px 24px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 32px;
    font-weight: 600;
}

.alert-success-premium {
    background: #ECFDF5;
    color: #065F46;
    border: 1px solid #A7F3D0;
}

.alert-error-premium {
    background: #FEF2F2;
    color: #991B1B;
    border: 1px solid #FECACA;
}

/* Current Images Grid (for Edit) */
.current-images-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 20px;
}

.current-image-item {
    position: relative;
    border-radius: 16px;
    overflow: hidden;
    aspect-ratio: 1;
    border: 1px solid var(--admin-border);
    box-shadow: var(--admin-shadow);
}

.current-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: var(--admin-transition);
}

.image-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: var(--admin-transition);
}

.current-image-item:hover .image-overlay {
    opacity: 1;
}

.current-image-item:hover .current-image {
    transform: scale(1.1);
}

.delete-image-btn {
    background: white;
    color: #DC2626;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    font-size: 1.25rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    transition: var(--admin-transition);
}

.delete-image-btn:hover {
    background: #DC2626;
    color: white;
    transform: scale(1.1);
}

/* Responsive Wizard */
@media (max-width: 640px) {
    .wizard-steps {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }

    .wizard-step {
        flex-direction: row;
        align-items: center;
    }
}

/* Responsive */
@media (max-width: 768px) {
    .dashboard-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 20px;
    }

    .table-header {
        flex-direction: column;
        gap: 16px;
    }

    .search-input {
        width: 100%;
    }
}