/**
 * Invoice Processor Design System
 * Professional Theme für Baubranche & Mittelstand
 * Light Mode (Standard) + Dark Mode (Optional)
 */

/* ============================================
   LIGHT MODE (Standard - Professional)
   ============================================ */
:root {
    /* Backgrounds */
    --bg-primary: #f8fafc;           /* Helles Grau */
    --bg-secondary: #f1f5f9;         /* Noch heller */
    --surface: #ffffff;              /* Weiß für Cards */
    --surface-hover: #f8fafc;        /* Hover-Zustand */

    /* Borders & Dividers */
    --border-color: #e2e8f0;         /* Dezent */
    --border-hover: #cbd5e1;         /* Etwas dunkler bei Hover */

    /* Text Colors */
    --text-primary: #0f172a;         /* Dunkler Text */
    --text-secondary: #475569;       /* Grauer Text */
    --text-muted: #64748b;           /* Noch grauer */
    --text-disabled: #94a3b8;        /* Deaktiviert */

    /* Brand Colors (Professionell) */
    --primary: #2563eb;              /* Seriöses Blau */
    --primary-hover: #1d4ed8;        /* Dunkler bei Hover */
    --primary-light: #dbeafe;        /* Hell für Backgrounds */

    --success: #059669;              /* Professionelles Grün */
    --success-hover: #047857;
    --success-light: #d1fae5;

    --warning: #d97706;              /* Orange (Bauhelm-Farbe) */
    --warning-hover: #b45309;
    --warning-dark: #d8860b;         /* Dunkleres Orange für Gradienten */
    --warning-light: #fed7aa;

    --danger: #dc2626;               /* Rot */
    --danger-hover: #b91c1c;
    --danger-light: #fee2e2;

    --info: #0891b2;                 /* Cyan */
    --info-hover: #0e7490;
    --info-light: #cffafe;

    /* Shadows (Professionell, nicht zu stark) */
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);

    /* Border Radius (Konsistent) */
    --radius-sm: 0.375rem;   /* 6px - Inputs, kleine Buttons */
    --radius-md: 0.5rem;     /* 8px - Standard Buttons */
    --radius-lg: 0.75rem;    /* 12px - Cards */
    --radius-xl: 1rem;       /* 16px - Große Cards, Modals */
    --radius-full: 9999px;   /* Pill-Buttons */

    /* Spacing (Konsistent) */
    --space-xs: 0.25rem;     /* 4px */
    --space-sm: 0.5rem;      /* 8px */
    --space-md: 0.75rem;     /* 12px */
    --space-lg: 1rem;        /* 16px */
    --space-xl: 1.5rem;      /* 24px */
    --space-2xl: 2rem;       /* 32px */
    --space-3xl: 3rem;       /* 48px */

    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-base: 200ms ease;
    --transition-slow: 300ms ease;
}

/* ============================================
   DARK MODE (Optional - Modern)
   ============================================ */
.dark-mode {
    /* Backgrounds */
    --bg-primary: #0f172a;           /* Dunkel */
    --bg-secondary: #1e293b;         /* Etwas heller */
    --bg-darker: #1a1a1a;            /* Noch dunkler für spezielle Elemente */
    --surface: #1e293b;              /* Cards */
    --surface-hover: #334155;        /* Hover */

    /* Borders */
    --border-color: #334155;
    --border-hover: #475569;

    /* Text */
    --text-primary: #f8fafc;         /* Hell */
    --text-secondary: #cbd5e1;       /* Grau */
    --text-muted: #94a3b8;           /* Noch grauer */
    --text-disabled: #64748b;

    /* Brand Colors (Angepasst für Dark) */
    --primary: #3b82f6;              /* Helleres Blau */
    --primary-hover: #60a5fa;
    --primary-light: rgba(59, 130, 246, 0.15);

    --success: #10b981;
    --success-hover: #34d399;
    --success-light: rgba(16, 185, 129, 0.15);

    --warning: #f59e0b;
    --warning-hover: #fbbf24;
    --warning-light: rgba(245, 158, 11, 0.15);

    --danger: #ef4444;
    --danger-hover: #f87171;
    --danger-light: rgba(239, 68, 68, 0.15);

    --info: #06b6d4;
    --info-hover: #22d3ee;
    --info-light: rgba(6, 182, 212, 0.15);

    /* Shadows (Stärker in Dark Mode) */
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.3);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.4), 0 2px 4px -2px rgb(0 0 0 / 0.3);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.4), 0 4px 6px -4px rgb(0 0 0 / 0.3);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.5), 0 8px 10px -6px rgb(0 0 0 / 0.4);
}

/* ============================================
   BASE STYLES
   ============================================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
    transition: background-color var(--transition-base), color var(--transition-base);
}

[x-cloak] {
    display: none !important;
}

/* ============================================
   SCROLLBAR STYLING
   ============================================ */
/* Webkit browsers (Chrome, Safari, Edge) */
::-webkit-scrollbar {
    width: 12px;
    height: 12px;
}

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: var(--radius-sm);
    border: 2px solid var(--bg-secondary);
    transition: background-color var(--transition-base);
}

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

/* Firefox scrollbar */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--border-color) var(--bg-secondary);
}

/* ============================================
   TYPOGRAPHY
   ============================================ */
h1, h2, h3, h4, h5, h6 {
    color: var(--text-primary);
    font-weight: 600;
    line-height: 1.2;
}

h1 { font-size: 2rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.25rem; }
h4 { font-size: 1.125rem; }

.hint, .text-muted {
    color: var(--text-muted);
    font-size: 0.875rem;
}

/* ============================================
   BUTTONS
   ============================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: 0.625rem 1.25rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    background: var(--surface);
    color: var(--text-primary);
    font-weight: 500;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
    box-shadow: var(--shadow-sm);
}

.btn:hover {
    background: var(--surface-hover);
    border-color: var(--border-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

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

.btn.primary {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    box-shadow: var(--shadow-md);
}

.btn.primary:hover {
    background: var(--primary-hover);
    border-color: var(--primary-hover);
    box-shadow: var(--shadow-lg);
}

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

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

.btn.danger {
    background: var(--danger);
    color: white;
}

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

.btn.success {
    background: var(--success);
    color: white;
}

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

.btn.ghost {
    background: transparent;
    color: var(--text-secondary);
}

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

/* Pill Toggle Buttons */
.pill-toggle {
    display: flex;
    gap: var(--space-sm);
    flex-wrap: wrap;
}

.pill-toggle button {
    border-radius: var(--radius-full);
    padding: 0.5rem 1rem;
    border: 1px solid var(--border-color);
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.pill-toggle button:hover {
    border-color: var(--border-hover);
    background: var(--surface-hover);
}

.pill-toggle button.active {
    background: var(--primary-light);
    border-color: var(--primary);
    color: var(--primary);
}

/* ============================================
   FORMS
   ============================================ */
.form-group {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.form-group label {
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

input, select, textarea {
    width: 100%;
    padding: 0.625rem 0.75rem;
    background: var(--surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.875rem;
    transition: all var(--transition-fast);
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

input:disabled, select:disabled, textarea:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ============================================
   CARDS & SURFACES
   ============================================ */
.card {
    background: var(--surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: var(--space-xl);
    box-shadow: var(--shadow-sm);
    transition: all var(--transition-base);
}

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

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

.card-highlight {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

/* ============================================
   BADGES & PILLS
   ============================================ */
.pill, .badge {
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
    padding: 0.25rem 0.625rem;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 500;
}

.pill {
    background: var(--primary-light);
    color: var(--primary);
    border: 1px solid var(--primary);
}

.pill.success {
    background: var(--success-light);
    color: var(--success);
    border-color: var(--success);
}

.pill.warning {
    background: var(--warning-light);
    color: var(--warning);
    border-color: var(--warning);
}

.pill.danger {
    background: var(--danger-light);
    color: var(--danger);
    border-color: var(--danger);
}

.pill.muted {
    background: var(--surface-hover);
    color: var(--text-muted);
    border-color: var(--border-color);
}

/* ============================================
   INFO BOXES
   ============================================ */
.info-box, .success-box, .error-box, .warning-box {
    border-radius: var(--radius-md);
    padding: var(--space-lg);
    font-size: 0.875rem;
    border: 1px solid;
}

.info-box {
    background: var(--info-light);
    border-color: var(--info);
    color: var(--info);
}

.success-box {
    background: var(--success-light);
    border-color: var(--success);
    color: var(--success);
}

.error-box {
    background: var(--danger-light);
    border-color: var(--danger);
    color: var(--danger);
}

.warning-box {
    background: var(--warning-light);
    border-color: var(--warning);
    color: var(--warning);
}

/* Dark Mode: Hellere Texte */
.dark-mode .info-box { color: #67e8f9; }
.dark-mode .success-box { color: #6ee7b7; }
.dark-mode .error-box { color: #fecaca; }
.dark-mode .warning-box { color: #fcd34d; }

/* ============================================
   MESSAGES
   ============================================ */
.message {
    border-radius: var(--radius-md);
    padding: var(--space-lg);
    font-size: 0.875rem;
    border: 1px solid;
}

.message.success {
    background: var(--success-light);
    border-color: var(--success);
    color: var(--success);
}

.message.error {
    background: var(--danger-light);
    border-color: var(--danger);
    color: var(--danger);
}

.message.warning {
    background: var(--warning-light);
    border-color: var(--warning);
    color: var(--warning);
}

.message.info {
    background: var(--info-light);
    border-color: var(--info);
    color: var(--info);
}

/* ============================================
   THEME TOGGLE BUTTON
   ============================================ */
.theme-toggle-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: var(--radius-full);
    border: 1px solid var(--border-color);
    background: var(--surface);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
    font-size: 1.25rem;
}

.theme-toggle-btn:hover {
    background: var(--surface-hover);
    border-color: var(--border-hover);
    transform: scale(1.05);
}

.theme-toggle-btn:active {
    transform: scale(0.95);
}

/* Tooltip */
.theme-toggle-btn::before {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 0.5rem);
    right: 0;
    padding: 0.375rem 0.625rem;
    background: var(--text-primary);
    color: var(--surface);
    font-size: 0.75rem;
    border-radius: var(--radius-sm);
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition-fast);
    z-index: 1000;
}

.theme-toggle-btn:hover::before {
    opacity: 1;
}

/* ============================================
   LOGO THEME SWITCHING
   ============================================ */
.logo-light,
.sidebar-logo-icon.logo-light,
.header-logo.logo-light {
    display: block !important;
}

.logo-dark,
.sidebar-logo-icon.logo-dark,
.header-logo.logo-dark {
    display: none !important;
}

html.dark-mode .logo-light,
html.dark-mode .sidebar-logo-icon.logo-light,
html.dark-mode .header-logo.logo-light {
    display: none !important;
}

html.dark-mode .logo-dark,
html.dark-mode .sidebar-logo-icon.logo-dark,
html.dark-mode .header-logo.logo-dark {
    display: block !important;
}

/* ============================================
   UTILITIES
   ============================================ */
.actions-row {
    display: flex;
    gap: var(--space-md);
    justify-content: flex-end;
    align-items: center;
    flex-wrap: wrap;
    margin-top: var(--space-lg);
}

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: var(--space-xl);
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 768px) {
    h1 { font-size: 1.5rem; }
    h2 { font-size: 1.25rem; }
    h3 { font-size: 1.125rem; }

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

    .btn {
        padding: 0.5rem 1rem;
    }
}
