/* ============================================ */
/* GLOBAL STYLES - COMPREHENSIVE & RESPONSIVE */
/* ============================================ */

/* CSS Custom Properties for Consistent Theming */
:root {
    /* Primary Brand Colors */
    --gold: #D4AF37;
    --gold-light: #F0E68C;
    --gold-dark: #B8941F;
    --gold-dim: rgba(212, 175, 55, 0.15);
    --gold-hover: rgba(212, 175, 55, 0.25);

    /* Dark Theme Colors */
    --dark: #000000;
    --dark-2: #050308;
    --dark-3: #0F0B1A;
    --dark-4: #1A1425;
    --dark-5: #252030;

    /* Text Colors */
    --text: #F9F5EF;
    --text-muted: #B8B5B2;
    --text-secondary: #8A8691;
    --text-dark: #1a1a1a;
    --text-light: #ffffff;

    /* Background Colors */
    --bg-primary: var(--dark);
    --bg-secondary: var(--dark-3);
    --bg-tertiary: var(--dark-4);
    --bg-light: #ffffff;
    --bg-overlay: rgba(0, 0, 0, 0.8);

    /* Border & Dividers */
    --border: rgba(255, 255, 255, 0.1);
    --border-light: rgba(255, 255, 255, 0.05);
    --border-dark: #e1e8ed;

    /* Shadows */
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.15);
    --shadow-lg: 0 8px 25px rgba(0, 0, 0, 0.2);
    --shadow-xl: 0 20px 40px rgba(0, 0, 0, 0.25);

    /* Status Colors */
    --success: #10b981;
    --success-light: #d1fae5;
    --error: #ef4444;
    --error-light: #fee2e2;
    --warning: #f59e0b;
    --warning-light: #fef3c7;
    --info: #3b82f6;
    --info-light: #dbeafe;

    /* Spacing Scale */
    --space-xs: 0.25rem;   /* 4px */
    --space-sm: 0.5rem;    /* 8px */
    --space-md: 1rem;      /* 16px */
    --space-lg: 1.5rem;    /* 24px */
    --space-xl: 2rem;      /* 32px */
    --space-2xl: 3rem;     /* 48px */
    --space-3xl: 4rem;     /* 64px */

    /* Typography Scale */
    --font-xs: 0.75rem;    /* 12px */
    --font-sm: 0.875rem;   /* 14px */
    --font-base: 1rem;     /* 16px */
    --font-lg: 1.125rem;   /* 18px */
    --font-xl: 1.25rem;    /* 20px */
    --font-2xl: 1.5rem;    /* 24px */
    --font-3xl: 1.875rem;  /* 30px */
    --font-4xl: 2.25rem;   /* 36px */
    --font-5xl: 3rem;      /* 48px */

    /* Border Radius */
    --radius-sm: 0.25rem;  /* 4px */
    --radius-md: 0.5rem;   /* 8px */
    --radius-lg: 0.75rem;  /* 12px */
    --radius-xl: 1rem;     /* 16px */
    --radius-2xl: 1.5rem;  /* 24px */
    --radius-full: 50%;

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

    /* Z-index Scale */
    --z-dropdown: 1000;
    --z-sticky: 1020;
    --z-fixed: 1030;
    --z-modal-backdrop: 1040;
    --z-modal: 1050;
    --z-popover: 1060;
    --z-tooltip: 1070;
    --z-toast: 9999;
}

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

html {
    scroll-behavior: smooth;
    font-size: 16px;
    line-height: 1.5;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, var(--dark) 0%, var(--dark-2) 50%, var(--dark-3) 100%);
    color: var(--text);
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    line-height: 1.2;
    margin-bottom: 0.5em;
    color: var(--text);
}

h1 { font-size: var(--font-4xl); }
h2 { font-size: var(--font-3xl); }
h3 { font-size: var(--font-2xl); }
h4 { font-size: var(--font-xl); }
h5 { font-size: var(--font-lg); }
h6 { font-size: var(--font-base); }

p {
    margin-bottom: 1em;
    line-height: 1.6;
}

a {
    color: var(--gold);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--gold-light);
}

/* Form Elements - Enhanced Styling */
.form-group {
    margin-bottom: var(--space-lg);
    position: relative;
}

.form-group.full-width {
    grid-column: 1 / -1;
}

.form-group.small {
    flex: 0 0 auto;
    min-width: 120px;
}

label {
    display: block;
    font-weight: 600;
    margin-bottom: var(--space-sm);
    color: var(--text);
    font-size: var(--font-sm);
    letter-spacing: 0.025em;
}

input,
textarea,
select {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border);
    border-radius: var(--radius-lg);
    background: rgba(15, 11, 26, 0.6);
    color: var(--text);
    font-size: var(--font-base);
    font-family: inherit;
    transition: all var(--transition-base);
    backdrop-filter: blur(10px);
}

input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--gold);
    box-shadow: 0 0 0 3px var(--gold-dim);
    background: rgba(15, 11, 26, 0.8);
}

input::placeholder,
textarea::placeholder {
    color: var(--text-muted);
    opacity: 1;
}

/* Enhanced Input States */
input:invalid:not(:focus):not(:placeholder-shown),
textarea:invalid:not(:focus):not(:placeholder-shown),
select:invalid:not(:focus) {
    border-color: var(--error);
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

input:valid:not(:focus):not(:placeholder-shown),
textarea:valid:not(:focus):not(:placeholder-shown),
select:valid:not(:focus) {
    border-color: var(--success);
}

/* Form Validation Messages */
.error-message {
    color: var(--error);
    font-size: var(--font-xs);
    margin-top: var(--space-xs);
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    animation: fadeInError 0.3s ease;
}

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

.success-message {
    color: var(--success);
    font-size: var(--font-xs);
    margin-top: var(--space-xs);
    display: flex;
    align-items: center;
    gap: var(--space-xs);
}

/* Button System - Comprehensive */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: 12px 24px;
    border: none;
    border-radius: var(--radius-lg);
    font-size: var(--font-base);
    font-weight: 600;
    font-family: inherit;
    text-decoration: none;
    cursor: pointer;
    transition: all var(--transition-base);
    position: relative;
    overflow: hidden;
    white-space: nowrap;
    user-select: none;
    min-height: 48px;
}

/* Button Variants */
.btn-primary {
    background: linear-gradient(135deg, var(--gold), var(--gold-light));
    color: var(--dark);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(212, 175, 55, 0.3);
}

.btn-secondary {
    background: var(--dark-3);
    color: var(--text);
    border: 2px solid var(--border);
}

.btn-secondary:hover {
    border-color: var(--gold);
    background: var(--dark-4);
}

.btn-outline {
    background: transparent;
    color: var(--gold);
    border: 2px solid var(--gold);
}

.btn-outline:hover {
    background: var(--gold);
    color: var(--dark);
}

.btn-ghost {
    background: transparent;
    color: var(--text);
    border: 2px solid transparent;
}

.btn-ghost:hover {
    background: var(--gold-dim);
    border-color: var(--gold);
}

.btn-danger {
    background: linear-gradient(135deg, var(--error), #dc2626);
    color: white;
}

.btn-success {
    background: linear-gradient(135deg, var(--success), #059669);
    color: white;
}

/* Button Sizes */
.btn-sm {
    padding: 8px 16px;
    font-size: var(--font-sm);
    min-height: 36px;
}

.btn-lg {
    padding: 16px 32px;
    font-size: var(--font-lg);
    min-height: 56px;
}

.btn-xl {
    padding: 20px 40px;
    font-size: var(--font-xl);
    min-height: 64px;
}

/* Button States */
.btn:disabled,
.btn[disabled] {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

.btn:focus {
    outline: 2px solid var(--gold);
    outline-offset: 2px;
}

.btn-block {
    width: 100%;
}

/* Loading State */
.btn.loading {
    position: relative;
    color: transparent;
}

.btn.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid currentColor;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Card System */
.card {
    background: rgba(15, 11, 26, 0.9);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: var(--space-xl);
    backdrop-filter: blur(10px);
    box-shadow: var(--shadow-md);
    transition: all var(--transition-base);
}

.card:hover {
    border-color: var(--gold-dim);
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

.card-header {
    margin-bottom: var(--space-lg);
    padding-bottom: var(--space-lg);
    border-bottom: 1px solid var(--border);
}

.card-title {
    font-size: var(--font-xl);
    font-weight: 600;
    color: var(--text);
    margin-bottom: var(--space-sm);
}

.card-subtitle {
    color: var(--text-muted);
    font-size: var(--font-base);
}

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

.card-footer {
    padding-top: var(--space-lg);
    border-top: 1px solid var(--border);
    display: flex;
    gap: var(--space-md);
    align-items: center;
    justify-content: space-between;
}

/* Grid System */
.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--space-lg);
}

.container-fluid {
    width: 100%;
    padding: 0 var(--space-lg);
}

.row {
    display: flex;
    flex-wrap: wrap;
    margin: 0 calc(var(--space-md) * -0.5);
}

.col {
    flex: 1;
    padding: 0 calc(var(--space-md) * 0.5);
}

/* Responsive Grid */
@media (min-width: 768px) {
    .col-md-1 { flex: 0 0 8.333333%; max-width: 8.333333%; }
    .col-md-2 { flex: 0 0 16.666667%; max-width: 16.666667%; }
    .col-md-3 { flex: 0 0 25%; max-width: 25%; }
    .col-md-4 { flex: 0 0 33.333333%; max-width: 33.333333%; }
    .col-md-6 { flex: 0 0 50%; max-width: 50%; }
    .col-md-8 { flex: 0 0 66.666667%; max-width: 66.666667%; }
    .col-md-9 { flex: 0 0 75%; max-width: 75%; }
    .col-md-12 { flex: 0 0 100%; max-width: 100%; }
}

/* Utility Classes */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.mt-1 { margin-top: var(--space-xs); }
.mt-2 { margin-top: var(--space-sm); }
.mt-3 { margin-top: var(--space-md); }
.mt-4 { margin-top: var(--space-lg); }
.mt-5 { margin-top: var(--space-xl); }

.mb-1 { margin-bottom: var(--space-xs); }
.mb-2 { margin-bottom: var(--space-sm); }
.mb-3 { margin-bottom: var(--space-md); }
.mb-4 { margin-bottom: var(--space-lg); }
.mb-5 { margin-bottom: var(--space-xl); }

.p-1 { padding: var(--space-xs); }
.p-2 { padding: var(--space-sm); }
.p-3 { padding: var(--space-md); }
.p-4 { padding: var(--space-lg); }
.p-5 { padding: var(--space-xl); }

.d-none { display: none; }
.d-block { display: block; }
.d-flex { display: flex; }
.d-grid { display: grid; }

.align-center { align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }

.hidden { display: none !important; }
.visible { display: block !important; }

/* Responsive Utilities */
@media (max-width: 767px) {
    .d-md-none { display: none !important; }
    .d-md-block { display: block !important; }
}

@media (min-width: 768px) {
    .d-sm-none { display: none !important; }
    .d-sm-block { display: block !important; }
}

/* Animation Classes */
.fade-in {
    animation: fadeIn 0.5s ease-in;
}

.slide-up {
    animation: slideUp 0.5s ease-out;
}

.bounce-in {
    animation: bounceIn 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

@keyframes bounceIn {
    from {
        opacity: 0;
        transform: scale(0.3);
    }
    50% {
        transform: scale(1.05);
    }
    70% {
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Loading States */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-overlay);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: var(--z-modal);
    backdrop-filter: blur(4px);
}

.loading-overlay.active {
    display: flex;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--gold-dim);
    border-top-color: var(--gold);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: var(--z-toast);
    pointer-events: none;
}

.toast {
    background: var(--bg-light);
    color: var(--text-dark);
    padding: 16px 20px;
    border-radius: var(--radius-lg);
    margin-bottom: 12px;
    box-shadow: var(--shadow-lg);
    transform: translateX(100%);
    transition: transform var(--transition-base);
    pointer-events: auto;
    max-width: 400px;
    border-left: 4px solid var(--info);
}

.toast.show {
    transform: translateX(0);
}

.toast.success { border-left-color: var(--success); }
.toast.error { border-left-color: var(--error); }
.toast.warning { border-left-color: var(--warning); }

/* Responsive Design */
@media (max-width: 480px) {
    :root {
        --font-xs: 0.7rem;
        --font-sm: 0.8rem;
        --font-base: 0.9rem;
        --font-lg: 1rem;
        --font-xl: 1.1rem;
        --font-2xl: 1.3rem;
        --font-3xl: 1.6rem;
        --font-4xl: 2rem;
        --font-5xl: 2.5rem;
    }

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

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

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

    .row {
        margin: 0 calc(var(--space-sm) * -0.5);
    }

    .col {
        padding: 0 calc(var(--space-sm) * 0.5);
    }
}

/* Print Styles */
@media print {
    * {
        background: transparent !important;
        color: black !important;
        box-shadow: none !important;
    }

    .no-print,
    .chat-widget,
    .loading-overlay,
    .toast-container {
        display: none !important;
    }

    body {
        font-size: 12pt;
        line-height: 1.5;
    }

    h1, h2, h3, h4, h5, h6 {
        break-after: avoid;
        page-break-after: avoid;
    }

    p {
        orphans: 3;
        widows: 3;
    }
}

/* Accessibility Improvements */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

.skip-link {
    position: absolute;
    top: -40px;
    left: 6px;
    background: var(--gold);
    color: var(--dark);
    padding: 8px;
    z-index: 1000;
    text-decoration: none;
    border-radius: var(--radius-md);
}

.skip-link:focus {
    top: 6px;
}

/* Focus Management */
:focus {
    outline: 2px solid var(--gold);
    outline-offset: 2px;
}

button:focus,
input:focus,
textarea:focus,
select:focus {
    outline: 2px solid var(--gold);
    outline-offset: 2px;
}

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

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
    :root {
        --border: #ffffff;
        --text: #ffffff;
        --text-muted: #cccccc;
    }
}

/* Performance Optimizations */
* {
    will-change: auto;
}

img {
    content-visibility: auto;
}

.card,
.btn {
    contain: layout style paint;
}