/* Radhe Imitation - Premium Jewellery Design System & Motion Tokens */
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700&display=swap');

:root {
    /* Spacing System */
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 20px;
    --space-6: 24px;
    --space-8: 32px;
    --space-10: 40px;
    --space-12: 48px;
    --space-16: 64px;

    /* Border Radius System */
    --radius-sm: 8px;
    --radius-input: 10px;
    --radius-card: 14px;
    --radius-container: 18px;
    --radius-modal: 20px;
    --radius-pill: 9999px;

    /* Motion Tokens */
    --motion-instant: 120ms cubic-bezier(0.16, 1, 0.3, 1);
    --motion-micro: 180ms cubic-bezier(0.16, 1, 0.3, 1);
    --motion-component: 240ms cubic-bezier(0.16, 1, 0.3, 1);
    --motion-modal: 260ms cubic-bezier(0.16, 1, 0.3, 1);

    /* Typography */
    --font-primary: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    
    /* Layout */
    --sidebar-width: 240px;
    --topbar-height: 64px;
}

/* Light Theme (Default) */
[data-theme="light"], :root {
    --bg-app: #FAF9F7;
    --bg-surface: #FFFFFF;
    --bg-surface-elevated: #FFFFFF;
    --bg-surface-subtle: #F4F1EA;
    --bg-overlay: rgba(23, 23, 23, 0.45);

    --text-primary: #171717;
    --text-secondary: #6B6B6B;
    --text-muted: #8A877F;
    --text-inverse: #FFFFFF;

    --border-subtle: #E8E4DD;
    --border-medium: #DCD7CE;
    --divider: #ECE9E3;

    --primary-bronze: #8B6B3F;
    --primary-hover: #6B4F2F;
    --primary-light: #B89563;
    --champagne-accent: #C9A96E;
    --accent-subtle: rgba(139, 107, 63, 0.08);

    --color-success: #2E7D5B;
    --color-success-bg: rgba(46, 125, 91, 0.09);
    --color-warning: #B7791F;
    --color-warning-bg: rgba(183, 121, 31, 0.09);
    --color-error: #C94B4B;
    --color-error-bg: rgba(201, 75, 75, 0.09);

    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.04), 0 1px 2px rgba(0, 0, 0, 0.02);
    --shadow-card: 0 4px 12px rgba(0, 0, 0, 0.03), 0 1px 3px rgba(0, 0, 0, 0.02);
    --shadow-elevated: 0 12px 32px rgba(0, 0, 0, 0.07), 0 2px 6px rgba(0, 0, 0, 0.04);
}

/* Dark Theme (Warm Charcoal & Bronze Showroom) */
[data-theme="dark"] {
    --bg-app: #11110F;
    --bg-surface: #1A1916;
    --bg-surface-elevated: #24221E;
    --bg-surface-subtle: #1E1D19;
    --bg-overlay: rgba(0, 0, 0, 0.7);

    --text-primary: #F5F2EC;
    --text-secondary: #B8B3AA;
    --text-muted: #858078;
    --text-inverse: #11110F;

    --border-subtle: #34312B;
    --border-medium: #423E36;
    --divider: #2C2924;

    --primary-bronze: #B89563;
    --primary-hover: #C9A96E;
    --primary-light: #D4AF37;
    --champagne-accent: #C9A96E;
    --accent-subtle: rgba(184, 149, 99, 0.12);

    --color-success: #4D9B78;
    --color-success-bg: rgba(77, 155, 120, 0.14);
    --color-warning: #C99A45;
    --color-warning-bg: rgba(201, 154, 69, 0.14);
    --color-error: #D66A6A;
    --color-error-bg: rgba(214, 106, 106, 0.14);

    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
    --shadow-card: 0 4px 14px rgba(0, 0, 0, 0.35);
    --shadow-elevated: 0 16px 40px rgba(0, 0, 0, 0.5);
}

/* Base Resets */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-primary);
    background-color: var(--bg-app);
    color: var(--text-primary);
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    min-height: 100vh;
    display: flex;
    overflow-x: hidden;
    transition: background-color var(--motion-component), color var(--motion-component);
}

/* Reduced Motion Override */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* SVG Icon Base Helper */
.icon-svg {
    display: inline-block;
    width: 20px;
    height: 20px;
    stroke-width: 1.75;
    stroke: currentColor;
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
    flex-shrink: 0;
    vertical-align: middle;
}

.icon-sm { width: 16px; height: 16px; }
.icon-md { width: 18px; height: 18px; }
.icon-lg { width: 24px; height: 24px; }
.icon-xl { width: 32px; height: 32px; }

/* App Shell Layout */
.app-shell {
    display: flex;
    width: 100%;
    min-height: 100vh;
}

/* Sidebar */
.app-sidebar {
    width: var(--sidebar-width);
    background-color: var(--bg-surface);
    border-right: 1px solid var(--border-subtle);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 100;
    transition: transform var(--motion-component), background-color var(--motion-component);
}

.sidebar-brand {
    height: var(--topbar-height);
    padding: 0 var(--space-5);
    display: flex;
    align-items: center;
    gap: var(--space-3);
    border-bottom: 1px solid var(--divider);
    text-decoration: none;
    color: var(--text-primary);
}

.brand-symbol {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    background-color: var(--bg-surface-subtle);
    border: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary-bronze);
}

.brand-title {
    font-size: 15px;
    font-weight: 700;
    letter-spacing: -0.2px;
    color: var(--text-primary);
}

.brand-sub {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    display: block;
}

.sidebar-nav {
    flex: 1;
    padding: var(--space-4) var(--space-3);
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
    overflow-y: auto;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: 9px var(--space-3);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    font-size: 13.5px;
    transition: background-color var(--motion-instant), color var(--motion-instant);
}

.nav-item:hover {
    color: var(--text-primary);
    background-color: var(--bg-surface-subtle);
}

.nav-item.active {
    color: var(--primary-bronze);
    background-color: var(--accent-subtle);
    font-weight: 600;
}

.sidebar-footer {
    padding: var(--space-4) var(--space-4);
    border-top: 1px solid var(--divider);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.user-snippet {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    overflow: hidden;
}

.user-avatar-sm {
    width: 30px;
    height: 30px;
    border-radius: var(--radius-pill);
    background-color: var(--bg-surface-subtle);
    border: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary-bronze);
    font-size: 11px;
    font-weight: 700;
}

.user-meta-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-meta-role {
    font-size: 11px;
    color: var(--text-muted);
}

/* Main Area */
.app-main {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    min-width: 0;
}

/* Top Bar */
.app-topbar {
    height: var(--topbar-height);
    background-color: var(--bg-surface);
    border-bottom: 1px solid var(--border-subtle);
    padding: 0 var(--space-8);
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 90;
    transition: background-color var(--motion-component);
}

.topbar-title-wrap {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.topbar-page-title {
    font-size: 16px;
    font-weight: 600;
    letter-spacing: -0.2px;
    color: var(--text-primary);
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

/* Content Container */
.app-content {
    flex: 1;
    padding: var(--space-8);
    max-width: 1440px;
    width: 100%;
    margin: 0 auto;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: 8px 16px;
    font-family: var(--font-primary);
    font-size: 13.5px;
    font-weight: 600;
    border-radius: var(--radius-sm);
    cursor: pointer;
    border: 1px solid transparent;
    text-decoration: none;
    line-height: 1.2;
    transition: all var(--motion-instant);
    outline: none;
}

.btn:active {
    transform: scale(0.98);
}

.btn:focus-visible {
    box-shadow: 0 0 0 2px var(--bg-app), 0 0 0 4px var(--champagne-accent);
}

.btn-primary {
    background-color: var(--primary-bronze);
    color: #FFFFFF;
}

.btn-primary:hover {
    background-color: var(--primary-hover);
}

.btn-secondary {
    background-color: var(--bg-surface);
    border-color: var(--border-subtle);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background-color: var(--bg-surface-subtle);
    border-color: var(--border-medium);
}

.btn-danger {
    background-color: var(--color-error-bg);
    border-color: transparent;
    color: var(--color-error);
}

.btn-danger:hover {
    background-color: var(--color-error);
    color: #FFFFFF;
}

.btn-icon {
    width: 34px;
    height: 34px;
    padding: 0;
    border-radius: var(--radius-sm);
    background-color: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    color: var(--text-secondary);
}

.btn-icon:hover {
    color: var(--text-primary);
    background-color: var(--bg-surface-subtle);
}

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

/* Form Inputs */
.form-group {
    margin-bottom: var(--space-4);
}

.form-label {
    display: block;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: var(--space-2);
}

.form-control {
    width: 100%;
    background-color: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-input);
    padding: 9px 13px;
    font-family: var(--font-primary);
    font-size: 13.5px;
    color: var(--text-primary);
    outline: none;
    transition: border-color var(--motion-instant), box-shadow var(--motion-instant);
}

.form-control:focus {
    border-color: var(--primary-bronze);
    box-shadow: 0 0 0 3px var(--accent-subtle);
}

.form-control::placeholder {
    color: var(--text-muted);
}

/* Toolbar & Search */
.toolbar-panel {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-card);
    padding: var(--space-4);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-4);
    flex-wrap: wrap;
    margin-bottom: var(--space-6);
    box-shadow: var(--shadow-sm);
}

.search-field-wrap {
    position: relative;
    flex: 1;
    min-width: 260px;
}

.search-field-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
}

.search-field-input {
    width: 100%;
    background-color: var(--bg-surface-subtle);
    border: 1px solid transparent;
    border-radius: var(--radius-input);
    padding: 8px 12px 8px 36px;
    font-family: var(--font-primary);
    font-size: 13px;
    color: var(--text-primary);
    outline: none;
    transition: all var(--motion-instant);
}

.search-field-input:focus {
    background-color: var(--bg-surface);
    border-color: var(--primary-bronze);
    box-shadow: 0 0 0 3px var(--accent-subtle);
}

/* Category Grid */
.category-deck {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: var(--space-5);
    margin-top: var(--space-4);
}

.category-tile {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-card);
    padding: var(--space-5);
    text-decoration: none;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: var(--shadow-sm);
    transition: transform var(--motion-micro), border-color var(--motion-micro), box-shadow var(--motion-micro);
}

.category-tile:hover {
    transform: translateY(-2px);
    border-color: var(--champagne-accent);
    box-shadow: var(--shadow-card);
}

.category-tile-info h3 {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.category-tile-count {
    font-size: 12.5px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 6px;
}

.category-tile-arrow {
    width: 28px;
    height: 28px;
    border-radius: var(--radius-pill);
    background-color: var(--bg-surface-subtle);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    transition: background-color var(--motion-instant), color var(--motion-instant), transform var(--motion-instant);
}

.category-tile:hover .category-tile-arrow {
    background-color: var(--primary-bronze);
    color: #FFFFFF;
    transform: translateX(2px);
}

/* Image Grid */
.jewellery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
    gap: var(--space-4);
}

.jewellery-card {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-card);
    overflow: hidden;
    position: relative;
    display: flex;
    flex-direction: column;
    transition: transform var(--motion-micro), border-color var(--motion-micro), box-shadow var(--motion-micro);
    animation: cardEntrance var(--motion-component) ease-out backwards;
}

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

.jewellery-card:hover {
    transform: translateY(-2px);
    border-color: var(--border-medium);
    box-shadow: var(--shadow-card);
}

.jewellery-card.is-selected {
    border-color: var(--champagne-accent);
    box-shadow: 0 0 0 2px var(--champagne-accent);
}

.jewellery-media-wrap {
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 1;
    background-color: var(--bg-surface-subtle);
    overflow: hidden;
    cursor: zoom-in;
}

.jewellery-media-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform var(--motion-micro);
}

.jewellery-card:hover .jewellery-media-img {
    transform: scale(1.02);
}

.selection-toggle-overlay {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 10;
}

.custom-checkbox {
    width: 22px;
    height: 22px;
    border-radius: 6px;
    border: 1.5px solid rgba(255, 255, 255, 0.85);
    background-color: rgba(17, 17, 15, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--motion-instant);
}

.jewellery-card.is-selected .custom-checkbox {
    background-color: var(--primary-bronze);
    border-color: var(--primary-bronze);
    color: #FFFFFF;
}

.card-actions-overlay {
    position: absolute;
    top: 10px;
    right: 10px;
    display: flex;
    gap: 6px;
    opacity: 0;
    transition: opacity var(--motion-micro);
    z-index: 10;
}

.jewellery-card:hover .card-actions-overlay {
    opacity: 1;
}

.action-overlay-btn {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    background-color: rgba(17, 17, 15, 0.75);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #FFFFFF;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color var(--motion-instant);
}

.action-overlay-btn:hover {
    background-color: var(--color-error);
    border-color: transparent;
}

.jewellery-card-meta {
    padding: 10px 12px;
    border-top: 1px solid var(--divider);
}

.jewellery-card-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 2px;
}

.jewellery-card-sub {
    font-size: 11.5px;
    color: var(--text-muted);
    display: flex;
    justify-content: space-between;
}

/* Floating Batch Action Bar */
.floating-batch-bar {
    position: fixed;
    bottom: var(--space-6);
    left: calc(var(--sidebar-width) + (100vw - var(--sidebar-width)) / 2);
    transform: translateX(-50%) translateY(100px);
    background-color: var(--bg-surface);
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-pill);
    padding: 8px 18px;
    display: flex;
    align-items: center;
    gap: var(--space-4);
    box-shadow: var(--shadow-elevated);
    z-index: 500;
    opacity: 0;
    pointer-events: none;
    transition: transform var(--motion-component), opacity var(--motion-component);
}

.floating-batch-bar.is-visible {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
    pointer-events: auto;
}

.batch-selection-pill {
    font-size: 13px;
    font-weight: 600;
    color: var(--primary-bronze);
}

/* Upload Dropzone */
.dropzone-area {
    border: 1.5px dashed var(--border-medium);
    background-color: var(--bg-surface-subtle);
    border-radius: var(--radius-container);
    padding: var(--space-8) var(--space-5);
    text-align: center;
    cursor: pointer;
    position: relative;
    transition: all var(--motion-micro);
}

.dropzone-area:hover, .dropzone-area.is-dragover {
    border-color: var(--primary-bronze);
    background-color: var(--accent-subtle);
}

.dropzone-input-hidden {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}

/* Modal Dialogs */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background-color: var(--bg-overlay);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--motion-modal);
    padding: var(--space-4);
}

.modal-backdrop.is-open {
    opacity: 1;
    pointer-events: auto;
}

.modal-surface {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-modal);
    width: 100%;
    max-width: 520px;
    padding: var(--space-6);
    box-shadow: var(--shadow-elevated);
    transform: translateY(8px) scale(0.98);
    transition: transform var(--motion-modal);
}

.modal-backdrop.is-open .modal-surface {
    transform: translateY(0) scale(1);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-5);
}

.modal-title {
    font-size: 16px;
    font-weight: 700;
    letter-spacing: -0.2px;
    color: var(--text-primary);
}

/* Toast System */
.toast-shelf {
    position: fixed;
    top: var(--space-5);
    right: var(--space-5);
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    z-index: 2000;
    pointer-events: none;
}

.toast-bubble {
    background-color: var(--bg-surface-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    padding: 10px 16px;
    display: flex;
    align-items: center;
    gap: var(--space-3);
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
    box-shadow: var(--shadow-elevated);
    pointer-events: auto;
    animation: toastEnter var(--motion-component) ease-out;
}

.toast-bubble.toast-success { border-left: 3px solid var(--color-success); }
.toast-bubble.toast-error { border-left: 3px solid var(--color-error); }
.toast-bubble.toast-info { border-left: 3px solid var(--primary-bronze); }

@keyframes toastEnter {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Skeleton Loading Shimmer */
.skeleton-shimmer {
    background: linear-gradient(90deg, var(--bg-surface-subtle) 0%, var(--divider) 50%, var(--bg-surface-subtle) 100%);
    background-size: 200% 100%;
    animation: shimmer 1.8s infinite linear;
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Empty State */
.empty-view {
    text-align: center;
    padding: var(--space-16) var(--space-5);
    color: var(--text-secondary);
}

.empty-view-icon {
    width: 48px;
    height: 48px;
    margin: 0 auto var(--space-4);
    color: var(--text-muted);
}

.empty-view-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.empty-view-desc {
    font-size: 13px;
    color: var(--text-muted);
    max-width: 360px;
    margin: 0 auto var(--space-5);
}

/* Responsive Breakpoints */
@media (max-width: 1024px) {
    :root {
        --sidebar-width: 72px;
    }
    .sidebar-brand .brand-text,
    .nav-item span,
    .user-meta-name,
    .user-meta-role {
        display: none;
    }
    .nav-item {
        justify-content: center;
        padding: 12px 0;
    }
}

@media (max-width: 768px) {
    .app-sidebar {
        transform: translateX(-100%);
    }
    .app-sidebar.is-open {
        transform: translateX(0);
    }
    .app-main {
        margin-left: 0;
    }
    .app-topbar {
        padding: 0 var(--space-4);
    }
    .app-content {
        padding: var(--space-4);
    }
    .jewellery-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--space-3);
    }
    .floating-batch-bar {
        left: 50%;
        bottom: var(--space-4);
        width: calc(100% - 32px);
        justify-content: space-between;
    }
}
