/* CONTENT FOR: DollsDollhouse/css/admin.css */

/* =========================================
   1. VARIABLES & THEME CONFIGURATION
   ========================================= */
:root {
    /* Brand Colors */
    --primary-pink: #ff69b4;
    --dark-pink: #db2777;
    --deep-burgundy: #831843;
    --light-pink: #fdf2f8;
    --hover-pink: #fce7f3;
    
    /* Functional Colors */
    --accent-gold: #fbbf24;
    --text-dark: #1f2937;
    --text-medium: #4b5563;
    --text-light: #9ca3af;
    --white: #ffffff;
    --bg-gray: #f9fafb;
    --border-color: #e5e7eb;
    
    /* Status Colors */
    --success-bg: #dcfce7;
    --success-text: #15803d;
    --warning-bg: #fef9c3;
    --warning-text: #a16207;
    --danger-bg: #fee2e2;
    --danger-text: #b91c1c;
    --info-bg: #dbeafe;
    --info-text: #1d4ed8;

    /* Layout Dimensions */
    --sidebar-width: 280px;
    --header-height: 70px;
    
    /* Typography */
    --font-main: 'Inter', system-ui, -apple-system, sans-serif;
    --font-display: 'Lovelace', serif;
    --font-script: 'Pinyon Script', cursive;
    
    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-luxury: 0 20px 40px rgba(219, 39, 119, 0.15);
}

/* =========================================
   2. GLOBAL RESET & BASE STYLES
   ========================================= */
* {
    box-sizing: border-box;
    outline: none;
}

html, body {
    margin: 0;
    padding: 0;
    height: 100%;
    font-family: var(--font-main);
    background-color: var(--bg-gray);
    color: var(--text-dark);
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6 {
    margin: 0;
    font-family: var(--font-display);
    color: var(--deep-burgundy);
    font-weight: 500;
}

p {
    margin: 0 0 1rem 0;
    line-height: 1.6;
    color: var(--text-medium);
}

a {
    text-decoration: none;
    color: inherit;
    transition: color 0.2s ease;
}

ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--dark-pink);
}

/* =========================================
   3. LAYOUT STRUCTURE
   ========================================= */
.admin-wrapper {
    display: flex;
    width: 100%;
    height: 100vh;
    overflow: hidden;
}

.admin-container {
    display: flex;
    width: 100%;
    height: 100%;
}

/* =========================================
   4. SIDEBAR NAVIGATION
   ========================================= */
.sidebar {
    width: var(--sidebar-width);
    background: var(--white);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    padding: 24px;
    z-index: 50;
    transition: transform 0.3s ease;
}

.brand {
    text-align: center;
    margin-bottom: 40px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--light-pink);
}

.brand h2 {
    font-family: var(--font-script);
    font-size: 3rem;
    color: var(--dark-pink);
    line-height: 1;
    margin-bottom: 5px;
}

.brand span {
    font-family: var(--font-main);
    text-transform: uppercase;
    letter-spacing: 3px;
    font-size: 0.75rem;
    color: var(--text-light);
    font-weight: 600;
}

.sidebar nav {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.nav-link {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 12px 16px;
    border: none;
    background: transparent;
    color: var(--text-medium);
    font-family: var(--font-main);
    font-size: 0.95rem;
    font-weight: 500;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
}

.nav-link:hover {
    background-color: var(--light-pink);
    color: var(--dark-pink);
}

.nav-link.active {
    background-color: var(--light-pink);
    color: var(--dark-pink);
    font-weight: 600;
    box-shadow: var(--shadow-sm);
}

.logout-container {
    margin-top: auto;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}

/* =========================================
   5. MAIN CONTENT AREA
   ========================================= */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
    background-color: var(--bg-gray);
    position: relative;
}

.top-bar {
    height: var(--header-height);
    background: var(--white);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 40px;
    flex-shrink: 0;
}

.page-title h1 {
    font-size: 1.5rem;
    color: var(--text-dark);
}

.date-badge {
    background: var(--light-pink);
    color: var(--dark-pink);
    padding: 6px 16px;
    border-radius: 50px;
    font-size: 0.85rem;
    font-weight: 500;
    border: 1px solid var(--hover-pink);
}

.content-scroll {
    flex: 1;
    overflow-y: auto;
    padding: 40px;
    scroll-behavior: smooth;
}

.content-section {
    display: none;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.3s ease, transform 0.3s ease;
    max-width: 1400px;
    margin: 0 auto;
}

.content-section.active {
    display: block;
    opacity: 1;
    transform: translateY(0);
}

/* =========================================
   6. COMPONENT: STATS GRID (DASHBOARD)
   ========================================= */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 24px;
    margin-bottom: 40px;
}

.stat-card {
    background: var(--white);
    padding: 24px;
    border-radius: 16px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--hover-pink);
}

.stat-card h3 {
    font-family: var(--font-main);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-light);
    margin-bottom: 12px;
}

.stat-card p {
    font-family: var(--font-display);
    font-size: 2.5rem;
    color: var(--deep-burgundy);
    font-weight: 700;
    margin: 0;
    line-height: 1;
}

/* =========================================
   7. COMPONENT: DATA TABLES
   ========================================= */
.table-container {
    background: var(--white);
    border-radius: 16px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    overflow: hidden;
    margin-bottom: 20px;
}

.table-responsive {
    overflow-x: auto;
    width: 100%;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 800px; /* Force scroll on small screens */
}

.data-table th {
    background: var(--light-pink);
    color: var(--deep-burgundy);
    font-family: var(--font-main);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.5px;
    padding: 16px 24px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.data-table td {
    padding: 16px 24px;
    border-bottom: 1px solid var(--bg-gray);
    color: var(--text-medium);
    font-size: 0.95rem;
    vertical-align: middle;
}

.data-table tr:last-child td {
    border-bottom: none;
}

.data-table tr:hover td {
    background-color: #fafafa;
}

.table-thumb {
    width: 48px;
    height: 48px;
    border-radius: 8px;
    object-fit: cover;
    border: 1px solid var(--border-color);
}

/* Status Badges */
.status-badge {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 50px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.status-badge.paid, .status-badge.active, .status-badge.completed {
    background-color: var(--success-bg);
    color: var(--success-text);
}

.status-badge.pending, .status-badge.processing {
    background-color: var(--warning-bg);
    color: var(--warning-text);
}

.status-badge.shipped {
    background-color: var(--info-bg);
    color: var(--info-text);
}

.status-badge.cancelled, .status-badge.failed, .status-badge.inactive {
    background-color: var(--danger-bg);
    color: var(--danger-text);
}

/* =========================================
   8. COMPONENT: FORMS & INPUTS
   ========================================= */
.form-section {
    background: var(--white);
    padding: 30px;
    border-radius: 16px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    margin-bottom: 30px;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text-dark);
    font-size: 0.9rem;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="date"],
select,
textarea {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-family: var(--font-main);
    font-size: 0.95rem;
    color: var(--text-dark);
    background-color: #fff;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--dark-pink);
    box-shadow: 0 0 0 3px rgba(219, 39, 119, 0.1);
}

textarea {
    resize: vertical;
    min-height: 100px;
}

/* Variant Row (Product Editor) */
.variant-header-row {
    display: flex;
    gap: 10px;
    padding: 0 10px 8px;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-light);
    text-transform: uppercase;
}

.variant-row {
    display: flex;
    gap: 10px;
    align-items: center;
    background: var(--bg-gray);
    padding: 10px;
    border-radius: 8px;
    margin-bottom: 10px;
    border: 1px solid var(--border-color);
}

.variant-row input {
    padding: 8px 12px;
    font-size: 0.9rem;
}

.mini-upload {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
}

.mini-upload-btn {
    background: var(--white);
    border: 1px solid var(--border-color);
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.8rem;
    cursor: pointer;
    font-weight: 500;
}

.mini-preview {
    width: 36px;
    height: 36px;
    border-radius: 4px;
    object-fit: cover;
    border: 1px solid var(--border-color);
}

/* =========================================
   9. COMPONENT: BUTTONS
   ========================================= */
.primary-btn, .secondary-btn, .delete-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 24px;
    border-radius: 50px;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    font-family: var(--font-main);
}

.primary-btn {
    background-color: var(--dark-pink);
    color: var(--white);
    box-shadow: 0 4px 12px rgba(219, 39, 119, 0.25);
}

.primary-btn:hover {
    background-color: var(--deep-burgundy);
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(219, 39, 119, 0.35);
}

.secondary-btn {
    background-color: var(--white);
    color: var(--text-dark);
    border: 1px solid var(--border-color);
}

.secondary-btn:hover {
    background-color: var(--bg-gray);
    border-color: var(--text-light);
}

.delete-btn {
    background-color: transparent;
    color: var(--danger-text);
    padding: 6px 12px;
    border: 1px solid transparent;
}

.delete-btn:hover {
    background-color: var(--danger-bg);
}

.small {
    padding: 6px 12px;
    font-size: 0.8rem;
}

.full-width {
    width: 100%;
}

/* =========================================
   10. COMPONENT: GALLERY GRID (INSTAGRAM STYLE)
   ========================================= */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 24px;
}

.gallery-card {
    aspect-ratio: 1/1;
    background: var(--white);
    border-radius: 12px;
    overflow: hidden;
    position: relative;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    cursor: pointer;
    transition: transform 0.2s ease;
}

.gallery-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.gallery-media-wrapper {
    width: 100%;
    height: 100%;
    position: relative;
    background: #000;
}

.gallery-media-wrapper img,
.gallery-media-wrapper video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.gallery-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    background: linear-gradient(to top, rgba(0,0,0,0.8) 0%, transparent 100%);
    padding: 20px 15px 10px;
    color: var(--white);
    display: flex;
    justify-content: space-between;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.gallery-card:hover .gallery-overlay {
    opacity: 1;
}

/* =========================================
   11. COMPONENT: TABS (AFFILIATES)
   ========================================= */
.tabs {
    display: flex;
    gap: 20px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 30px;
}

.tab-btn {
    background: transparent;
    border: none;
    padding: 12px 4px;
    font-family: var(--font-main);
    font-size: 1rem;
    color: var(--text-light);
    cursor: pointer;
    position: relative;
    font-weight: 500;
    transition: color 0.2s ease;
}

.tab-btn:hover {
    color: var(--dark-pink);
}

.tab-btn.active {
    color: var(--dark-pink);
    font-weight: 600;
}

.tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    width: 100%;
    height: 2px;
    background: var(--dark-pink);
}

/* =========================================
   12. COMPONENT: LOGIN OVERLAY
   ========================================= */
.login-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(8px);
    z-index: 9999;
    display: none; /* Toggled by JS */
    align-items: center;
    justify-content: center;
}

.login-box {
    background: var(--white);
    padding: 50px 40px;
    border-radius: 24px;
    box-shadow: var(--shadow-luxury);
    width: 100%;
    max-width: 420px;
    text-align: center;
    border: 1px solid var(--hover-pink);
    animation: zoomIn 0.3s ease;
}

.login-box h2 {
    font-size: 4rem;
    margin-bottom: 10px;
}

.login-box p {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 40px;
    color: var(--text-light);
}

/* =========================================
   13. COMPONENT: MODALS
   ========================================= */
.modal {
    display: none;
    position: fixed;
    z-index: 5000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-content {
    background-color: var(--white);
    border-radius: 20px;
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    box-shadow: var(--shadow-luxury);
    padding: 40px;
    animation: slideUp 0.3s ease;
}

.modal-content.large-modal {
    max-width: 900px;
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.close-modal {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--bg-gray);
    color: var(--text-medium);
    cursor: pointer;
    font-size: 1.5rem;
    line-height: 1;
    transition: all 0.2s;
}

.close-modal:hover {
    background: var(--danger-bg);
    color: var(--danger-text);
}

/* Instagram-Style Edit Modal Specifics */
.insta-modal-content {
    padding: 0 !important;
    display: flex;
    max-width: 900px !important;
    height: 600px;
    overflow: hidden;
    background: var(--white);
    border-radius: 12px; /* Sharper corners like IG */
}

.insta-preview {
    flex: 1.5;
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.insta-preview img, 
.insta-preview video {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.insta-form {
    flex: 1;
    display: flex;
    flex-direction: column;
    border-left: 1px solid var(--border-color);
    background: var(--white);
    min-width: 320px;
}

.insta-header {
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 12px;
}

.insta-user-pic {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid var(--border-color);
}

.insta-username {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-dark);
}

.insta-caption-area {
    flex: 1;
    padding: 16px;
    border: none;
    resize: none;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    font-size: 1rem;
    line-height: 1.5;
    outline: none;
}

.insta-footer {
    padding: 16px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* =========================================
   14. MOBILE RESPONSIVENESS
   ========================================= */
@media (max-width: 1024px) {
    .admin-wrapper {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        height: auto;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
        padding: 15px;
    }

    .brand {
        margin-bottom: 15px;
        padding-bottom: 10px;
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        display: flex;
    }
    
    .brand h2 { font-size: 2rem; }

    .sidebar nav {
        flex-direction: row;
        overflow-x: auto;
        padding-bottom: 5px;
        gap: 10px;
    }

    .nav-link {
        width: auto;
        white-space: nowrap;
        padding: 8px 16px;
        background: var(--white);
        border: 1px solid var(--border-color);
    }

    .logout-container {
        display: none; /* Hide or move to top */
    }

    .main-content {
        padding: 0;
    }

    .content-scroll {
        padding: 20px;
    }

    .form-grid {
        grid-template-columns: 1fr;
    }

    .insta-modal-content {
        flex-direction: column;
        height: 90vh;
        overflow-y: auto;
    }

    .insta-preview {
        flex: none;
        height: 50%;
    }

    .insta-form {
        border-left: none;
        border-top: 1px solid var(--border-color);
        flex: 1;
        min-height: 300px;
    }
}