/* Kriti Vastrani - "Digital Atelier" Theme (Inspired by Sumissura/Bombay Shirt Co.) */
@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,400;0,600;0,700;1,400&family=Inter:wght@300;400;500;600&display=swap');

/* ═══════════════════════════════════════════════════
   THEME SYSTEM — 3 Palettes via data-theme on <html>
   Storage: localStorage key 'kv_theme'
   Default: dark (no attribute needed)
═══════════════════════════════════════════════════ */

/* ── Theme 1: Dark Royal (Default) ─────────────── */
:root,
[data-theme="dark"] {
    --bg-main: #0B0B0E;
    --bg-card: rgba(20, 20, 24, 0.75);
    --bg-sidebar: rgba(10, 10, 14, 0.6);
    --bg-overlay: rgba(0, 0, 0, 0.85);
    --bg-input: rgba(0, 0, 0, 0.4);
    --bg-dropdown: #1a1a24;

    --accent: #D4AF37;
    --accent-glow: rgba(212, 175, 55, 0.3);
    --accent-text: #D4AF37;

    --primary: #522D80;
    --primary-light: #7B4FB3;

    --text-main: #F5F5F5;
    --text-dim: #A0A0A5;
    --border: rgba(255, 255, 255, 0.1);

    --gradient-gold: linear-gradient(135deg, #FFD700 0%, #D4AF37 100%);
    --gradient-royal: linear-gradient(135deg, #2E1A47 0%, #522D80 100%);

    --body-gradient-1: rgba(82, 45, 128, 0.15);
    --body-gradient-2: rgba(212, 175, 55, 0.08);

    --modal-bg: #111114;
    --scrollbar-bg: var(--bg-main);
    --autofill-bg: #000000;
    --autofill-text: white;

    --font-body: 'Inter', sans-serif;
    --font-heading: 'Playfair Display', serif;

    --theme-label: "Dark";
}

/* ── Theme 2: Light Ivory ───────────────────────── */
[data-theme="light"] {
    --bg-main: #F4F1EC;
    --bg-card: rgba(255, 255, 255, 0.9);
    --bg-sidebar: rgba(255, 255, 255, 0.85);
    --bg-overlay: rgba(200, 190, 180, 0.6);
    --bg-input: rgba(255, 255, 255, 0.95);
    --bg-dropdown: #ffffff;

    --accent: #9B6B2F;
    --accent-glow: rgba(155, 107, 47, 0.25);
    --accent-text: #7A5020;

    --primary: #4A2070;
    --primary-light: #6B3FA0;

    --text-main: #1A1A2E;
    --text-dim: #6B6B7A;
    --border: rgba(0, 0, 0, 0.12);

    --gradient-gold: linear-gradient(135deg, #C8902A 0%, #9B6B2F 100%);
    --gradient-royal: linear-gradient(135deg, #E8E0F5 0%, #D0C0E8 100%);

    --body-gradient-1: rgba(155, 107, 47, 0.07);
    --body-gradient-2: rgba(74, 32, 112, 0.05);

    --modal-bg: #FFFFFF;
    --scrollbar-bg: #E8E4DC;
    --autofill-bg: #FFFFFF;
    --autofill-text: #1A1A2E;

    --font-body: 'Inter', sans-serif;
    --font-heading: 'Playfair Display', serif;

    --theme-label: "Light";
}

/* ── Theme 3: Saffron Boutique ──────────────────── */
[data-theme="saffron"] {
    --bg-main: #1C1007;
    --bg-card: rgba(38, 22, 8, 0.85);
    --bg-sidebar: rgba(28, 16, 7, 0.75);
    --bg-overlay: rgba(0, 0, 0, 0.8);
    --bg-input: rgba(0, 0, 0, 0.35);
    --bg-dropdown: #261608;

    --accent: #FF9933;
    --accent-glow: rgba(255, 153, 51, 0.35);
    --accent-text: #FFB347;

    --primary: #CC4400;
    --primary-light: #E85D1A;

    --text-main: #FFF3E0;
    --text-dim: #C4956A;
    --border: rgba(255, 153, 51, 0.18);

    --gradient-gold: linear-gradient(135deg, #FFB347 0%, #FF9933 100%);
    --gradient-royal: linear-gradient(135deg, #3D1A00 0%, #CC4400 100%);

    --body-gradient-1: rgba(204, 68, 0, 0.2);
    --body-gradient-2: rgba(255, 153, 51, 0.1);

    --modal-bg: #1E1106;
    --scrollbar-bg: var(--bg-main);
    --autofill-bg: #1C1007;
    --autofill-text: #FFF3E0;

    --font-body: 'Inter', sans-serif;
    --font-heading: 'Playfair Display', serif;

    --theme-label: "Saffron";
}


* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-body, 'Inter', sans-serif);
    background-color: var(--bg-main);
    color: var(--text-main);
    background-image:
        radial-gradient(circle at 10% 20%, var(--body-gradient-1) 0%, transparent 40%),
        radial-gradient(circle at 90% 80%, var(--body-gradient-2) 0%, transparent 40%);
    background-attachment: fixed;
    min-height: 100vh;
    transition: background-color 0.35s ease, color 0.35s ease;
}

h1,
h2,
h3,
h4,
.brand-main {
    font-family: var(--font-heading, 'Playfair Display', serif);
    font-weight: 600;
    letter-spacing: 0.5px;
}

/* --- Layout --- */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
aside {
    width: 280px;
    background: var(--bg-sidebar);
    backdrop-filter: blur(20px);
    border-right: 1px solid var(--border);
    padding: 2rem;
    display: flex;
    flex-direction: column;
    transition: background 0.35s ease;
}

.brand {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 3rem;
}

.brand-main {
    font-size: 1.4rem;
    color: var(--text-main);
}

.brand-sub {
    font-family: 'Playfair Display', serif;
    color: var(--accent);
    font-size: 0.8rem;
    display: block;
}

nav ul {
    list-style: none;
}

nav li {
    padding: 1rem 1.2rem;
    margin-bottom: 0.5rem;
    border-radius: 8px;
    cursor: pointer;
    color: var(--text-dim);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 500;
}

nav li:hover {
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-main);
    transform: translateX(5px);
}

nav li.active {
    background: var(--gradient-royal);
    color: white;
    box-shadow: 0 4px 15px rgba(82, 45, 128, 0.4);
}

/* Main Content */
main {
    flex: 1;
    padding: 3rem;
    overflow-y: auto;
}

/* Header */
.header-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 3rem;
}

.welcome h1 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

/* Buttons */
.btn-primary {
    background: var(--text-main);
    color: var(--bg-main);
    border: none;
    padding: 0.8rem 2rem;
    border-radius: 30px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    font-family: 'Inter', sans-serif;
    letter-spacing: 0.5px;
}

.btn-primary:hover {
    background: var(--accent);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px var(--accent-glow);
}

.btn-secondary {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-main);
    padding: 0.6rem 1.2rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--accent);
}

.btn-icon {
    background: transparent;
    border: none;
    color: var(--text-dim);
    cursor: pointer;
    padding: 0.5rem;
    transition: color 0.2s;
}

.btn-icon:hover {
    color: var(--accent);
}

/* Cards & Stats */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
    margin-bottom: 3rem;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    padding: 1.5rem;
    border-radius: 16px;
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--accent);
    opacity: 0.5;
}

.stat-card h4 {
    color: var(--text-dim);
    font-size: 0.9rem;
    font-family: 'Inter', sans-serif;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 0.5rem;
}

.stat-card .value {
    font-size: 2rem;
    font-family: 'Playfair Display', serif;
    color: var(--text-main);
}

/* Glass Card Container */
.glass-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 2rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

/* Forms & Inputs */
input,
select,
textarea {
    background: var(--bg-input);
    border: 1px solid var(--border);
    color: var(--text-main);
    padding: 1rem;
    border-radius: 8px;
    width: 100%;
    font-family: 'Inter', sans-serif;
    transition: border-color 0.2s, background 0.2s;
}

option {
    background: var(--bg-dropdown);
    color: var(--text-main);
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--accent);
}

label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-dim);
    font-size: 0.9rem;
}

/* Modal Overlay */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    animation: fadeIn 0.3s ease;
}

.modal-content {
    background: var(--modal-bg);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 3rem;
    width: 90%;
    max-width: 600px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    position: relative;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    border-bottom: 1px solid var(--border);
    padding-bottom: 1rem;
}

.btn-close {
    background: transparent;
    border: none;
    color: var(--text-dim);
    font-size: 1.5rem;
    cursor: pointer;
}

.btn-close:hover {
    color: var(--text-main);
}

/* Utilities */
.fade-in {
    animation: fadeIn 0.3s ease-out forwards;
}

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

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

.badge {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    text-transform: uppercase;
    font-weight: 600;
}

.badge.pending {
    background: rgba(212, 175, 55, 0.2);
    color: #FFD700;
}

.badge.delivered {
    background: rgba(46, 204, 113, 0.2);
    color: #2ecc71;
}

.badge.processing {
    background: rgba(52, 152, 219, 0.2);
    color: #3498db;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--scrollbar-bg);
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-dim);
}

/* ── Autofill ──────────────────────────────────── */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
input:-webkit-autofill:active {
    -webkit-box-shadow: 0 0 0 30px var(--autofill-bg) inset !important;
    -webkit-text-fill-color: var(--autofill-text) !important;
    transition: background-color 5000s ease-in-out 0s;
}

/* ── Card utility ──────────────────────────────── */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 2rem;
    transition: background 0.35s ease, border-color 0.35s ease;
}

/* ── Spin animation (loader) ───────────────────── */
@keyframes spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

/* ═══════════════════════════════════════════════════
   THEME SWITCHER WIDGET
   Sits at the bottom of the sidebar
═══════════════════════════════════════════════════ */
.theme-switcher {
    margin-top: auto;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
}

.theme-switcher-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--text-dim);
    margin-bottom: 0.8rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.theme-options {
    display: flex;
    gap: 0.6rem;
    align-items: center;
}

.theme-swatch {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.25s ease;
    position: relative;
    flex-shrink: 0;
}

.theme-swatch:hover {
    transform: scale(1.18);
}

.theme-swatch.active {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.theme-swatch[data-t="dark"] {
    background: linear-gradient(135deg, #0B0B0E 50%, #522D80 100%);
}

.theme-swatch[data-t="light"] {
    background: linear-gradient(135deg, #F4F1EC 50%, #9B6B2F 100%);
}

.theme-swatch[data-t="saffron"] {
    background: linear-gradient(135deg, #1C1007 50%, #FF9933 100%);
}

.theme-swatch[data-t="custom"] {
    background: conic-gradient(from 45deg, #ff6b6b, #ffd700, #00d4aa, #7b4fb3, #ff6b6b);
}

.theme-swatch-name {
    font-size: 0.72rem;
    color: var(--text-dim);
    white-space: nowrap;
    transition: color 0.2s;
}

[data-theme="light"] .theme-swatch-name {
    color: var(--text-dim);
}

/* ── Enforce Read-Only Mode Restrictions ── */
body.read-only-view button.btn-primary,
body.read-only-view button.btn-action,
body.read-only-view button[onclick*='addNew'],
body.read-only-view button[onclick*='openNew'],
body.read-only-view button[onclick*='save'],
body.read-only-view .edit-btn,
body.read-only-view [title='Edit User'],
body.read-only-view [title='Reset Password'] {
    display: none !important;
}

body.read-only-view input,
body.read-only-view select,
body.read-only-view textarea {
    pointer-events: none;
    opacity: 0.8;
}