/* ========================================
   Wicked Reports Design System
   Version: 1.0
   Last Updated: 2025-10-25
   ======================================== */

/* ========================================
   1. CSS Custom Properties (Variables)
   ======================================== */
:root {
    /* Primary Colors */
    --navy-primary: #425b76;
    --navy-dark: #374c5f;
    --navy-deeper: #15295a;
    --text-primary: #1a1a1a;
    --text-secondary: #666666;

    /* Accent Colors */
    --orange-primary: #ff9902;
    --orange-coral: #ff7a59;
    --green-success: #059669;
    --blue-info: #2563eb;
    --purple-premium: #6d28d9;

    /* Background & Surface Colors */
    --bg-primary: #ffffff;
    --bg-secondary: #f4f6f8;
    --bg-tertiary: #e5e7eb;
    --surface-elevated: #ffffff;

    /* State Colors */
    --success: #059669;
    --warning: #f59e0b;
    --error: #dc2626;
    --info: #2563eb;

    /* Feature Highlight Tints (10% opacity backgrounds) */
    --tint-green: rgba(5, 150, 105, 0.1);
    --tint-blue: rgba(37, 99, 235, 0.1);
    --tint-purple: rgba(109, 40, 217, 0.1);
    --tint-orange: rgba(249, 115, 22, 0.1);

    /* Font Families */
    --font-heading: 'Inter Tight', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-body: 'Lexend Deca', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-ui: 'Lexend Deca', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

    /* Font Scale */
    --text-xs: 12px;
    --text-sm: 14px;
    --text-base: 16px;
    --text-lg: 18px;
    --text-xl: 20px;
    --text-2xl: 24px;
    --text-3xl: 32px;
    --text-4xl: 40px;
    --text-5xl: 56px;

    /* Font Weights */
    --weight-normal: 400;
    --weight-medium: 500;
    --weight-semibold: 600;
    --weight-bold: 700;
    --weight-black: 900;

    /* Line Heights */
    --leading-tight: 1.1;
    --leading-snug: 1.375;
    --leading-normal: 1.5;
    --leading-relaxed: 1.625;

    /* Spacing Scale */
    --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;
    --space-20: 80px;

    /* Shadow System */
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.10);
    --shadow-xl: 0 20px 60px rgba(0, 0, 0, 0.12);
    --shadow-orange: 0 4px 12px rgba(255, 153, 2, 0.3);
    --shadow-blue: 0 4px 12px rgba(37, 99, 235, 0.3);

    /* Container Widths */
    --container-sm: 640px;
    --container-md: 768px;
    --container-lg: 1024px;
    --container-xl: 1280px;

    /* Transitions */
    --transition-fast: 0.15s ease;
    --transition-base: 0.2s ease;
    --transition-slow: 0.3s ease;
}

/* ========================================
   2. Reset & Base Styles
   ======================================== */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

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

body {
    background: var(--bg-secondary);
    font-family: var(--font-body);
    color: var(--text-primary);
    line-height: var(--leading-normal);
    min-height: 100vh;
}

/* ========================================
   3. Typography
   ======================================== */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    font-weight: var(--weight-bold);
    line-height: var(--leading-tight);
    color: var(--navy-dark);
    margin-bottom: var(--space-4);
}

h1 {
    font-size: var(--text-5xl);
    font-weight: var(--weight-black);
}

h2 {
    font-size: var(--text-4xl);
}

h3 {
    font-size: var(--text-3xl);
}

h4 {
    font-size: var(--text-2xl);
}

h5 {
    font-size: var(--text-xl);
}

h6 {
    font-size: var(--text-lg);
}

p {
    margin-bottom: var(--space-4);
    line-height: var(--leading-normal);
}

a {
    color: var(--blue-info);
    text-decoration: none;
    transition: color var(--transition-base);
}

a:hover {
    color: #1d4ed8;
    text-decoration: underline;
}

/* ========================================
   4. Layout
   ======================================== */
.container {
    max-width: var(--container-lg);
    margin: 0 auto;
    padding: 40px 20px;
}

.container-sm {
    max-width: var(--container-sm);
}

.container-md {
    max-width: var(--container-md);
}

.container-xl {
    max-width: var(--container-xl);
}

.card {
    background: var(--bg-primary);
    padding: 45px;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08), 0 0 0 1px rgba(0, 0, 0, 0.02);
    margin-bottom: var(--space-6);
}

.card-accent {
    border-top: 4px solid var(--orange-primary);
}

.section {
    margin-bottom: var(--space-16);
}

/* ========================================
   5. Components
   ======================================== */

/* ========================================
   5.1 Buttons
   ======================================== */
.btn {
    display: inline-block;
    padding: 12px 32px;
    border-radius: 42px;
    font-size: var(--text-base);
    font-weight: var(--weight-semibold);
    font-family: var(--font-ui);
    border: none;
    cursor: pointer;
    transition: all var(--transition-base);
    text-align: center;
    text-decoration: none;
    line-height: 1.5;
}

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

.btn-primary {
    background: var(--orange-primary);
    color: white;
    box-shadow: 0 2px 8px rgba(255, 153, 2, 0.2);
}

.btn-primary:hover:not(:disabled) {
    background: #e68a00;
    transform: translateY(-1px);
    box-shadow: var(--shadow-orange);
}

.btn-secondary {
    background: white;
    color: var(--orange-primary);
    border: 2px solid var(--orange-primary);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--orange-primary);
    color: white;
}

.btn-info {
    background: var(--blue-info);
    color: white;
    padding: 10px 24px;
    font-size: var(--text-sm);
}

.btn-info:hover:not(:disabled) {
    background: #1d4ed8;
}

.btn-danger {
    background: var(--error);
    color: white;
    padding: 10px 24px;
    font-size: var(--text-sm);
}

.btn-danger:hover:not(:disabled) {
    background: #b91c1c;
}

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

.btn-success:hover:not(:disabled) {
    background: #047857;
}

.btn-sm {
    padding: 8px 20px;
    font-size: var(--text-sm);
}

.btn-lg {
    padding: 16px 40px;
    font-size: var(--text-lg);
}

.btn-block {
    display: block;
    width: 100%;
}

/* ========================================
   5.2 Forms
   ======================================== */
.form-group {
    margin-bottom: var(--space-5);
}

.form-label {
    display: block;
    font-size: var(--text-sm);
    font-weight: var(--weight-medium);
    color: var(--text-primary);
    margin-bottom: var(--space-2);
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--bg-tertiary);
    border-radius: 12px;
    font-size: var(--text-base);
    font-family: var(--font-ui);
    color: var(--text-primary);
    background: white;
    transition: all var(--transition-base);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    border-color: var(--blue-info);
    outline: none;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-textarea {
    resize: vertical;
    min-height: 100px;
}

.form-input::placeholder {
    color: var(--text-secondary);
}

.form-error {
    color: var(--error);
    font-size: var(--text-sm);
    margin-top: var(--space-1);
}

.form-help {
    color: var(--text-secondary);
    font-size: var(--text-sm);
    margin-top: var(--space-1);
}

/* File Upload */
.file-upload {
    border: 2px dashed var(--bg-tertiary);
    border-radius: 12px;
    padding: var(--space-8);
    text-align: center;
    transition: all var(--transition-base);
    cursor: pointer;
}

.file-upload:hover {
    border-color: var(--blue-info);
    background: rgba(37, 99, 235, 0.02);
}

.file-upload.dragover {
    border-color: var(--orange-primary);
    background: rgba(255, 153, 2, 0.05);
}

/* ========================================
   5.3 Navigation
   ======================================== */
.header {
    height: 72px;
    background: var(--bg-primary);
    box-shadow: var(--shadow-sm);
    padding: 0 var(--space-8);
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav {
    display: flex;
    align-items: center;
    gap: var(--space-6);
}

.nav-link {
    color: var(--navy-primary);
    font-weight: var(--weight-medium);
    font-size: var(--text-base);
    text-decoration: none;
    padding: var(--space-2) var(--space-3);
    border-radius: 8px;
    transition: all var(--transition-base);
}

.nav-link:hover {
    background: var(--bg-secondary);
    text-decoration: none;
}

.nav-link.active {
    color: var(--orange-primary);
}

.logo {
    font-family: var(--font-heading);
    font-size: var(--text-xl);
    font-weight: var(--weight-black);
    color: var(--navy-dark);
}

/* ========================================
   5.4 Tabs
   ======================================== */
.tabs {
    border-bottom: 2px solid var(--bg-tertiary);
    padding: 0;
    margin-bottom: var(--space-8);
    display: flex;
    gap: var(--space-2);
}

.tab {
    padding: 12px 24px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-weight: var(--weight-medium);
    font-size: var(--text-base);
    font-family: var(--font-ui);
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    cursor: pointer;
    transition: all var(--transition-base);
}

.tab:hover {
    color: var(--text-primary);
}

.tab.active {
    color: var(--orange-primary);
    border-bottom-color: var(--orange-primary);
}

/* Tab Content */
.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeIn var(--transition-base);
}

/* ========================================
   5.5 Modals
   ======================================== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: var(--space-4);
}

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.modal.show {
    display: flex;
}

.modal-content {
    background: var(--bg-primary);
    border-radius: 20px;
    padding: 40px;
    box-shadow: var(--shadow-xl);
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideUp var(--transition-slow);
}

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

.modal-title {
    font-size: var(--text-2xl);
    font-weight: var(--weight-bold);
    color: var(--navy-dark);
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    font-size: var(--text-2xl);
    color: var(--text-secondary);
    cursor: pointer;
    padding: var(--space-2);
    line-height: 1;
    transition: color var(--transition-base);
}

.modal-close:hover {
    color: var(--text-primary);
}

.modal-body {
    margin-bottom: var(--space-6);
}

.modal-footer {
    display: flex;
    gap: var(--space-3);
    justify-content: flex-end;
}

/* ========================================
   5.6 Progress
   ======================================== */
.progress {
    height: 8px;
    background: var(--bg-tertiary);
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: var(--space-4);
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--orange-primary), var(--orange-coral));
    border-radius: 8px;
    transition: width var(--transition-slow);
}

.progress-text {
    font-size: var(--text-sm);
    color: var(--text-secondary);
    text-align: center;
    margin-top: var(--space-2);
}

/* ========================================
   5.7 Badges
   ======================================== */
.badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: var(--text-xs);
    font-weight: var(--weight-semibold);
    border: 1px solid;
}

.badge-success {
    background: var(--tint-green);
    color: var(--green-success);
    border-color: var(--green-success);
}

.badge-info {
    background: var(--tint-blue);
    color: var(--blue-info);
    border-color: var(--blue-info);
}

.badge-warning {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning);
    border-color: var(--warning);
}

.badge-error {
    background: rgba(220, 38, 38, 0.1);
    color: var(--error);
    border-color: var(--error);
}

/* ========================================
   5.8 Feature Highlights
   ======================================== */
.feature-box {
    border-radius: 12px;
    padding: 16px 20px;
    font-size: var(--text-sm);
    font-weight: var(--weight-medium);
    color: var(--navy-dark);
    border: 2px solid;
}

.feature-box-green {
    background: var(--tint-green);
    border-color: var(--green-success);
}

.feature-box-blue {
    background: var(--tint-blue);
    border-color: var(--blue-info);
}

.feature-box-purple {
    background: var(--tint-purple);
    border-color: var(--purple-premium);
}

.feature-box-orange {
    background: var(--tint-orange);
    border-color: var(--orange-primary);
}

/* ========================================
   5.9 Tables
   ======================================== */
.table-container {
    overflow-x: auto;
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
    margin-bottom: var(--space-6);
}

table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-primary);
}

thead {
    background: var(--bg-secondary);
}

th {
    padding: var(--space-4);
    text-align: left;
    font-weight: var(--weight-semibold);
    color: var(--navy-dark);
    font-size: var(--text-sm);
    border-bottom: 2px solid var(--bg-tertiary);
}

td {
    padding: var(--space-4);
    border-bottom: 1px solid var(--bg-tertiary);
    font-size: var(--text-sm);
}

tbody tr:hover {
    background: var(--bg-secondary);
}

tbody tr:last-child td {
    border-bottom: none;
}

/* ========================================
   5.10 Alerts & Messages
   ======================================== */
.alert {
    padding: var(--space-4);
    border-radius: 12px;
    margin-bottom: var(--space-4);
    border: 1px solid;
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
}

.alert-success {
    background: var(--tint-green);
    color: var(--green-success);
    border-color: var(--green-success);
}

.alert-info {
    background: var(--tint-blue);
    color: var(--blue-info);
    border-color: var(--blue-info);
}

.alert-warning {
    background: rgba(245, 158, 11, 0.1);
    color: #b45309;
    border-color: var(--warning);
}

.alert-error {
    background: rgba(220, 38, 38, 0.1);
    color: #991b1b;
    border-color: var(--error);
}

/* ========================================
   6. Utility Classes
   ======================================== */

/* Text Alignment */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

/* Text Colors */
.text-primary { color: var(--text-primary); }
.text-secondary { color: var(--text-secondary); }
.text-success { color: var(--success); }
.text-error { color: var(--error); }
.text-info { color: var(--info); }
.text-warning { color: var(--warning); }

/* Font Weights */
.font-normal { font-weight: var(--weight-normal); }
.font-medium { font-weight: var(--weight-medium); }
.font-semibold { font-weight: var(--weight-semibold); }
.font-bold { font-weight: var(--weight-bold); }

/* Margins */
.mt-1 { margin-top: var(--space-1); }
.mt-2 { margin-top: var(--space-2); }
.mt-3 { margin-top: var(--space-3); }
.mt-4 { margin-top: var(--space-4); }
.mt-5 { margin-top: var(--space-5); }
.mt-6 { margin-top: var(--space-6); }
.mt-8 { margin-top: var(--space-8); }

.mb-1 { margin-bottom: var(--space-1); }
.mb-2 { margin-bottom: var(--space-2); }
.mb-3 { margin-bottom: var(--space-3); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-5 { margin-bottom: var(--space-5); }
.mb-6 { margin-bottom: var(--space-6); }
.mb-8 { margin-bottom: var(--space-8); }

.ml-1 { margin-left: var(--space-1); }
.ml-2 { margin-left: var(--space-2); }
.ml-3 { margin-left: var(--space-3); }
.ml-4 { margin-left: var(--space-4); }

.mr-1 { margin-right: var(--space-1); }
.mr-2 { margin-right: var(--space-2); }
.mr-3 { margin-right: var(--space-3); }
.mr-4 { margin-right: var(--space-4); }

/* Padding */
.p-1 { padding: var(--space-1); }
.p-2 { padding: var(--space-2); }
.p-3 { padding: var(--space-3); }
.p-4 { padding: var(--space-4); }
.p-5 { padding: var(--space-5); }
.p-6 { padding: var(--space-6); }

/* Display */
.d-none { display: none; }
.d-block { display: block; }
.d-inline-block { display: inline-block; }
.d-flex { display: flex; }

/* Flexbox */
.flex-row { flex-direction: row; }
.flex-column { flex-direction: column; }
.align-items-center { align-items: center; }
.justify-content-center { justify-content: center; }
.justify-content-between { justify-content: space-between; }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }

/* Width */
.w-100 { width: 100%; }
.w-50 { width: 50%; }
.w-auto { width: auto; }

/* ========================================
   7. Responsive Design
   ======================================== */
@media (max-width: 768px) {
    :root {
        --text-5xl: 40px;
        --text-4xl: 32px;
        --text-3xl: 28px;
        --text-2xl: 20px;
    }

    .container {
        padding: 20px 16px;
    }

    .card {
        padding: 24px;
    }

    .header {
        padding: 0 var(--space-4);
    }

    .nav {
        gap: var(--space-3);
    }

    .tabs {
        flex-wrap: wrap;
        gap: var(--space-1);
    }

    .tab {
        padding: 10px 16px;
        font-size: var(--text-sm);
    }

    .modal-content {
        padding: 24px;
    }

    .btn {
        padding: 10px 24px;
    }

    .modal-footer {
        flex-direction: column;
    }

    .modal-footer .btn {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .header {
        height: auto;
        min-height: 60px;
        flex-direction: column;
        padding: var(--space-3);
        gap: var(--space-3);
    }

    .nav {
        flex-direction: column;
        width: 100%;
        gap: var(--space-2);
    }

    .nav-link {
        width: 100%;
        text-align: center;
    }

    .tabs {
        flex-direction: column;
        border-bottom: none;
    }

    .tab {
        border-bottom: 1px solid var(--bg-tertiary);
        margin-bottom: 0;
        width: 100%;
    }

    .tab.active {
        background: var(--tint-orange);
        border-bottom-color: var(--bg-tertiary);
    }
}

/* ========================================
   8. Animations
   ======================================== */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

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

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

@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

.fade-in {
    animation: fadeIn var(--transition-base);
}

.slide-up {
    animation: slideUp var(--transition-slow);
}

.slide-down {
    animation: slideDown var(--transition-slow);
}

/* Loading Spinner */
.spinner {
    border: 3px solid var(--bg-tertiary);
    border-top-color: var(--orange-primary);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 0.8s linear infinite;
}

.spinner-sm {
    width: 20px;
    height: 20px;
    border-width: 2px;
}

.spinner-lg {
    width: 60px;
    height: 60px;
    border-width: 4px;
}

/* ========================================
   9. Print Styles
   ======================================== */
@media print {
    .header,
    .nav,
    .btn,
    .modal-overlay {
        display: none;
    }

    body {
        background: white;
    }

    .card {
        box-shadow: none;
        border: 1px solid #ddd;
    }
}
