/* ==========================================================================
   Element Ranch Media Portal - ERML Design System
   ========================================================================== */

/* --------------------------------------------------------------------------
   CSS Custom Properties - Design Tokens
   -------------------------------------------------------------------------- */
:root {
    /* Primary Brand Colors - ERML Sage Green */
    --er-primary: #607158;
    --er-primary-dark: #4a5845;
    --er-primary-light: #7a8b72;
    --er-secondary: #324245;

    /* Accent Colors - Warm Beige */
    --er-accent: #cdc3ad;
    --er-accent-light: #d8e0b9;
    --er-accent-dark: #b5aa94;

    /* Neutrals */
    --er-charcoal: #292f26;
    --er-charcoal-soft: #3d4239;
    --er-light: #f7f5f2;
    --er-warm-white: #fdfcfa;
    --er-border: #d9d4cb;
    --er-stone: #7a7269;
    --er-stone-light: #a39e96;

    /* Legacy aliases for compatibility */
    --charcoal: var(--er-charcoal);
    --charcoal-soft: var(--er-charcoal-soft);
    --stone: var(--er-stone);
    --stone-light: var(--er-stone-light);
    --cream: var(--er-warm-white);
    --white: #ffffff;
    --sand: var(--er-light);
    --sand-warm: #ebe3d5;
    --sand-deep: var(--er-border);

    /* Primary color aliases */
    --terracotta: var(--er-primary);
    --terracotta-dark: var(--er-primary-dark);
    --terracotta-light: var(--er-primary-light);

    /* System */
    --error: #c45050;
    --success: #5a8a5a;
    --warning: #d4a04a;

    /* Status Colors */
    --status-processed: #4caf50;
    --status-pending: #2196f3;
    --status-processing: #ff9800;

    /* Typography - Raleway */
    --font-display: 'Raleway', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-body: 'Raleway', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

    /* Layout */
    --sidebar-width: 220px;
    --topbar-height: 56px;

    /* Spacing Scale */
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 16px;
    --space-lg: 24px;
    --space-xl: 32px;
    --space-2xl: 48px;
    --space-3xl: 64px;
    --space-4xl: 96px;

    /* Border Radius */
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --radius-full: 9999px;

    /* Shadows */
    --shadow-sm: 0 1px 3px rgba(41, 47, 38, 0.08);
    --shadow-md: 0 4px 16px rgba(41, 47, 38, 0.1);
    --shadow-lg: 0 12px 40px rgba(41, 47, 38, 0.12);
    --shadow-xl: 0 24px 60px rgba(41, 47, 38, 0.16);

    /* Transitions */
    --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
    --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
    --duration-fast: 150ms;
    --duration-normal: 300ms;
    --duration-slow: 500ms;
}

/* --------------------------------------------------------------------------
   Base & Reset
   -------------------------------------------------------------------------- */
*, *::before, *::after {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-body);
    font-size: 15px;
    line-height: 1.6;
    color: var(--er-charcoal);
    background: var(--er-light);
    margin: 0;
    min-height: 100vh;
}

::selection {
    background: var(--er-accent);
    color: var(--er-charcoal);
}

/* --------------------------------------------------------------------------
   Typography
   -------------------------------------------------------------------------- */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-display);
    font-weight: 600;
    line-height: 1.2;
    color: var(--er-charcoal);
    margin: 0;
    letter-spacing: -0.01em;
}

h1 { font-size: clamp(1.75rem, 4vw, 2.5rem); }
h2 { font-size: clamp(1.5rem, 3vw, 2rem); }
h3 { font-size: clamp(1.25rem, 2vw, 1.5rem); }
h4 { font-size: 1.125rem; }

.text-muted { color: var(--er-stone); }
.text-accent { color: var(--er-primary); }

a {
    color: var(--er-primary);
    text-decoration: none;
    transition: color var(--duration-fast) var(--ease-out);
}

a:hover {
    color: var(--er-primary-dark);
}

/* --------------------------------------------------------------------------
   App Shell
   -------------------------------------------------------------------------- */
.bg-body { background: var(--er-light); }

.app-shell {
    min-height: 100vh;
    display: flex;
}

/* --------------------------------------------------------------------------
   Top Bar (ERML Style - Dark)
   -------------------------------------------------------------------------- */
.topbar {
    background: var(--er-charcoal);
    height: var(--topbar-height);
    position: fixed;
    top: 0;
    left: var(--sidebar-width);
    right: 0;
    z-index: 50;
    padding: 0 var(--space-lg);
    display: flex;
    align-items: center;
    gap: var(--space-lg);
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.topbar h1 {
    font-size: 1rem;
    font-weight: 600;
    color: #fff;
    letter-spacing: 0.01em;
}

/* Search Bar in Topbar */
.top-search {
    display: flex;
    gap: var(--space-sm);
    flex: 1;
    max-width: 420px;
    margin-left: auto;
}

.top-search .form-control {
    flex: 1;
    padding: var(--space-sm) var(--space-md);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: var(--radius-md);
    background: rgba(255,255,255,0.1);
    color: #fff;
    font-size: 14px;
    transition: all var(--duration-fast) var(--ease-out);
}

.top-search .form-control:focus {
    outline: none;
    background: rgba(255,255,255,0.18);
    border-color: rgba(255,255,255,0.35);
}

.top-search .form-control::placeholder {
    color: rgba(255,255,255,0.5);
}

.top-search .btn {
    background: var(--er-primary);
    border-color: var(--er-primary);
    color: #fff;
}

.top-search .btn:hover {
    background: var(--er-primary-light);
    border-color: var(--er-primary-light);
}

/* --------------------------------------------------------------------------
   Sidebar (ERML Style)
   -------------------------------------------------------------------------- */
.sidebar {
    width: var(--sidebar-width);
    background: var(--er-warm-white);
    border-right: 1px solid var(--er-border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    overflow-y: auto;
    z-index: 100;
}

/* Brand */
.brand {
    padding: var(--space-sm) var(--space-md);
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    border-bottom: 1px solid var(--er-border);
    background: var(--er-charcoal);
    min-height: var(--topbar-height);
}

.brand-logo {
    height: 28px;
    width: auto;
}

.brand-logo img {
    height: 100%;
    width: auto;
}

.brand-name {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 14px;
    color: #fff;
    letter-spacing: 0.02em;
}

.brand-sub {
    font-size: 10px;
    color: rgba(255,255,255,0.6);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-top: 2px;
}

/* Navigation */
.sidebar .nav {
    padding: var(--space-sm) 0;
    flex: 1;
}

.sidebar .nav-link {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: 0.5rem var(--space-md);
    color: var(--er-charcoal-soft);
    font-weight: 500;
    font-size: 0.8rem;
    letter-spacing: 0.01em;
    transition: all var(--duration-fast) var(--ease-out);
    border-left: 3px solid transparent;
}

.sidebar .nav-link:hover {
    background: rgba(96, 113, 88, 0.06);
    color: var(--er-charcoal);
}

.sidebar .nav-link.active {
    background: rgba(96, 113, 88, 0.1);
    color: var(--er-primary);
    font-weight: 600;
    border-left-color: var(--er-primary);
}

.sidebar .nav-link .nav-icon {
    width: 18px;
    height: 18px;
    opacity: 0.7;
}

.sidebar .nav-link.active .nav-icon {
    opacity: 1;
}

/* Sidebar Footer */
.sidebar-footer {
    padding: var(--space-xs) var(--space-md) var(--space-sm);
    border-top: 1px solid var(--er-border);
    background: var(--er-warm-white);
}

.sidebar-footer .user-email {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--er-charcoal);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-footer .user-role {
    font-size: 0.65rem;
    color: var(--er-stone-light);
    text-transform: capitalize;
}

.sidebar-footer .btn-logout,
.sidebar-footer .btn-outline-light {
    margin-top: 0.5rem;
    width: 100%;
    padding: 0.35rem 0.6rem;
    border: 1px solid var(--er-border);
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--er-charcoal-soft);
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--duration-fast) var(--ease-out);
    font-family: inherit;
    text-align: center;
    text-decoration: none;
    display: block;
}

.sidebar-footer .btn-logout:hover,
.sidebar-footer .btn-outline-light:hover {
    border-color: var(--er-primary);
    color: var(--er-primary);
}

/* --------------------------------------------------------------------------
   Main Content
   -------------------------------------------------------------------------- */
.main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    margin-left: var(--sidebar-width);
    position: relative;
}

.content {
    flex: 1;
    padding: var(--space-lg);
    max-width: 1600px;
    width: 100%;
}

/* Mobile Menu Toggle */
.mobile-menu-toggle {
    position: fixed;
    top: var(--space-sm);
    left: var(--space-sm);
    z-index: 50;
    background: var(--er-charcoal);
    color: #fff;
    border-radius: var(--radius-sm);
    padding: var(--space-xs);
}

/* --------------------------------------------------------------------------
   Buttons
   -------------------------------------------------------------------------- */
.btn {
    font-family: var(--font-body);
    font-weight: 500;
    font-size: 14px;
    padding: var(--space-sm) var(--space-lg);
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    cursor: pointer;
    transition: all var(--duration-fast) var(--ease-out);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
}

.btn-primary {
    background: var(--er-primary);
    color: #fff;
    border-color: var(--er-primary);
}

.btn-primary:hover {
    background: var(--er-primary-dark);
    border-color: var(--er-primary-dark);
    color: #fff;
}

.btn-outline-secondary {
    background: transparent;
    border-color: var(--er-border);
    color: var(--er-charcoal-soft);
}

.btn-outline-secondary:hover,
.btn-outline-secondary.active {
    background: var(--er-light);
    border-color: var(--er-primary);
    color: var(--er-primary);
}

.btn-link {
    background: none;
    border: none;
    color: var(--er-primary);
    padding: var(--space-sm);
}

.btn-link:hover {
    color: var(--er-primary-dark);
    background: none;
}

.btn-sm {
    padding: 0.3rem 0.6rem;
    font-size: 0.75rem;
}

/* --------------------------------------------------------------------------
   Filter Bar (ERML Style)
   -------------------------------------------------------------------------- */
.filter-bar {
    position: sticky;
    top: 0;
    z-index: 40;
    background: var(--er-light);
    padding: 0.75rem 0;
    margin-bottom: var(--space-md);
}

.filter-card {
    background: var(--er-accent);
    border-radius: var(--radius-md);
    padding: 0.5rem 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.filter-btn {
    padding: 0.3rem 0.6rem;
    border: 1px solid rgba(41, 47, 38, 0.15);
    border-radius: var(--radius-sm);
    background: rgba(255,255,255,0.6);
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--er-charcoal);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.35rem;
    transition: all var(--duration-fast) var(--ease-out);
    font-family: inherit;
}

.filter-btn:hover {
    background: rgba(255,255,255,0.9);
    border-color: var(--er-primary);
    color: var(--er-primary);
}

.filter-btn .chevron {
    font-size: 0.6rem;
    opacity: 0.6;
}

.filter-chip {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.25rem 0.5rem;
    background: var(--er-charcoal);
    color: #fff;
    border-radius: var(--radius-sm);
    font-size: 0.7rem;
    font-weight: 500;
}

.filter-chip .chip-label {
    opacity: 0.7;
    margin-right: 0.1rem;
}

.filter-chip button {
    background: none;
    border: none;
    color: rgba(255,255,255,0.6);
    cursor: pointer;
    padding: 0;
    font-size: 0.9rem;
    line-height: 1;
    transition: color var(--duration-fast);
    margin-left: 0.15rem;
}

.filter-chip button:hover {
    color: #fff;
}

.filter-divider {
    width: 1px;
    height: 22px;
    background: rgba(41, 47, 38, 0.2);
    margin: 0 0.35rem;
}

.filter-right {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.clear-filters {
    font-size: 0.75rem;
    color: var(--er-charcoal-soft);
    text-decoration: none;
    cursor: pointer;
    transition: color var(--duration-fast);
    background: none;
    border: none;
    font-family: inherit;
}

.clear-filters:hover {
    color: var(--er-primary);
}

.result-count {
    font-size: 0.8rem;
    color: var(--er-charcoal-soft);
    font-weight: 500;
}

/* --------------------------------------------------------------------------
   Bulk Select Toggle & Bar
   -------------------------------------------------------------------------- */
.bulk-toggle {
    padding: 0.3rem 0.6rem;
    border: 1px solid rgba(41, 47, 38, 0.15);
    border-radius: var(--radius-sm);
    background: rgba(255,255,255,0.6);
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--er-charcoal);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.35rem;
    transition: all var(--duration-fast) var(--ease-out);
    font-family: inherit;
}

.bulk-toggle:hover {
    background: rgba(255,255,255,0.9);
    border-color: var(--er-primary);
    color: var(--er-primary);
}

.bulk-toggle.active {
    background: var(--er-primary);
    border-color: var(--er-primary);
    color: #fff;
}

/* Bulk Action Bar */
.bulk-bar {
    display: none;
    position: sticky;
    top: 0;
    z-index: 40;
    background: var(--er-charcoal);
    border-radius: var(--radius-md);
    padding: 0.6rem 1rem;
    margin-bottom: var(--space-md);
    align-items: center;
    gap: 1rem;
    color: #fff;
}

.bulk-bar.active {
    display: flex;
}

.bulk-bar .selection-count {
    font-size: 0.85rem;
    font-weight: 500;
}

.bulk-bar .bulk-actions {
    display: flex;
    gap: 0.5rem;
    margin-left: auto;
}

.bulk-action-btn {
    padding: 0.35rem 0.75rem;
    border: 1px solid rgba(255,255,255,0.3);
    border-radius: var(--radius-sm);
    background: transparent;
    color: #fff;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.35rem;
    transition: all var(--duration-fast) var(--ease-out);
    font-family: inherit;
}

.bulk-action-btn:hover {
    background: rgba(255,255,255,0.15);
    border-color: rgba(255,255,255,0.5);
}

.bulk-action-btn.primary {
    background: var(--er-primary);
    border-color: var(--er-primary);
}

.bulk-action-btn.primary:hover {
    background: var(--er-primary-light);
}

.bulk-close {
    background: none;
    border: none;
    color: rgba(255,255,255,0.6);
    cursor: pointer;
    padding: 0.25rem;
    font-size: 1.1rem;
    line-height: 1;
    transition: color var(--duration-fast);
}

.bulk-close:hover {
    color: #fff;
}

/* --------------------------------------------------------------------------
   Cards
   -------------------------------------------------------------------------- */
.card {
    background: var(--er-warm-white);
    border: 1px solid var(--er-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.card-header {
    padding: var(--space-lg);
    border-bottom: 1px solid var(--er-border);
    background: var(--white);
}

.card-body {
    padding: var(--space-xl);
}

/* --------------------------------------------------------------------------
   Property Cards - Hero Style
   -------------------------------------------------------------------------- */
.thumb-card {
    display: block;
    background: var(--er-warm-white);
    border-radius: var(--radius-lg);
    overflow: hidden;
    text-decoration: none;
    position: relative;
    box-shadow: var(--shadow-md);
    transition: all var(--duration-normal) var(--ease-out);
}

.thumb-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.property-card {
    aspect-ratio: 4/3;
    display: flex;
    align-items: stretch;
}

.property-card .thumb {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center;
    transition: transform var(--duration-slow) var(--ease-out);
}

.property-card:hover .thumb {
    transform: scale(1.05);
}

.property-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(
        to top,
        rgba(41, 47, 38, 0.85) 0%,
        rgba(41, 47, 38, 0.4) 40%,
        rgba(41, 47, 38, 0.2) 100%
    );
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: var(--space-xl);
    transition: background var(--duration-normal) var(--ease-out);
}

.property-card:hover .property-overlay {
    background: linear-gradient(
        to top,
        rgba(41, 47, 38, 0.9) 0%,
        rgba(41, 47, 38, 0.3) 50%,
        transparent 100%
    );
}

.property-name {
    font-family: var(--font-display);
    font-size: clamp(1.5rem, 3vw, 2rem);
    font-weight: 600;
    color: #fff;
    letter-spacing: 0.02em;
    margin-bottom: var(--space-xs);
    text-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.property-count {
    font-size: 13px;
    color: var(--er-accent);
    opacity: 0.9;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

/* --------------------------------------------------------------------------
   Image Grid - Masonry (ERML Style)
   -------------------------------------------------------------------------- */
.masonry-grid {
    column-count: 5;
    column-gap: 10px;
}

.masonry-item {
    break-inside: avoid;
    margin-bottom: 10px;
}

/* Image Cards */
.image-card {
    position: relative;
    border-radius: var(--radius-md);
    overflow: hidden;
    background: #e8e4de;
    cursor: pointer;
}

.image-card .thumb {
    background-size: cover;
    background-position: center;
    transition: transform var(--duration-normal) var(--ease-out);
}

.image-card:hover .thumb {
    transform: scale(1.02);
}

.thumb {
    padding-top: 66%;
    position: relative;
    overflow: hidden;
}

.thumb.landscape { padding-top: 66%; }
.thumb.portrait { padding-top: 140%; }
.thumb.square { padding-top: 100%; }

.thumb.no-thumb {
    background: linear-gradient(135deg, var(--er-border), var(--er-accent));
}

/* Thumb Meta (Hidden by default, shown on hover as overlay) */
.thumb-meta {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 1.5rem 0.5rem 0.4rem;
    background: linear-gradient(to top, rgba(0,0,0,0.65), transparent);
    color: #fff;
    opacity: 0;
    transition: opacity var(--duration-fast) var(--ease-out);
}

.image-card:hover .thumb-meta {
    opacity: 1;
}

.thumb-meta .name {
    font-weight: 500;
    font-size: 0.75rem;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.thumb-meta .sub {
    font-size: 0.65rem;
    color: rgba(255,255,255,0.85);
}

/* Bulk Selection Checkbox */
.bulk-checkbox {
    display: none;
    position: absolute;
    top: 8px;
    left: 8px;
    width: 22px;
    height: 22px;
    border-radius: var(--radius-sm);
    background: rgba(255,255,255,0.9);
    border: 2px solid var(--er-border);
    cursor: pointer;
    z-index: 15;
    align-items: center;
    justify-content: center;
    transition: all var(--duration-fast);
}

.bulk-mode .bulk-checkbox {
    display: flex;
}

.bulk-checkbox.checked {
    background: var(--er-primary);
    border-color: var(--er-primary);
    color: #fff;
}

.bulk-checkbox .check-icon {
    display: none;
    font-size: 0.75rem;
    font-weight: bold;
}

.bulk-checkbox.checked .check-icon {
    display: block;
}

/* Quick Actions (on hover) */
.quick-actions {
    position: absolute;
    top: 6px;
    right: 6px;
    display: flex;
    gap: 3px;
    opacity: 0;
    transition: opacity var(--duration-fast);
    z-index: 10;
}

.image-card:hover .quick-actions {
    opacity: 1;
}

.quick-action {
    width: 26px;
    height: 26px;
    border-radius: var(--radius-sm);
    background: rgba(0,0,0,0.55);
    border: none;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    transition: all var(--duration-fast);
}

.quick-action:hover {
    background: rgba(0,0,0,0.75);
    transform: scale(1.08);
}

.quick-action.active {
    color: var(--er-accent-light);
}

/* Responsive Grid */
@media (max-width: 1400px) {
    .masonry-grid { column-count: 4; }
}
@media (max-width: 1100px) {
    .masonry-grid { column-count: 3; }
}
@media (max-width: 768px) {
    .masonry-grid { column-count: 2; }
}
@media (max-width: 480px) {
    .masonry-grid { column-count: 1; }
}

/* --------------------------------------------------------------------------
   Image Detail Modal
   -------------------------------------------------------------------------- */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(18, 16, 14, 0.96);
    backdrop-filter: blur(20px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1050;
    padding: 0;
    animation: modalFadeIn var(--duration-normal) var(--ease-out);
}

@keyframes modalFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-backdrop.d-none { display: none; }

.modal-container {
    position: relative;
    width: calc(100% - 48px);
    height: calc(100% - 48px);
    max-height: calc(100vh - 48px);
    display: flex;
    margin: 24px;
    animation: modalSlideIn var(--duration-normal) var(--ease-out);
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Close Button */
.modal-close {
    position: absolute;
    top: var(--space-lg);
    right: var(--space-lg);
    width: 48px;
    height: 48px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: var(--radius-full);
    cursor: pointer;
    display: grid;
    place-items: center;
    transition: all var(--duration-fast) var(--ease-out);
    color: rgba(255, 255, 255, 0.7);
    z-index: 100;
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
    transform: rotate(90deg);
}

/* Split Layout */
.modal-layout {
    display: flex;
    width: 100%;
    height: 100%;
}

/* Image Panel - Left Side */
.modal-image-panel {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-xl);
    min-width: 0;
    background: rgba(0, 0, 0, 0.3);
}

.modal-image-wrapper {
    position: relative;
    max-width: 100%;
    max-height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-image-wrapper img {
    max-width: 100%;
    max-height: calc(100vh - 80px);
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: var(--radius-md);
    box-shadow: 0 30px 100px rgba(0, 0, 0, 0.6);
}

/* Info Panel - Right Side */
.modal-info-panel {
    width: 420px;
    min-width: 360px;
    max-width: 480px;
    flex-shrink: 0;
    background: var(--er-warm-white);
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
}

.modal-info-scroll {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-2xl) var(--space-xl);
}

/* Modal Header */
.modal-header {
    display: block;
    margin-bottom: var(--space-xl);
    padding-bottom: var(--space-lg);
    border-bottom: 1px solid var(--er-border);
}

.modal-location {
    display: block;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--er-primary);
    margin-bottom: var(--space-sm);
    font-weight: 600;
}

.modal-location .location-property,
.modal-location .location-divider,
.modal-location .location-space {
    display: inline;
}

.modal-location .location-divider {
    margin: 0 4px;
    opacity: 0.4;
}

.modal-title {
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--er-charcoal);
    line-height: 1.3;
    margin: 0;
}

/* Modal Sections */
.modal-section {
    margin-bottom: var(--space-lg);
    padding-bottom: var(--space-lg);
    border-bottom: 1px solid var(--er-border);
}

.modal-section:last-of-type {
    border-bottom: none;
}

.section-label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--er-stone);
    font-weight: 600;
    margin-bottom: var(--space-sm);
    display: flex;
    align-items: center;
    gap: var(--space-xs);
}

.modal-description {
    font-size: 14px;
    line-height: 1.7;
    color: var(--er-charcoal-soft);
    margin: 0;
}

/* Copyable Fields */
.copyable-field {
    position: relative;
    background: var(--er-light);
    border-radius: var(--radius-md);
    padding: var(--space-md);
    padding-right: var(--space-3xl);
}

.field-content {
    font-size: 13px;
    line-height: 1.6;
    color: var(--er-charcoal);
    margin: 0;
    word-break: break-word;
}

.field-content.insta-caption {
    font-style: italic;
}

.field-content.hashtags {
    color: var(--er-primary-dark);
    font-size: 12px;
}

.copy-btn {
    position: absolute;
    top: var(--space-sm);
    right: var(--space-sm);
    width: 32px;
    height: 32px;
    background: var(--er-warm-white);
    border: 1px solid var(--er-border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: grid;
    place-items: center;
    color: var(--er-stone);
    transition: all var(--duration-fast) var(--ease-out);
}

.copy-btn:hover {
    background: var(--er-primary);
    border-color: var(--er-primary);
    color: #fff;
}

.copy-btn.copied {
    background: var(--success);
    border-color: var(--success);
    color: #fff;
}

/* Keywords */
.keywords-list {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-xs);
}

.keyword-tag {
    display: inline-block;
    padding: 2px 8px;
    background: var(--er-warm-white);
    border: 1px solid var(--er-border);
    border-radius: var(--radius-sm);
    font-size: 11px;
    color: var(--er-charcoal-soft);
    font-weight: 500;
}

/* Meta Info */
.modal-meta {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-md);
    padding: var(--space-lg) 0;
    margin-top: var(--space-sm);
}

.meta-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.meta-label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--er-stone);
    font-weight: 600;
}

.meta-value {
    font-size: 13px;
    color: var(--er-charcoal);
    font-weight: 500;
}

/* Modal Actions */
.modal-actions {
    padding-top: var(--space-lg);
    margin-top: auto;
    border-top: 1px solid var(--er-border);
}

.download-label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--er-stone);
    font-weight: 600;
    margin-bottom: var(--space-sm);
    padding-top: var(--space-md);
}

.download-buttons {
    display: flex;
    gap: var(--space-xs);
}

.download-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-sm) var(--space-xs);
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 600;
    text-decoration: none;
    transition: all var(--duration-fast) var(--ease-out);
    cursor: pointer;
    border: 1px solid var(--er-border);
    background: var(--er-light);
    color: var(--er-charcoal);
}

.download-btn:hover {
    background: var(--er-accent);
    border-color: var(--er-accent-dark);
}

.download-btn.primary {
    background: var(--er-primary);
    border-color: var(--er-primary);
    color: #fff;
}

.download-btn.primary:hover {
    background: var(--er-primary-dark);
    border-color: var(--er-primary-dark);
}

/* Copy Toast */
.copy-toast {
    position: fixed;
    bottom: var(--space-xl);
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--er-charcoal);
    color: #fff;
    padding: var(--space-sm) var(--space-lg);
    border-radius: var(--radius-full);
    font-size: 13px;
    font-weight: 500;
    opacity: 0;
    transition: all var(--duration-normal) var(--ease-out);
    z-index: 9999;
    pointer-events: none;
}

.copy-toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* Modal Responsive */
@media (max-width: 1024px) {
    .modal-layout {
        flex-direction: column;
    }

    .modal-image-panel {
        flex: none;
        height: 50vh;
        padding: var(--space-lg);
    }

    .modal-image-wrapper img {
        max-height: calc(50vh - 48px);
    }

    .modal-info-panel {
        width: 100%;
        height: 50vh;
        border-radius: var(--radius-xl) var(--radius-xl) 0 0;
        margin-top: -20px;
    }

    .modal-close {
        top: var(--space-md);
        right: var(--space-md);
        background: rgba(0, 0, 0, 0.5);
        border-color: transparent;
        color: #fff;
    }
}

@media (max-width: 640px) {
    .modal-info-scroll {
        padding: var(--space-lg);
    }

    .modal-title {
        font-size: 1.25rem;
    }

    .modal-meta {
        grid-template-columns: 1fr;
    }
}

/* --------------------------------------------------------------------------
   Login Page
   -------------------------------------------------------------------------- */
.login-shell {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--er-light);
    position: relative;
    overflow: hidden;
}

.login-shell::before {
    content: '';
    position: absolute;
    width: 60vw;
    height: 60vw;
    max-width: 800px;
    max-height: 800px;
    background: radial-gradient(circle, var(--er-accent) 0%, transparent 70%);
    top: -20%;
    right: -20%;
    opacity: 0.3;
}

.login-shell::after {
    content: '';
    position: absolute;
    width: 50vw;
    height: 50vw;
    max-width: 600px;
    max-height: 600px;
    background: radial-gradient(circle, var(--er-primary-light) 0%, transparent 70%);
    bottom: -15%;
    left: -15%;
    opacity: 0.2;
}

.login-card {
    width: min(440px, 92vw);
    background: var(--er-warm-white);
    border: 1px solid var(--er-border);
    border-radius: var(--radius-xl);
    padding: var(--space-3xl) var(--space-2xl);
    box-shadow: var(--shadow-xl);
    position: relative;
    z-index: 1;
}

.login-card .logo-mark {
    width: 64px;
    height: 64px;
    font-size: 24px;
    margin-bottom: var(--space-lg);
}

.login-card h1 {
    font-family: var(--font-display);
    font-size: 2rem;
    margin-bottom: var(--space-xs);
    color: var(--er-charcoal);
}

.login-card .tagline {
    font-size: 13px;
    color: var(--er-stone);
    text-transform: uppercase;
    letter-spacing: 0.15em;
    margin-bottom: var(--space-2xl);
}

.login-card .form-label {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--er-stone);
    margin-bottom: var(--space-sm);
}

.login-card .form-control {
    padding: var(--space-md);
    border: 1px solid var(--er-border);
    border-radius: var(--radius-md);
    background: var(--white);
    font-size: 15px;
    transition: all var(--duration-fast) var(--ease-out);
}

.login-card .form-control:focus {
    outline: none;
    border-color: var(--er-primary);
    box-shadow: 0 0 0 4px rgba(96, 113, 88, 0.12);
}

.login-card .btn-primary {
    width: 100%;
    padding: var(--space-md) var(--space-xl);
    font-size: 15px;
    font-weight: 600;
    margin-top: var(--space-md);
}

.login-card .restriction-note {
    font-size: 12px;
    color: var(--er-stone);
    text-align: center;
    margin-top: var(--space-xl);
    padding-top: var(--space-lg);
    border-top: 1px solid var(--er-border);
}

/* --------------------------------------------------------------------------
   Forms
   -------------------------------------------------------------------------- */
.form-control {
    font-family: var(--font-body);
    font-size: 14px;
    padding: var(--space-sm) var(--space-md);
    border: 1px solid var(--er-border);
    border-radius: var(--radius-md);
    background: var(--white);
    color: var(--er-charcoal);
    transition: all var(--duration-fast) var(--ease-out);
}

.form-control:focus {
    outline: none;
    border-color: var(--er-primary);
    box-shadow: 0 0 0 3px rgba(96, 113, 88, 0.12);
}

.form-control::placeholder {
    color: var(--er-stone-light);
}

.form-select {
    font-family: var(--font-body);
    font-size: 14px;
    padding: var(--space-sm) var(--space-md);
    border: 1px solid var(--er-border);
    border-radius: var(--radius-md);
    background: var(--white);
    color: var(--er-charcoal);
    cursor: pointer;
    transition: all var(--duration-fast) var(--ease-out);
}

.form-select:focus {
    outline: none;
    border-color: var(--er-primary);
    box-shadow: 0 0 0 3px rgba(96, 113, 88, 0.12);
}

.form-label {
    font-size: 13px;
    font-weight: 500;
    color: var(--er-charcoal-soft);
    margin-bottom: var(--space-xs);
}

/* --------------------------------------------------------------------------
   Alerts
   -------------------------------------------------------------------------- */
.alert {
    padding: var(--space-md) var(--space-lg);
    border-radius: var(--radius-md);
    font-size: 14px;
    border: 1px solid;
}

.alert-danger {
    background: rgba(196, 80, 80, 0.1);
    border-color: rgba(196, 80, 80, 0.3);
    color: var(--error);
}

.alert-warning {
    background: rgba(212, 160, 74, 0.1);
    border-color: rgba(212, 160, 74, 0.3);
    color: #9a7530;
}

.alert-success {
    background: rgba(90, 138, 90, 0.1);
    border-color: rgba(90, 138, 90, 0.3);
    color: var(--success);
}

/* --------------------------------------------------------------------------
   Pagination
   -------------------------------------------------------------------------- */
.pagination-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: var(--space-lg);
    padding-top: var(--space-lg);
    border-top: 1px solid var(--er-border);
    font-size: 0.85rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.pagination-info {
    color: var(--er-stone);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.per-page-select {
    padding: 0.25rem 0.5rem;
    border: 1px solid var(--er-border);
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    font-family: inherit;
    color: var(--er-charcoal);
    background: #fff;
    cursor: pointer;
}

.pagination-buttons {
    display: flex;
    gap: 0.25rem;
}

.page-btn {
    padding: 0.3rem 0.6rem;
    border: 1px solid var(--er-border);
    border-radius: var(--radius-sm);
    background: #fff;
    font-size: 0.8rem;
    font-family: inherit;
    cursor: pointer;
    transition: all var(--duration-fast);
    color: var(--er-charcoal);
}

.page-btn:hover {
    border-color: #ccc;
    background: #fafafa;
}

.page-btn.active {
    background: var(--er-charcoal);
    border-color: var(--er-charcoal);
    color: #fff;
}

.page-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* --------------------------------------------------------------------------
   Back Link
   -------------------------------------------------------------------------- */
.back-link {
    display: inline-flex;
    align-items: center;
    gap: var(--space-sm);
    font-size: 14px;
    color: var(--er-stone);
    margin-bottom: var(--space-md);
    padding: var(--space-xs) 0;
    transition: color var(--duration-fast) var(--ease-out);
}

.back-link:hover {
    color: var(--er-primary);
}

.back-link::before {
    content: '←';
    font-size: 16px;
}

/* --------------------------------------------------------------------------
   Section Headers
   -------------------------------------------------------------------------- */
.section-header {
    text-align: center;
    margin-bottom: var(--space-2xl);
}

.section-header h2 {
    font-family: var(--font-display);
    font-size: clamp(1.5rem, 3vw, 2rem);
    margin-bottom: var(--space-sm);
}

.section-header p {
    color: var(--er-stone);
    font-size: 15px;
    max-width: 500px;
    margin: 0 auto;
}

/* --------------------------------------------------------------------------
   Empty States
   -------------------------------------------------------------------------- */
.empty-state {
    text-align: center;
    padding: var(--space-4xl) var(--space-xl);
    color: var(--er-stone);
}

.empty-state-icon {
    font-size: 3rem;
    margin-bottom: var(--space-lg);
    opacity: 0.5;
}

.empty-state h3 {
    font-family: var(--font-display);
    color: var(--er-charcoal-soft);
    margin-bottom: var(--space-sm);
}

/* --------------------------------------------------------------------------
   Mobile Responsiveness
   -------------------------------------------------------------------------- */
@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        width: 280px;
        transform: translateX(-100%);
        transition: transform var(--duration-normal) var(--ease-out);
        box-shadow: var(--shadow-xl);
        z-index: 1000;
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .sidebar-overlay {
        position: fixed;
        inset: 0;
        background: rgba(41, 47, 38, 0.5);
        z-index: 999;
        opacity: 0;
        visibility: hidden;
        transition: all var(--duration-normal) var(--ease-out);
    }

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

    .main {
        margin-left: 0;
    }

    .content {
        padding: var(--space-md);
        padding-top: 50px; /* Space for mobile menu toggle */
    }

    .card-body {
        padding: var(--space-lg);
    }
}

/* Mobile menu toggle */
#menu-toggle {
    font-size: 24px;
    padding: var(--space-xs);
    color: #fff;
    background: none;
    border: none;
    cursor: pointer;
}

/* --------------------------------------------------------------------------
   Utility Classes
   -------------------------------------------------------------------------- */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.fw-semibold { font-weight: 600; }
.fw-bold { font-weight: 700; }

.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: var(--space-xs); }
.mb-2 { margin-bottom: var(--space-sm); }
.mb-3 { margin-bottom: var(--space-md); }
.mb-4 { margin-bottom: var(--space-lg); }

.mt-auto { margin-top: auto; }

.small { font-size: 13px; }

.text-truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* --------------------------------------------------------------------------
   Print Styles
   -------------------------------------------------------------------------- */
@media print {
    .sidebar,
    .topbar,
    .modal-backdrop {
        display: none !important;
    }

    .content {
        padding: 0;
    }
}
