/* ========================================
   BPointBlazor Modern Design System
   ======================================== */

/* ========================================
   1. CSS VARIABLES - Design Tokens
   ======================================== */
:root {
    /* Primary Colors - Professional Blue Gradient */
    --primary-50: #e3f2fd;
    --primary-100: #bbdefb;
    --primary-200: #90caf9;
    --primary-300: #64b5f6;
    --primary-400: #42a5f5;
    --primary-500: #2196f3;
    --primary-600: #1e88e5;
    --primary-700: #1976d2;
    --primary-800: #1565c0;
    --primary-900: #0d47a1;

    /* Success Colors - Modern Green */
    --success-50: #e8f5e9;
    --success-100: #c8e6c9;
    --success-200: #a5d6a7;
    --success-300: #81c784;
    --success-400: #66bb6a;
    --success-500: #4caf50;
    --success-600: #43a047;
    --success-700: #388e3c;
    --success-800: #2e7d32;
    --success-900: #1b5e20;

    /* Warning Colors - Vibrant Orange */
    --warning-50: #fff3e0;
    --warning-100: #ffe0b2;
    --warning-200: #ffcc80;
    --warning-300: #ffb74d;
    --warning-400: #ffa726;
    --warning-500: #ff9800;
    --warning-600: #fb8c00;
    --warning-700: #f57c00;
    --warning-800: #ef6c00;
    --warning-900: #e65100;

    /* Danger Colors - Modern Red */
    --danger-50: #ffebee;
    --danger-100: #ffcdd2;
    --danger-200: #ef9a9a;
    --danger-300: #e57373;
    --danger-400: #ef5350;
    --danger-500: #f44336;
    --danger-600: #e53935;
    --danger-700: #d32f2f;
    --danger-800: #c62828;
    --danger-900: #b71c1c;

    /* Neutral Colors - Modern Grays */
    --gray-50: #fafafa;
    --gray-100: #f5f5f5;
    --gray-200: #eeeeee;
    --gray-300: #e0e0e0;
    --gray-400: #bdbdbd;
    --gray-500: #9e9e9e;
    --gray-600: #757575;
    --gray-700: #616161;
    --gray-800: #424242;
    --gray-900: #212121;

    /* Semantic Colors */
    --color-background: #f8f9fa;
    --color-surface: #ffffff;
    --color-text-primary: var(--gray-900);
    --color-text-secondary: var(--gray-600);
    --color-text-disabled: var(--gray-400);
    --color-border: var(--gray-300);
    --color-divider: var(--gray-200);

    /* Typography */
    --font-family-base: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    --font-family-heading: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    --font-family-mono: 'Fira Code', 'Consolas', 'Monaco', 'Courier New', monospace;

    /* Font Sizes */
    --font-size-xs: 0.75rem;
    /* 12px */
    --font-size-sm: 0.875rem;
    /* 14px */
    --font-size-base: 1rem;
    /* 16px */
    --font-size-lg: 1.125rem;
    /* 18px */
    --font-size-xl: 1.25rem;
    /* 20px */
    --font-size-2xl: 1.5rem;
    /* 24px */
    --font-size-3xl: 1.875rem;
    /* 30px */
    --font-size-4xl: 2.25rem;
    /* 36px */

    /* Font Weights */
    --font-weight-light: 300;
    --font-weight-normal: 400;
    --font-weight-medium: 500;
    --font-weight-semibold: 600;
    --font-weight-bold: 700;

    /* Line Heights */
    --line-height-tight: 1.25;
    --line-height-normal: 1.5;
    --line-height-relaxed: 1.75;

    /* Spacing Scale */
    --space-1: 0.25rem;
    /* 4px */
    --space-2: 0.5rem;
    /* 8px */
    --space-3: 0.75rem;
    /* 12px */
    --space-4: 1rem;
    /* 16px */
    --space-5: 1.25rem;
    /* 20px */
    --space-6: 1.5rem;
    /* 24px */
    --space-8: 2rem;
    /* 32px */
    --space-10: 2.5rem;
    /* 40px */
    --space-12: 3rem;
    /* 48px */
    --space-16: 4rem;
    /* 64px */

    /* Border Radius */
    --radius-sm: 0.25rem;
    /* 4px */
    --radius-base: 0.5rem;
    /* 8px */
    --radius-md: 0.75rem;
    /* 12px */
    --radius-lg: 1rem;
    /* 16px */
    --radius-xl: 1.5rem;
    /* 24px */
    --radius-full: 9999px;

    /* Shadows */
    --shadow-xs: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1);
    --shadow-base: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 25px 50px -12px rgba(0, 0, 0, 0.25);

    /* Transitions */
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-base: 250ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 350ms cubic-bezier(0.4, 0, 0.2, 1);

    /* 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;
}

/* ========================================
   2. GLOBAL RESETS & BASE STYLES
   ======================================== */
* {
    box-sizing: border-box;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-family-base);
    font-size: var(--font-size-base);
    line-height: var(--line-height-normal);
    color: var(--color-text-primary);
    background-color: var(--color-background);
    margin: 0;
    padding: 0;
}

/* ========================================
   3. TYPOGRAPHY
   ======================================== */
h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: var(--font-family-heading);
    font-weight: var(--font-weight-bold);
    line-height: var(--line-height-tight);
    margin-top: 0;
    margin-bottom: var(--space-4);
    color: var(--color-text-primary);
}

h1 {
    font-size: var(--font-size-4xl);
}

h2 {
    font-size: var(--font-size-3xl);
}

h3 {
    font-size: var(--font-size-2xl);
}

h4 {
    font-size: var(--font-size-xl);
}

h5 {
    font-size: var(--font-size-lg);
}

h6 {
    font-size: var(--font-size-base);
}

p {
    margin-top: 0;
    margin-bottom: var(--space-4);
}

/* ========================================
   4. MODERN BUTTON STYLES
   ======================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-6);
    font-size: var(--font-size-base);
    font-weight: var(--font-weight-medium);
    line-height: 1;
    border-radius: var(--radius-base);
    border: none;
    cursor: pointer;
    transition: all var(--transition-base);
    text-decoration: none;
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width var(--transition-base), height var(--transition-base);
}

.btn:hover::before {
    width: 300px;
    height: 300px;
}

.btn:active {
    transform: translateY(1px);
}

/* Primary Button */
.btn-primary {
    background: linear-gradient(135deg, var(--primary-600) 0%, var(--primary-700) 100%);
    color: white;
    box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-700) 0%, var(--primary-800) 100%);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

/* Success Button */
.btn-success {
    background: linear-gradient(135deg, var(--success-600) 0%, var(--success-700) 100%);
    color: white;
    box-shadow: var(--shadow-sm);
}

.btn-success:hover {
    background: linear-gradient(135deg, var(--success-700) 0%, var(--success-800) 100%);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

/* Warning Button */
.btn-warning {
    background: linear-gradient(135deg, var(--warning-500) 0%, var(--warning-600) 100%);
    color: white;
    box-shadow: var(--shadow-sm);
}

.btn-warning:hover {
    background: linear-gradient(135deg, var(--warning-600) 0%, var(--warning-700) 100%);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

/* Danger Button */
.btn-danger {
    background: linear-gradient(135deg, var(--danger-500) 0%, var(--danger-600) 100%);
    color: white;
    box-shadow: var(--shadow-sm);
}

.btn-danger:hover {
    background: linear-gradient(135deg, var(--danger-600) 0%, var(--danger-700) 100%);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

/* Secondary Button */
.btn-secondary {
    background: var(--gray-200);
    color: var(--gray-800);
    box-shadow: var(--shadow-sm);
}

.btn-secondary:hover {
    background: var(--gray-300);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

/* Button Sizes */
.btn-sm {
    padding: var(--space-2) var(--space-4);
    font-size: var(--font-size-sm);
}

.btn-lg {
    padding: var(--space-4) var(--space-8);
    font-size: var(--font-size-lg);
}

/* ========================================
   5. MODERN CARD STYLES
   ======================================== */
.card {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-base);
    border: 1px solid var(--color-border);
    overflow: hidden;
    transition: all var(--transition-base);
}

.card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-4px);
}

.card-header {
    padding: var(--space-6);
    border-bottom: 1px solid var(--color-divider);
    background: linear-gradient(135deg, var(--gray-50) 0%, var(--gray-100) 100%);
    font-weight: var(--font-weight-semibold);
}

.card-body {
    padding: var(--space-6);
}

.card-footer {
    padding: var(--space-6);
    border-top: 1px solid var(--color-divider);
    background: var(--gray-50);
}

/* ========================================
   6. FORM CONTROLS
   ======================================== */
.form-control {
    display: block;
    width: 100%;
    padding: var(--space-3) var(--space-4);
    font-size: var(--font-size-base);
    line-height: var(--line-height-normal);
    color: var(--color-text-primary);
    background-color: var(--color-surface);
    border: 2px solid var(--color-border);
    border-radius: var(--radius-base);
    transition: all var(--transition-base);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-500);
    box-shadow: 0 0 0 3px rgba(33, 150, 243, 0.1);
}

.form-label {
    display: block;
    margin-bottom: var(--space-2);
    font-weight: var(--font-weight-medium);
    color: var(--color-text-primary);
    font-size: var(--font-size-sm);
}

/* ========================================
   7. BADGES
   ======================================== */
.badge {
    display: inline-flex;
    align-items: center;
    padding: var(--space-1) var(--space-3);
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-semibold);
    line-height: 1;
    border-radius: var(--radius-full);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.bg-primary {
    background: linear-gradient(135deg, var(--primary-500) 0%, var(--primary-600) 100%);
    color: white;
}

.bg-success {
    background: linear-gradient(135deg, var(--success-500) 0%, var(--success-600) 100%);
    color: white;
}

.bg-warning {
    background: linear-gradient(135deg, var(--warning-500) 0%, var(--warning-600) 100%);
    color: white;
}

.bg-danger {
    background: linear-gradient(135deg, var(--danger-500) 0%, var(--danger-600) 100%);
    color: white;
}

/* ========================================
   8. ALERTS
   ======================================== */
.alert {
    padding: var(--space-4) var(--space-6);
    border-radius: var(--radius-base);
    border-left: 4px solid;
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.alert-primary {
    background-color: var(--primary-50);
    border-color: var(--primary-500);
    color: var(--primary-900);
}

.alert-success {
    background-color: var(--success-50);
    border-color: var(--success-500);
    color: var(--success-900);
}

.alert-warning {
    background-color: var(--warning-50);
    border-color: var(--warning-500);
    color: var(--warning-900);
}

.alert-danger {
    background-color: var(--danger-50);
    border-color: var(--danger-500);
    color: var(--danger-900);
}

/* ========================================
   9. UTILITY CLASSES
   ======================================== */
.shadow-sm {
    box-shadow: var(--shadow-sm);
}

.shadow {
    box-shadow: var(--shadow-base);
}

.shadow-md {
    box-shadow: var(--shadow-md);
}

.shadow-lg {
    box-shadow: var(--shadow-lg);
}

.shadow-xl {
    box-shadow: var(--shadow-xl);
}

.rounded-sm {
    border-radius: var(--radius-sm);
}

.rounded {
    border-radius: var(--radius-base);
}

.rounded-md {
    border-radius: var(--radius-md);
}

.rounded-lg {
    border-radius: var(--radius-lg);
}

.rounded-xl {
    border-radius: var(--radius-xl);
}

.rounded-full {
    border-radius: var(--radius-full);
}

.text-primary {
    color: var(--primary-600);
}

.text-success {
    color: var(--success-600);
}

.text-warning {
    color: var(--warning-600);
}

.text-danger {
    color: var(--danger-600);
}

.text-muted {
    color: var(--color-text-secondary);
}

/* ========================================
   10. ANIMATIONS
   ======================================== */
@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

.animate-fade-in {
    animation: fadeIn var(--transition-base);
}

.animate-slide-up {
    animation: slideUp var(--transition-base);
}

.animate-pulse {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* ========================================
   11. RESPONSIVE UTILITIES
   ======================================== */

/* Breakpoints */
/* Mobile: < 640px */
/* Tablet: 640px - 1024px */
/* Desktop: > 1024px */

/* Container with responsive padding */
.container-responsive {
    width: 100%;
    margin-left: auto;
    margin-right: auto;
    padding-left: var(--space-4);
    padding-right: var(--space-4);
}

@media (min-width: 640px) {
    .container-responsive {
        padding-left: var(--space-6);
        padding-right: var(--space-6);
    }
}

@media (min-width: 1024px) {
    .container-responsive {
        max-width: 1280px;
        padding-left: var(--space-8);
        padding-right: var(--space-8);
    }
}

/* Responsive Grid */
.grid-responsive {
    display: grid;
    gap: var(--space-4);
    grid-template-columns: 1fr;
}

@media (min-width: 640px) {
    .grid-responsive {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--space-6);
    }
}

@media (min-width: 1024px) {
    .grid-responsive {
        grid-template-columns: repeat(3, 1fr);
        gap: var(--space-8);
    }
}

/* Mobile-specific utilities */
@media (max-width: 639px) {
    .mobile-hidden {
        display: none !important;
    }

    .mobile-full-width {
        width: 100% !important;
    }

    .mobile-text-center {
        text-align: center !important;
    }

    .mobile-p-2 {
        padding: var(--space-2) !important;
    }

    .mobile-p-4 {
        padding: var(--space-4) !important;
    }

    .mobile-mb-4 {
        margin-bottom: var(--space-4) !important;
    }

    /* Stack buttons vertically on mobile */
    .btn-group-mobile {
        display: flex;
        flex-direction: column;
        gap: var(--space-2);
    }

    .btn-group-mobile .btn {
        width: 100%;
    }

    /* Smaller text on mobile */
    h1 {
        font-size: var(--font-size-2xl);
    }

    h2 {
        font-size: var(--font-size-xl);
    }

    h3 {
        font-size: var(--font-size-lg);
    }

    /* Card adjustments for mobile */
    .card {
        border-radius: var(--radius-base);
    }

    .card-header,
    .card-body,
    .card-footer {
        padding: var(--space-4);
    }
}

/* Tablet-specific utilities */
@media (min-width: 640px) and (max-width: 1023px) {
    .tablet-hidden {
        display: none !important;
    }
}

/* Desktop-specific utilities */
@media (min-width: 1024px) {
    .desktop-hidden {
        display: none !important;
    }
}

/* Touch-friendly tap targets (minimum 44x44px) */
@media (hover: none) and (pointer: coarse) {

    .btn,
    .badge,
    button,
    a {
        min-height: 44px;
        min-width: 44px;
    }

    /* Larger form controls for touch */
    .form-control {
        padding: var(--space-4) var(--space-4);
        font-size: var(--font-size-base);
    }
}

/* Prevent text selection on buttons and interactive elements */
.btn,
.badge,
button {
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}

/* Smooth scrolling for mobile */
@media (max-width: 639px) {
    html {
        scroll-behavior: smooth;
    }

    /* Prevent horizontal scroll */
    body {
        overflow-x: hidden;
    }
}

/* ========================================
   12. ACCESSIBILITY
   ======================================== */

/* Focus visible for keyboard navigation */
*:focus-visible {
    outline: 2px solid var(--primary-500);
    outline-offset: 2px;
}

/* Reduced motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .btn {
        border: 2px solid currentColor;
    }

    .card {
        border: 2px solid var(--color-border);
    }
}

/* Dark mode support (optional - can be enabled later) */
@media (prefers-color-scheme: dark) {
    :root {
        --color-background: var(--gray-900);
        --color-surface: var(--gray-800);
        --color-text-primary: var(--gray-50);
        --color-text-secondary: var(--gray-300);
        --color-border: var(--gray-700);
        --color-divider: var(--gray-700);
    }

    /* Ensure body and main containers have dark background */
    body {
        background-color: var(--gray-900) !important;
        color: var(--gray-50) !important;
    }

    /* Cards */
    .card {
        background-color: var(--gray-800) !important;
        border-color: var(--gray-700) !important;
        color: var(--gray-50) !important;
    }

    .card-header {
        background-color: var(--gray-700) !important;
        border-color: var(--gray-600) !important;
        color: var(--gray-50) !important;
    }

    .card-body {
        background-color: var(--gray-800) !important;
        color: var(--gray-50) !important;
    }

    /* Alerts */
    .alert {
        background-color: var(--gray-700) !important;
        border-color: var(--gray-600) !important;
        color: var(--gray-50) !important;
    }

    .alert-success {
        background-color: rgba(34, 197, 94, 0.2) !important;
        border-color: rgb(34, 197, 94) !important;
        color: rgb(134, 239, 172) !important;
    }

    .alert-warning {
        background-color: rgba(251, 191, 36, 0.2) !important;
        border-color: rgb(251, 191, 36) !important;
        color: rgb(253, 224, 71) !important;
    }

    .alert-danger {
        background-color: rgba(239, 68, 68, 0.2) !important;
        border-color: rgb(239, 68, 68) !important;
        color: rgb(252, 165, 165) !important;
    }

    /* Forms */
    .form-control {
        background-color: var(--gray-700) !important;
        border-color: var(--gray-600) !important;
        color: var(--gray-50) !important;
    }

    .form-control::placeholder {
        color: var(--gray-400) !important;
    }

    /* Buttons - ensure they remain visible */
    .btn-primary {
        background-color: var(--primary-600) !important;
        border-color: var(--primary-600) !important;
        color: white !important;
    }

    .btn-success {
        background-color: var(--success-600) !important;
        border-color: var(--success-600) !important;
        color: white !important;
    }

    .btn-warning {
        background-color: var(--warning-600) !important;
        border-color: var(--warning-600) !important;
        color: var(--gray-900) !important;
    }

    .btn-danger {
        background-color: var(--danger-600) !important;
        border-color: var(--danger-600) !important;
        color: white !important;
    }

    /* List groups */
    .list-group-item {
        background-color: var(--gray-800) !important;
        border-color: var(--gray-700) !important;
        color: var(--gray-50) !important;
    }

    /* Tables */
    .table {
        color: var(--gray-50) !important;
    }

    .table thead {
        background-color: var(--gray-700) !important;
        color: var(--gray-50) !important;
    }

    .table tbody tr {
        background-color: var(--gray-800) !important;
        border-color: var(--gray-700) !important;
    }

    .table tbody tr:hover {
        background-color: var(--gray-700) !important;
    }

    /* Ensure all text is visible */
    h1,
    h2,
    h3,
    h4,
    h5,
    h6,
    p,
    span,
    div,
    label,
    a {
        color: var(--gray-50) !important;
    }

    /* Links */
    a {
        color: var(--primary-400) !important;
    }

    a:hover {
        color: var(--primary-300) !important;
    }

    /* Bottom menu */
    .fixed-bottom {
        background-color: var(--gray-900) !important;
        border-top-color: var(--gray-700) !important;
    }

    /* Modal/Dialog */
    .modal-content {
        background-color: var(--gray-800) !important;
        color: var(--gray-50) !important;
    }

    .modal-header {
        background-color: var(--gray-700) !important;
        border-bottom-color: var(--gray-600) !important;
    }

    .modal-footer {
        background-color: var(--gray-700) !important;
        border-top-color: var(--gray-600) !important;
    }

    /* Override gradient backgrounds in dark mode for better visibility */
    .card[style*="linear-gradient"] {
        background: var(--gray-700) !important;
    }

    /* Ensure text in gradient cards is visible */
    .card[style*="linear-gradient"] h1,
    .card[style*="linear-gradient"] h2,
    .card[style*="linear-gradient"] h3,
    .card[style*="linear-gradient"] h4,
    .card[style*="linear-gradient"] h5,
    .card[style*="linear-gradient"] h6,
    .card[style*="linear-gradient"] p,
    .card[style*="linear-gradient"] span {
        color: var(--gray-50) !important;
    }

    /* Ensure icons are visible */
    .bi {
        color: var(--gray-300) !important;
    }

    /* EXTREMELY AGGRESSIVE: Override ALL cards regardless of inline styles */
    .card.shadow-sm,
    .card.shadow-md,
    .card.shadow-lg {
        background: var(--gray-700) !important;
        background-color: var(--gray-700) !important;
        background-image: none !important;
    }

    /* Force ALL card text to be light colored */
    .card * {
        color: var(--gray-50) !important;
    }

    /* Override any inline color styles in dark mode */
    [style*="color"] {
        color: var(--gray-50) !important;
    }
}