/**
 * PugWorks Design System v1.0
 * Unified styling for all PugWorks SaaS platforms
 */

/* ============================================
   CSS Variables - Light Mode (Default)
   ============================================ */
:root {
    /* Primary Colors - Deep Trust Blue */
    --primary-color: #1E6BD6;
    --primary-hover: #1557a8;
    --primary-light: #dbeafe;

    /* Secondary Colors */
    --secondary-color: #5CA9F2;
    --accent-color: #23C0B7;

    /* Legacy variable mappings for backward compatibility */
    --coral-pop: var(--primary-color);
    --coral-light: var(--primary-light);
    --coral-dark: var(--primary-hover);
    --ocean-blue: var(--primary-color);
    --ocean-light: var(--primary-light);
    --ocean-dark: var(--primary-hover);

    /* Accent Colors */
    --sunny-yellow: #FBBF24;
    --lavender-dream: #14B8A6;
    --mint-fresh: #14B8A6;

    /* Neutral Colors */
    --ink: #1E293B;
    --slate: #475569;
    --cloud: #94A3B8;
    --mist: #F8FAFC;
    --snow: #FFFFFF;

    /* Background Colors */
    --bg-primary: #FFFFFF;
    --bg-secondary: #F8F9FA;
    --bg-tertiary: #F0F2F3;
    --bg-elevated: #FFFFFF;
    --bg-overlay: rgba(45, 52, 54, 0.5);

    /* Text Colors */
    --text-primary: #2D3436;
    --text-secondary: #636E72;
    --text-tertiary: #B2BEC3;
    --text-inverse: #FFFFFF;

    /* Border Colors */
    --border-default: #E8E8E8;
    --border-subtle: #F0F2F3;
    --border-strong: #B2BEC3;

    /* Semantic Colors */
    --success-bg: #F0FDF4;
    --success-text: #15803D;
    --success-border: #22C55E;
    --warning-bg: #FFFBEB;
    --warning-text: #B45309;
    --warning-border: #FBBF24;
    --error-bg: #FEF2F2;
    --error-text: #DC2626;
    --error-border: #F87171;
    --info-bg: #EFF6FF;
    --info-text: #1D4ED8;
    --info-border: #3B82F6;

    /* Shadows */
    --shadow-sm: 0 2px 8px rgba(45, 52, 54, 0.06);
    --shadow-md: 0 4px 20px rgba(45, 52, 54, 0.08);
    --shadow-lg: 0 8px 30px rgba(45, 52, 54, 0.12);
    --shadow-coral: 0 4px 15px rgba(249, 115, 22, 0.3);
    --shadow-ocean: 0 4px 15px rgba(30, 64, 175, 0.25);

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

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

    /* Transitions */
    --ease-out: cubic-bezier(0.0, 0.0, 0.2, 1);
    --ease-in: cubic-bezier(0.4, 0.0, 1, 1);
    --ease-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ============================================
   Dark Mode
   ============================================ */
@media (prefers-color-scheme: dark) {
    :root {
        --bg-primary: #1A1D1E;
        --bg-secondary: #242829;
        --bg-tertiary: #2D3436;
        --bg-elevated: #2D3436;
        --bg-overlay: rgba(0, 0, 0, 0.7);

        --text-primary: #F8F9FA;
        --text-secondary: #B2BEC3;
        --text-tertiary: #636E72;
        --text-inverse: #1A1D1E;

        --border-default: #3D4447;
        --border-subtle: #2D3436;
        --border-strong: #636E72;

        --coral-pop: #FB923C;
        --ocean-blue: #3B82F6;
        --coral-light: #431407;
        --ocean-light: #172554;

        --success-bg: #14532D;
        --success-text: #86EFAC;
        --warning-bg: #451A03;
        --warning-text: #FCD34D;
        --error-bg: #450A0A;
        --error-text: #FCA5A5;
        --info-bg: #1E3A5F;
        --info-text: #93C5FD;

        --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
        --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.4);
        --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.5);
    }
}

/* Manual dark mode toggle - supports both [data-theme] and .dark-mode class */
[data-theme="dark"],
body.dark-mode {
    --bg-primary: #1A1D1E;
    --bg-secondary: #242829;
    --bg-tertiary: #2D3436;
    --bg-elevated: #2D3436;
    --bg-overlay: rgba(0, 0, 0, 0.7);

    --text-primary: #F8F9FA;
    --text-secondary: #B2BEC3;
    --text-tertiary: #636E72;
    --text-inverse: #1A1D1E;

    --border-default: #3D4447;
    --border-subtle: #2D3436;
    --border-strong: #636E72;

    --coral-pop: #FB923C;
    --ocean-blue: #3B82F6;
    --coral-light: #431407;
    --ocean-light: #172554;

    --success-bg: #14532D;
    --success-text: #86EFAC;
    --warning-bg: #451A03;
    --warning-text: #FCD34D;
    --error-bg: #450A0A;
    --error-text: #FCA5A5;
    --info-bg: #1E3A5F;
    --info-text: #93C5FD;

    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.5);
}

/* Manual light mode toggle - overrides system dark preference */
[data-theme="light"] {
    --bg-primary: #FFFFFF;
    --bg-secondary: #F8F9FA;
    --bg-tertiary: #F0F2F3;
    --bg-elevated: #FFFFFF;
    --bg-overlay: rgba(45, 52, 54, 0.5);

    --text-primary: #2D3436;
    --text-secondary: #636E72;
    --text-tertiary: #B2BEC3;
    --text-inverse: #FFFFFF;

    --border-default: #E8E8E8;
    --border-subtle: #F0F2F3;
    --border-strong: #B2BEC3;

    --coral-pop: #F97316;
    --ocean-blue: #1E40AF;
    --coral-light: #FFF7ED;
    --ocean-light: #EFF6FF;

    --success-bg: #F0FDF4;
    --success-text: #15803D;
    --warning-bg: #FFFBEB;
    --warning-text: #B45309;
    --error-bg: #FEF2F2;
    --error-text: #DC2626;
    --info-bg: #EFF6FF;
    --info-text: #1D4ED8;

    --shadow-sm: 0 2px 8px rgba(45, 52, 54, 0.06);
    --shadow-md: 0 4px 20px rgba(45, 52, 54, 0.08);
    --shadow-lg: 0 8px 30px rgba(45, 52, 54, 0.12);
}

/* ============================================
   Base Styles
   ============================================ */
*, *::before, *::after {
    box-sizing: border-box;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    margin-left: 80px; /* Space for vertical brand sidebar */
    font-size: 16px;
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--bg-secondary);
    margin: 0;
    padding: 0;
}

/* ============================================
   Typography
   ============================================ */
h1, h2, h3 {
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 var(--space-md);
    line-height: 1.2;
}

h1 {
    font-size: 48px;
}

h2 {
    font-size: 36px;
    line-height: 1.25;
}

h3 {
    font-size: 24px;
    line-height: 1.3;
}

h4, h5, h6 {
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.4;
}

h4 {
    font-size: 18px;
}

p {
    margin: 0 0 var(--space-md);
    color: var(--text-secondary);
}

.text-muted {
    color: var(--text-secondary) !important;
}

small, .text-small {
    font-size: 14px;
    line-height: 1.5;
}

.caption {
    font-size: 12px;
    font-weight: 500;
    line-height: 1.4;
    color: var(--text-secondary);
}

code, .code {
    font-family: 'JetBrains Mono', monospace;
    font-size: 14px;
    background: var(--bg-tertiary);
    padding: 2px 6px;
    border-radius: var(--radius-sm);
}

/* ============================================
   Navbar
   ============================================ */
.navbar {
    background: linear-gradient(135deg, var(--ocean-blue) 0%, var(--ocean-dark) 100%) !important;
    padding: var(--space-md) var(--space-lg);
    box-shadow: var(--shadow-md);
}

.navbar-brand {
    font-family: 'Inter', sans-serif;
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--snow) !important;
    letter-spacing: -0.5px;
}

.navbar-brand:hover {
    color: var(--snow) !important;
}

.navbar-nav .nav-link {
    font-family: 'Inter', sans-serif;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.9) !important;
    padding: var(--space-sm) var(--space-md) !important;
    border-radius: var(--radius-sm);
    transition: all 0.2s var(--ease-out);
}

.navbar-nav .nav-link:hover,
.navbar-nav .nav-link.active {
    color: var(--snow) !important;
    background: rgba(255, 255, 255, 0.15);
}

/* ============================================
   Buttons
   ============================================ */
.btn {
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    font-size: 16px;
    padding: 14px 28px;
    border-radius: 14px;
    border: none;
    cursor: pointer;
    transition: all 0.2s var(--ease-out);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
}

.btn:focus {
    outline: none;
    box-shadow: 0 0 0 4px rgba(255, 107, 107, 0.2);
}

/* Primary Button - Coral Gradient */
.btn-primary {
    background: linear-gradient(135deg, var(--coral-pop) 0%, #FF8E8E 100%);
    color: var(--snow);
    box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--coral-dark) 0%, var(--coral-pop) 100%);
    box-shadow: var(--shadow-coral);
    transform: translateY(-1px);
    color: var(--snow);
}

.btn-primary:active {
    transform: translateY(0);
    box-shadow: var(--shadow-sm);
}

.btn-primary:disabled {
    background: var(--cloud);
    color: var(--slate);
    box-shadow: none;
    cursor: not-allowed;
    transform: none;
}

/* Secondary Button - Ocean Outline */
.btn-secondary,
.btn-outline-primary {
    background: var(--snow);
    color: var(--ocean-blue);
    border: 2px solid var(--ocean-blue);
}

.btn-secondary:hover,
.btn-outline-primary:hover {
    background: var(--ocean-blue);
    color: var(--snow);
    box-shadow: var(--shadow-ocean);
    transform: translateY(-1px);
}

/* Success Button - Mint */
.btn-success {
    background: linear-gradient(135deg, var(--mint-fresh) 0%, var(--ocean-blue) 100%);
    color: var(--ink);
}

.btn-success:hover {
    background: linear-gradient(135deg, var(--ocean-blue) 0%, var(--ocean-dark) 100%);
    color: var(--snow);
    box-shadow: var(--shadow-ocean);
    transform: translateY(-1px);
}

/* Ghost Button */
.btn-ghost,
.btn-outline-secondary {
    background: transparent;
    color: var(--slate);
    border: none;
}

.btn-ghost:hover,
.btn-outline-secondary:hover {
    background: var(--bg-tertiary);
    color: var(--ink);
}

/* Danger Button */
.btn-danger,
.btn-outline-danger {
    background: var(--snow);
    color: var(--coral-pop);
    border: 2px solid var(--coral-pop);
}

.btn-danger:hover,
.btn-outline-danger:hover {
    background: var(--coral-pop);
    color: var(--snow);
}

/* Button Sizes */
.btn-sm {
    padding: 8px 16px;
    font-size: 14px;
    border-radius: var(--radius-sm);
}

.btn-lg {
    padding: 16px 32px;
    font-size: 18px;
    border-radius: var(--radius-lg);
}

/* ============================================
   Cards
   ============================================ */
.card {
    background: var(--bg-elevated);
    border: none;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-md);
    overflow: hidden;
    transition: all 0.3s var(--ease-out);
}

.card:hover {
    box-shadow: var(--shadow-lg);
}

.card-header {
    background: var(--bg-elevated);
    border-bottom: 1px solid var(--border-default);
    padding: var(--space-lg);
    border-radius: var(--radius-xl) var(--radius-xl) 0 0 !important;
}

.card-header h5 {
    margin: 0;
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.card-header h5 i {
    color: var(--coral-pop);
}

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

/* Success Card */
#result-card .card-header,
.card-header.bg-success {
    background: linear-gradient(135deg, var(--mint-fresh) 0%, var(--ocean-blue) 100%) !important;
    color: var(--ink);
    border-bottom: none;
}

#result-card .card-header h5,
.card-header.bg-success h5 {
    color: var(--ink);
}

/* Error Card */
#error-card .card-header,
.card-header.bg-danger {
    background: linear-gradient(135deg, var(--coral-pop) 0%, var(--coral-dark) 100%) !important;
    color: var(--snow);
    border-bottom: none;
}

/* ============================================
   Form Controls
   ============================================ */
.form-label {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--space-sm);
    font-size: 14px;
}

.form-control,
.form-select {
    font-family: 'Inter', sans-serif;
    font-size: 16px;
    padding: 14px 18px;
    border: 2px solid var(--border-default);
    border-radius: 14px;
    background: var(--bg-elevated);
    color: var(--text-primary);
    transition: all 0.2s var(--ease-out);
}

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

.form-control:hover,
.form-select:hover {
    border-color: var(--border-strong);
}

.form-control:focus,
.form-select:focus {
    border-color: var(--ocean-blue);
    box-shadow: 0 0 0 4px rgba(30, 64, 175, 0.15);
    outline: none;
}

/* Light mode form control overrides */
[data-theme="light"] .form-control,
[data-theme="light"] .form-select {
    background: var(--bg-elevated);
    color: var(--text-primary);
    border-color: var(--border-default);
}

[data-theme="light"] .form-control:focus,
[data-theme="light"] .form-select:focus {
    border-color: var(--ocean-blue);
    box-shadow: 0 0 0 4px rgba(30, 64, 175, 0.15);
}

/* Dark mode form control overrides */
[data-theme="dark"] .form-control,
[data-theme="dark"] .form-select {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border-color: var(--border-default);
}

[data-theme="dark"] .form-control:focus,
[data-theme="dark"] .form-select:focus {
    border-color: var(--ocean-blue);
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.25);
}

.input-group-text {
    background: var(--bg-tertiary);
    border: 2px solid var(--border-default);
    border-radius: 14px;
    color: var(--text-secondary);
    font-weight: 500;
}

/* Light mode input group text */
[data-theme="light"] .input-group-text {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
}

/* Dark mode input group text */
[data-theme="dark"] .input-group-text {
    background: var(--bg-secondary);
    color: var(--text-secondary);
}

/* Range Slider */
.form-range {
    height: 8px;
    appearance: none;
    background: var(--bg-tertiary);
    border-radius: var(--radius-full);
}

.form-range::-webkit-slider-thumb {
    appearance: none;
    width: 20px;
    height: 20px;
    background: var(--coral-pop);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: var(--shadow-coral);
    transition: transform 0.2s var(--ease-bounce);
}

.form-range::-webkit-slider-thumb:hover {
    transform: scale(1.1);
}

.form-range::-moz-range-thumb {
    width: 20px;
    height: 20px;
    background: var(--coral-pop);
    border: none;
    border-radius: 50%;
    cursor: pointer;
}

/* ============================================
   Dropzone
   ============================================ */
.dropzone {
    border: 2px dashed var(--ocean-blue) !important;
    border-radius: var(--radius-xl);
    background: var(--ocean-light) !important;
    padding: var(--space-2xl);
    min-height: 200px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: all 0.3s var(--ease-out);
}

.dropzone:hover {
    background: linear-gradient(135deg, var(--ocean-light) 0%, rgba(78, 205, 196, 0.15) 100%) !important;
    border-color: var(--ocean-dark) !important;
    transform: translateY(-2px);
    box-shadow: var(--shadow-ocean);
}

.dropzone i {
    font-size: 3rem;
    color: var(--ocean-blue);
    margin-bottom: var(--space-md);
}

.dropzone p {
    margin: 0;
    text-align: center;
}

.dropzone .fw-bold {
    color: var(--ink);
    font-size: 18px;
}

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

.alert-success {
    background: var(--success-bg);
    color: var(--success-text);
    border-color: var(--success-border);
}

.alert-danger {
    background: var(--error-bg);
    color: var(--error-text);
    border-color: var(--error-border);
}

.alert-warning {
    background: var(--warning-bg);
    color: var(--warning-text);
    border-color: var(--warning-border);
}

.alert-info {
    background: var(--info-bg);
    color: var(--info-text);
    border-color: var(--info-border);
}

/* ============================================
   Badges/Tags
   ============================================ */
.badge {
    font-family: 'Inter', sans-serif;
    font-size: 12px;
    font-weight: 600;
    padding: 6px 12px;
    border-radius: var(--radius-full);
}

.badge-plan {
    font-size: 12px;
    padding: 6px 12px;
    border-radius: var(--radius-full);
}

.badge-free {
    background: var(--mint-fresh);
    color: var(--ink);
}

.badge-basic {
    background: var(--ocean-light);
    color: var(--ocean-dark);
}

.badge-pro {
    background: var(--coral-light);
    color: var(--coral-dark);
}

.badge-business {
    background: var(--lavender-dream);
    color: #5D4B7A;
}

.bg-success {
    background: var(--mint-fresh) !important;
}

.bg-danger {
    background: var(--coral-pop) !important;
}

/* ============================================
   Statistics Cards
   ============================================ */
.stat-card h3,
h3.mb-0 {
    font-family: 'Inter', sans-serif;
    font-weight: 700;
    color: var(--coral-pop);
    font-size: 2rem;
}

/* ============================================
   Pricing Cards
   ============================================ */
.pricing-card {
    transition: all 0.3s var(--ease-out);
}

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

.pricing-card.featured {
    border: 2px solid var(--coral-pop);
    position: relative;
}

.pricing-card.featured::before {
    content: 'Popular';
    position: absolute;
    top: -12px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--coral-pop);
    color: var(--snow);
    padding: 4px 16px;
    border-radius: var(--radius-full);
    font-size: 12px;
    font-weight: 600;
}

.pricing-card .price {
    font-family: 'Inter', sans-serif;
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--coral-pop);
}

.pricing-card .price small {
    font-family: 'Inter', sans-serif;
    font-size: 1rem;
    font-weight: 400;
    color: var(--text-secondary);
}

/* ============================================
   File List Items
   ============================================ */
.file-list-item {
    display: flex;
    align-items: center;
    padding: var(--space-md);
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-sm);
    transition: all 0.2s var(--ease-out);
}

.file-list-item:hover {
    background: var(--ocean-light);
}

.file-list-item img {
    width: 48px;
    height: 48px;
    object-fit: cover;
    border-radius: var(--radius-sm);
    margin-right: var(--space-md);
}

/* ============================================
   History Table
   ============================================ */
.history-table {
    font-size: 14px;
}

.history-table th {
    font-weight: 600;
    color: var(--coral-pop);
    border-bottom: 2px solid var(--coral-pop);
    padding: var(--space-md);
}

.history-table td {
    padding: var(--space-md);
    border-bottom: 1px solid var(--border-default);
    vertical-align: middle;
}

/* ============================================
   Progress Bar
   ============================================ */
.progress {
    height: 8px;
    border-radius: var(--radius-full);
    background: var(--bg-tertiary);
    overflow: hidden;
}

.progress-bar {
    background: linear-gradient(90deg, var(--coral-pop) 0%, #FF8E8E 100%);
    border-radius: var(--radius-full);
    transition: width 0.3s var(--ease-out);
}

/* ============================================
   Loading Overlay
   ============================================ */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-overlay);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.spinner-border {
    color: var(--coral-pop);
}

/* ============================================
   Toast Notifications
   ============================================ */
.toast-container {
    position: fixed;
    bottom: var(--space-lg);
    right: var(--space-lg);
    z-index: 9999;
}

.toast {
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
}

/* ============================================
   Image Preview
   ============================================ */
.img-preview,
.img-thumbnail {
    max-width: 100%;
    max-height: 300px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    border: 2px solid var(--border-default);
}

/* ============================================
   Draggable Items
   ============================================ */
.draggable-item {
    cursor: grab;
    transition: all 0.2s var(--ease-out);
}

.draggable-item:active {
    cursor: grabbing;
}

.draggable-item.dragging {
    opacity: 0.5;
    transform: scale(1.02);
}

/* ============================================
   Footer
   ============================================ */
footer {
    background: var(--bg-primary);
    border-top: 1px solid var(--border-default);
    padding: var(--space-xl) 0;
    margin-top: var(--space-2xl);
}

footer p {
    color: var(--text-secondary);
    margin: 0;
    font-size: 14px;
}

/* ============================================
   Links
   ============================================ */
a {
    color: var(--ocean-blue);
    text-decoration: none;
    transition: color 0.2s var(--ease-out);
}

a:hover {
    color: var(--ocean-dark);
    text-decoration: underline;
}

/* ============================================
   Utilities
   ============================================ */
.bg-light {
    background: var(--bg-secondary) !important;
}

.rounded {
    border-radius: var(--radius-md) !important;
}

.shadow {
    box-shadow: var(--shadow-md) !important;
}

.shadow-sm {
    box-shadow: var(--shadow-sm) !important;
}

.shadow-lg {
    box-shadow: var(--shadow-lg) !important;
}

/* ============================================
   Animations
   ============================================ */
@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.animate-float {
    animation: float 3s ease-in-out infinite;
}

.animate-pulse {
    animation: pulse 2s ease-in-out infinite;
}

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

/* ============================================
   Responsive Adjustments
   ============================================ */
@media (max-width: 768px) {
    :root {
        --space-lg: 16px;
        --space-xl: 24px;
    }

    h1 { font-size: 32px; }
    h2 { font-size: 28px; }
    h3 { font-size: 20px; }

    .container {
        padding-left: var(--space-md);
        padding-right: var(--space-md);
    }

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

    .dropzone {
        min-height: 150px;
        padding: var(--space-xl) !important;
    }

    .btn {
        padding: 12px 20px;
    }

    .btn-lg {
        padding: 14px 24px;
    }
}

/* ============================================
   Vertical Brand Sidebar
   ============================================ */
.vertical-brand-sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: 80px;
    background: linear-gradient(180deg, var(--primary-color) 0%, var(--primary-hover) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.vertical-brand-sidebar .brand-text {
    writing-mode: vertical-rl;
    text-orientation: mixed;
    transform: rotate(180deg);
    font-family: 'Inter', sans-serif;
    font-weight: 700;
    font-size: 1.25rem;
    letter-spacing: 4px;
    color: white;
    text-transform: uppercase;
    background: none;
    -webkit-background-clip: unset;
    -webkit-text-fill-color: white;
    background-clip: unset;
}

/* Hide sidebar on mobile */
@media (max-width: 768px) {
    .vertical-brand-sidebar {
        display: none;
    }

    body {
        margin-left: 0 !important;
    }
}

/* ============================================
   Login Page
   ============================================ */
body.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, var(--primary-color, #1E6BD6) 0%, var(--primary-hover, #1557a8) 100%);
    padding: 20px;
    margin-left: 0; /* No sidebar on login page */
}

/* Dark mode login background */
[data-theme="dark"] body.login-page,
body.login-page.dark-mode {
    background: linear-gradient(135deg, #1E293B 0%, #0F172A 100%);
}

.login-container {
    background: var(--bg-elevated, white);
    padding: 48px;
    border-radius: var(--radius-xl, 20px);
    box-shadow: var(--shadow-lg, 0 8px 30px rgba(0,0,0,0.12));
    width: 100%;
    max-width: 420px;
}

.login-header {
    text-align: center;
    margin-bottom: 32px;
}

.login-header h1 {
    font-family: 'Inter', sans-serif;
    font-size: 32px;
    font-weight: 600;
    color: var(--text-primary, #1E293B);
    margin-bottom: 8px;
}

.login-header .tagline {
    font-weight: 500;
    color: var(--coral-pop, #F97316);
    margin-bottom: 4px;
    font-size: 14px;
}

.login-header p {
    color: var(--text-secondary, #475569);
    font-size: 14px;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.login-form .form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.login-form .form-group label {
    font-weight: 600;
    color: var(--text-primary, #1E293B);
    font-size: 14px;
}

.login-form .form-group input {
    padding: 14px 16px;
    border: 2px solid var(--border-default, #E8E8E8);
    border-radius: var(--radius-md, 12px);
    font-size: 15px;
    transition: border-color 0.2s, box-shadow 0.2s;
    background: var(--bg-primary, white);
    color: var(--text-primary, #1E293B);
}

.login-form .form-group input::placeholder {
    color: var(--text-tertiary, #94A3B8);
}

.login-form .form-group input:focus {
    outline: none;
    border-color: var(--ocean-blue, #1E40AF);
    box-shadow: 0 0 0 4px rgba(30, 64, 175, 0.15);
}

.login-btn {
    background: linear-gradient(135deg, var(--coral-pop, #F97316) 0%, #FB923C 100%);
    color: white;
    padding: 14px;
    border: none;
    border-radius: var(--radius-md, 12px);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    margin-top: 8px;
}

.login-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-coral, 0 4px 15px rgba(249, 115, 22, 0.3));
}

.login-btn:disabled {
    background: var(--cloud, #94A3B8);
    color: var(--slate, #475569);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.error-message {
    background: var(--error-bg, #FEF2F2);
    color: var(--error-text, #DC2626);
    padding: 12px;
    border-radius: var(--radius-sm, 8px);
    font-size: 14px;
    display: none;
}

.error-message.show {
    display: block;
}

.mfa-container {
    display: none;
    margin-top: 20px;
}

.mfa-container.show {
    display: block;
}

.mfa-info {
    background: var(--info-bg, #EFF6FF);
    color: var(--info-text, #1D4ED8);
    padding: 12px;
    border-radius: var(--radius-sm, 8px);
    font-size: 14px;
    margin-bottom: 16px;
}

.forgot-password {
    text-align: center;
    margin-top: 16px;
}

.forgot-password a {
    color: var(--ocean-blue, #1E40AF);
    text-decoration: none;
    font-size: 14px;
}

.forgot-password a:hover {
    text-decoration: underline;
}

.register-link {
    text-align: center;
    margin-top: 12px;
}

.register-link a {
    color: var(--ocean-blue, #1E40AF);
    text-decoration: none;
    font-size: 14px;
}

.register-link a:hover {
    text-decoration: underline;
}

.loading-spinner {
    display: none;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s linear infinite;
    margin: 0 auto;
}

.loading-spinner.show {
    display: block;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.footer-text {
    text-align: center;
    margin-top: 24px;
    color: var(--text-secondary, #475569);
    font-size: 12px;
}

/* Dark mode login page overrides */
[data-theme="dark"] .login-container,
.dark-mode .login-container {
    background: var(--bg-elevated, #2D3436);
}

[data-theme="dark"] .login-header h1,
.dark-mode .login-header h1 {
    color: var(--text-primary, #F8F9FA);
}

[data-theme="dark"] .login-form .form-group label,
.dark-mode .login-form .form-group label {
    color: var(--text-primary, #F8F9FA);
}

[data-theme="dark"] .login-form .form-group input,
.dark-mode .login-form .form-group input {
    background: var(--bg-primary, #1A1D1E);
    color: var(--text-primary, #F8F9FA);
    border-color: var(--border-default, #3D4447);
}

[data-theme="dark"] .login-form .form-group input::placeholder,
.dark-mode .login-form .form-group input::placeholder {
    color: var(--text-tertiary, #636E72);
}

[data-theme="dark"] .login-form .form-group input:focus,
.dark-mode .login-form .form-group input:focus {
    border-color: var(--ocean-blue, #3B82F6);
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.2);
}

[data-theme="dark"] .forgot-password a,
[data-theme="dark"] .register-link a,
.dark-mode .forgot-password a,
.dark-mode .register-link a {
    color: var(--ocean-blue, #3B82F6);
}

.login-card {
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
}

.brand-text {
    font-family: 'Inter', sans-serif;
    font-size: 2.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--coral-pop) 0%, var(--ocean-blue) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.dropzone-icon {
    font-size: 3rem;
    color: var(--ocean-blue);
}

/* ============================================
   Register Page
   ============================================ */
.register-container {
    background: var(--bg-elevated, white);
    padding: 48px;
    border-radius: var(--radius-xl, 20px);
    box-shadow: var(--shadow-lg, 0 8px 30px rgba(0,0,0,0.12));
    width: 100%;
    max-width: 420px;
}

.register-header {
    text-align: center;
    margin-bottom: 32px;
}

.register-header h1 {
    font-family: 'Inter', sans-serif;
    font-size: 32px;
    font-weight: 600;
    color: var(--text-primary, #1E293B);
    margin-bottom: 8px;
}

.register-header .tagline {
    font-weight: 500;
    color: var(--coral-pop, #F97316);
    margin-bottom: 4px;
    font-size: 14px;
}

.register-header p {
    color: var(--text-secondary, #475569);
    font-size: 14px;
}

.register-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.register-form .form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.register-form .form-group label {
    font-weight: 600;
    color: var(--text-primary, #1E293B);
    font-size: 14px;
}

.register-form .form-group input {
    padding: 14px 16px;
    border: 2px solid var(--border-default, #E8E8E8);
    border-radius: var(--radius-md, 12px);
    font-size: 15px;
    transition: border-color 0.2s, box-shadow 0.2s;
    background: var(--bg-primary, white);
    color: var(--text-primary, #1E293B);
}

.register-form .form-group input::placeholder {
    color: var(--text-tertiary, #94A3B8);
}

.register-form .form-group input:focus {
    outline: none;
    border-color: var(--ocean-blue, #1E40AF);
    box-shadow: 0 0 0 4px rgba(30, 64, 175, 0.15);
}

.password-requirements {
    font-size: 12px;
    color: var(--text-secondary, #475569);
    margin-top: 4px;
}

.register-btn {
    background: linear-gradient(135deg, var(--coral-pop, #F97316) 0%, #FB923C 100%);
    color: white;
    padding: 14px;
    border: none;
    border-radius: var(--radius-md, 12px);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    margin-top: 8px;
}

.register-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-coral, 0 4px 15px rgba(249, 115, 22, 0.3));
}

.register-btn:disabled {
    background: var(--cloud, #94A3B8);
    color: var(--slate, #475569);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.success-message {
    background: var(--success-bg, #F0FDF4);
    color: var(--success-text, #15803D);
    padding: 12px;
    border-radius: var(--radius-sm, 8px);
    font-size: 14px;
    display: none;
}

.success-message.show {
    display: block;
}

.verification-container {
    display: none;
    margin-top: 20px;
}

.verification-container.show {
    display: block;
}

.verification-info {
    background: var(--info-bg, #EFF6FF);
    color: var(--info-text, #1D4ED8);
    padding: 12px;
    border-radius: var(--radius-sm, 8px);
    font-size: 14px;
    margin-bottom: 16px;
}

.login-link {
    text-align: center;
    margin-top: 16px;
}

.login-link a {
    color: var(--ocean-blue, #1E40AF);
    text-decoration: none;
    font-size: 14px;
}

.login-link a:hover {
    text-decoration: underline;
}

/* Dark mode register page overrides */
[data-theme="dark"] .register-container,
.dark-mode .register-container {
    background: var(--bg-elevated, #2D3436);
}

[data-theme="dark"] .register-header h1,
.dark-mode .register-header h1 {
    color: var(--text-primary, #F8F9FA);
}

[data-theme="dark"] .register-form .form-group label,
.dark-mode .register-form .form-group label {
    color: var(--text-primary, #F8F9FA);
}

[data-theme="dark"] .register-form .form-group input,
.dark-mode .register-form .form-group input {
    background: var(--bg-primary, #1A1D1E);
    color: var(--text-primary, #F8F9FA);
    border-color: var(--border-default, #3D4447);
}

[data-theme="dark"] .register-form .form-group input::placeholder,
.dark-mode .register-form .form-group input::placeholder {
    color: var(--text-tertiary, #636E72);
}

[data-theme="dark"] .register-form .form-group input:focus,
.dark-mode .register-form .form-group input:focus {
    border-color: var(--ocean-blue, #3B82F6);
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.2);
}

[data-theme="dark"] .login-link a,
.dark-mode .login-link a {
    color: var(--ocean-blue, #3B82F6);
}
