/**
 * Apple Liquid Glass Theme for Classic & Youngtimer Festival WebApp
 * Modern glassmorphism design with lightweight CSS only
 * Colors: #9a0005 (brand red), #333333 (text), white, neutral grays
 */

:root {
    /* Brand Colors */
    --brand-red: #9a0005;
    --brand-red-dark: #9a0005;
    --brand-red-light: #9a0005;
    --brand-red-hover: #9a0005;
    
    /* Neutral Colors */
    --text-primary: #333333;
    --text-secondary: #666666;
    --text-muted: #999999;
    --bg-white: #ffffff;
    --bg-light: #f8f9fa;
    --bg-glass: rgba(255, 255, 255, 0.7);
    --bg-glass-dark: rgba(255, 255, 255, 0.85);
    --border-glass: rgba(255, 255, 255, 0.3);
    --border-glass-dark: rgba(0, 0, 0, 0.1);
    
    /* Shadows */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.12);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.15);
    --shadow-glow: 0 0 20px rgba(154, 0, 5, 0.2);
    
    /* Spacing */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    
    /* Transitions */
    --transition-fast: 0.15s ease;
    --transition-base: 0.25s ease;
    --transition-slow: 0.35s ease;
}

/* ============================================
   BASE & TYPOGRAPHY
   ============================================ */

body {
    font-family: 'Rubik', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: linear-gradient(135deg, #f5f5f7 0%, #f8f9fa 50%, #f0f0f2 100%);
    background-attachment: fixed;
    color: var(--text-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    letter-spacing: -0.02em;
    color: var(--text-primary);
}

/* ============================================
   GLASSMORPHISM CARDS
   ============================================ */

.card {
    background: var(--bg-glass);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    transition: all var(--transition-base);
    overflow: hidden;
}

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

.card-header {
    background: var(--brand-red);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding: 1.25rem 1.5rem;
    font-weight: 600;
    color: white;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0 !important;
}

.card-header.bg-primary {
    background: var(--brand-red) !important;
}

.card-header.bg-success {
    background: linear-gradient(135deg, #28a745 0%, #218838 100%) !important;
}

.card-header.bg-warning {
    background: linear-gradient(135deg, #ffc107 0%, #e0a800 100%) !important;
    color: var(--text-primary);
}

.card-body {
    padding: 1.5rem;
    background: rgba(255, 255, 255, 0.5);
}

.card-footer {
    background: rgba(255, 255, 255, 0.3);
    border-top: 1px solid var(--border-glass-dark);
    padding: 1rem 1.5rem;
}

/* ============================================
   BUTTONS - Modern Glossy Style
   ============================================ */

.btn {
    border-radius: var(--radius-md);
    font-weight: 500;
    padding: 0.625rem 1.5rem;
    transition: all var(--transition-base);
    border: none;
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    touch-action: manipulation;
}

/* Ensure outline buttons inherit base button styles */
.btn-outline-primary,
.btn-outline-danger,
.btn-outline-info {
    font-weight: 500;
    transition: all var(--transition-base);
    position: relative;
    overflow: hidden;
    touch-action: manipulation;
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 50%;
    background: linear-gradient(to bottom, rgba(255, 255, 255, 0.2), transparent);
    pointer-events: none;
}

.btn-primary {
    background: var(--brand-red);
    color: white;
    box-shadow: var(--shadow-sm), inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.btn-primary:hover {
    background: var(--brand-red);
    color: white;
    box-shadow: var(--shadow-md), var(--shadow-glow);
    transform: translateY(-1px);
}

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

.btn-success {
    background: linear-gradient(135deg, #28a745 0%, #218838 100%);
    color: white;
}

.btn-success:hover {
    background: linear-gradient(135deg, #218838 0%, #1e7e34 100%);
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.btn-outline-primary {
    background: var(--bg-glass);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: var(--text-primary);
    border: 2px solid var(--text-primary);
}

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

.btn-outline-danger {
    background: var(--bg-glass);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: var(--brand-red);
    border: 2px solid var(--brand-red);
}

.btn-outline-danger:hover {
    background: var(--brand-red);
    color: white;
    border-color: var(--brand-red);
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.btn-outline-info {
    background: var(--bg-glass);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: #0dcaf0;
    border: 2px solid #0dcaf0;
}

.btn-outline-info:hover {
    background: #0dcaf0;
    color: white;
    border-color: #0dcaf0;
}

.btn-lg {
    padding: 0.875rem 2rem;
    font-size: 1.1rem;
    border-radius: var(--radius-lg);
}

.btn-sm {
    padding: 0.375rem 1rem !important;
    font-size: 0.875rem !important;
    border-radius: var(--radius-sm) !important;
}

/* Ensure outline buttons with btn-sm have consistent styling */
.btn-outline-primary.btn-sm,
.btn-outline-danger.btn-sm,
.btn-outline-info.btn-sm {
    padding: 0.375rem 1rem !important;
    font-size: 0.875rem !important;
    border-radius: var(--radius-sm) !important;
}

/* ============================================
   FORM INPUTS - Clean & Touch-Friendly
   ============================================ */

.form-control,
.form-select {
    background: var(--bg-glass-dark);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1.5px solid var(--border-glass-dark);
    border-radius: var(--radius-md);
    padding: 0.75rem 1rem;
    font-size: 16px; /* Prevents zoom on iOS */
    transition: all var(--transition-base);
    color: var(--text-primary);
}

.form-control:focus,
.form-select:focus {
    background: white;
    border-color: var(--brand-red);
    box-shadow: 0 0 0 3px rgba(154, 0, 5, 0.1), var(--shadow-sm);
    outline: none;
}

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

.form-label {
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

/* ============================================
   NAVBAR - Glass Header
   ============================================ */

.navbar {
    background: var(--brand-red) !important;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: var(--shadow-lg);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding: 0.75rem 0;
}

.navbar-brand {
    font-weight: 600;
    font-size: 1.25rem;
    color: white !important;
}

.navbar-brand img {
    height: 40px;
    margin-right: 10px;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
}

.navbar-nav .nav-link {
    color: rgba(255, 255, 255, 0.9);
    padding: 0.5rem 1rem;
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
}

.navbar-nav .nav-link:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

/* ============================================
   SIDEBAR - Elegant Navigation
   ============================================ */

.sidebar {
    background: var(--bg-glass);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    padding: 1.5rem;
    min-height: calc(100vh - 56px);
}

.sidebar .nav-link {
    color: var(--text-primary);
    padding: 0.75rem 1rem;
    border-radius: var(--radius-md);
    margin-bottom: 0.5rem;
    transition: all var(--transition-base);
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.sidebar .nav-link i {
    font-size: 1.1rem;
    width: 20px;
    text-align: center;
}

.sidebar .nav-link:hover {
    background: rgba(154, 0, 5, 0.1);
    color: var(--brand-red);
    transform: translateX(4px);
}

.sidebar .nav-link.active {
    background: var(--brand-red);
    color: white;
    box-shadow: var(--shadow-sm);
}

.sidebar .nav-link.active:hover {
    transform: translateX(0);
}

/* ============================================
   ALERTS - iOS-like Banners
   ============================================ */

.alert {
    border-radius: var(--radius-lg);
    border: none;
    padding: 1rem 1.5rem;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: var(--shadow-sm);
    font-weight: 500;
}

.alert-success {
    background: linear-gradient(135deg, rgba(40, 167, 69, 0.15) 0%, rgba(40, 167, 69, 0.25) 100%);
    color: #155724;
    border-left: 4px solid #28a745;
}

.alert-danger {
    background: linear-gradient(135deg, rgba(220, 53, 69, 0.15) 0%, rgba(220, 53, 69, 0.25) 100%);
    color: #721c24;
    border-left: 4px solid #dc3545;
}

.alert-warning {
    background: linear-gradient(135deg, rgba(255, 193, 7, 0.15) 0%, rgba(255, 193, 7, 0.25) 100%);
    color: #856404;
    border-left: 4px solid #ffc107;
}

.alert-info {
    background: linear-gradient(135deg, rgba(13, 202, 240, 0.15) 0%, rgba(13, 202, 240, 0.25) 100%);
    color: #0c5460;
    border-left: 4px solid #0dcaf0;
}

/* Permanent alerts - do not auto-hide */
.alert-permanent {
    opacity: 1 !important;
}

.alert-info.alert-permanent {
    background: linear-gradient(135deg, rgba(13, 202, 240, 0.25) 0%, rgba(13, 202, 240, 0.35) 100%);
    border-left: 4px solid #0dcaf0;
    font-weight: 500;
}

/* ============================================
   TABLES - Clean & Readable
   ============================================ */

.table {
    background: var(--bg-glass-dark);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.table thead {
    background: linear-gradient(135deg, rgba(154, 0, 5, 0.1) 0%, rgba(154, 0, 5, 0.05) 100%);
}

.table thead th {
    border-bottom: 2px solid var(--border-glass-dark);
    font-weight: 600;
    color: var(--text-primary);
    padding: 1rem;
}

.table tbody tr {
    transition: all var(--transition-fast);
    border-bottom: 1px solid var(--border-glass-dark);
}

.table tbody tr:hover {
    background: rgba(154, 0, 5, 0.05);
}

.table tbody td {
    padding: 1rem;
    vertical-align: middle;
}

/* ============================================
   BADGES - Modern Pills
   ============================================ */

.badge {
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius-md);
    font-weight: 500;
    font-size: 0.875rem;
}

.badge.bg-primary,
.badge.bg-success,
.badge.bg-danger,
.badge.bg-warning {
    box-shadow: var(--shadow-sm);
}

.badge.bg-light {
    background: var(--bg-glass) !important;
    color: var(--text-primary) !important;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

/* ============================================
   MODALS - Glass Overlay
   ============================================ */

.modal {
    z-index: 1055;
}

.modal-backdrop {
    z-index: 1050;
    background-color: rgba(0, 0, 0, 0.5);
}

.modal-dialog {
    margin: 1.75rem auto;
    max-width: 500px;
}

.modal-dialog-centered {
    display: flex;
    align-items: center;
    min-height: calc(100% - 3.5rem);
}

.modal-content {
    background: var(--bg-glass-dark);
    backdrop-filter: blur(30px) saturate(180%);
    -webkit-backdrop-filter: blur(30px) saturate(180%);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    position: relative;
    display: flex;
    flex-direction: column;
    width: 100%;
    pointer-events: auto;
    max-height: 90vh;
    overflow: hidden;
}

.modal-header {
    border-bottom: 1px solid var(--border-glass-dark);
    padding: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.modal-title {
    margin: 0;
    line-height: 1.5;
}

.modal-body {
    padding: 1.5rem;
    position: relative;
    flex: 1 1 auto;
    overflow-y: auto;
}

.modal-footer {
    border-top: 1px solid var(--border-glass-dark);
    padding: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.5rem;
    flex-shrink: 0;
}

/* ============================================
   UTILITY CLASSES
   ============================================ */

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

.bg-primary {
    background-color: var(--brand-red) !important;
}

.main-content {
    padding: 1.5rem;
}

/* ============================================
   RESPONSIVE ADJUSTMENTS
   ============================================ */

@media (max-width: 768px) {
    .sidebar {
        min-height: auto;
        margin-bottom: 1.5rem;
        border-radius: var(--radius-md);
    }
    
    .card {
        border-radius: var(--radius-md);
    }
    
    .btn {
        padding: 0.75rem 1.25rem;
    }
    
    .main-content {
        padding: 1rem;
    }
}

@media (max-width: 576px) {
    .table {
        font-size: 0.875rem;
    }
    
    .card-body {
        padding: 1rem;
    }
    
    .card-header {
        padding: 1rem;
    }
}

/* ============================================
   PERFORMANCE OPTIMIZATIONS
   ============================================ */

/* Reduce blur on low-end devices */
@media (prefers-reduced-motion: reduce) {
    * {
        transition: none !important;
        animation: none !important;
    }
}

/* Fallback for browsers without backdrop-filter support */
@supports not (backdrop-filter: blur(10px)) {
    .card,
    .sidebar,
    .form-control,
    .form-select {
        background: var(--bg-white);
    }
}

/* ============================================
   ACCESSIBILITY
   ============================================ */

.btn:focus-visible,
.form-control:focus-visible,
.form-select:focus-visible {
    outline: 3px solid rgba(154, 0, 5, 0.5);
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .card {
        border: 2px solid var(--text-primary);
    }
    
    .btn {
        border: 2px solid currentColor;
    }
}

/* ============================================
   APP-SPECIFIC ELEMENTS
   ============================================ */

/* Logo filter for form pages - removed */

/* Badge mode indicator */
.badge-mode {
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
}

/* Navbar text badges */
.navbar-text {
    color: rgba(255, 255, 255, 0.9) !important;
}

/* Container adjustments */
.container-fluid {
    max-width: 100%;
}

/* Card hover effects for interactive cards */
.card[data-bs-toggle],
.card[role="button"] {
    cursor: pointer;
}

.card[data-bs-toggle]:hover,
.card[role="button"]:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

/* Form groups spacing */
.form-group,
.mb-3 {
    margin-bottom: 1.25rem;
}

/* Input groups */
.input-group .form-control,
.input-group .form-select {
    border-radius: var(--radius-md);
}

.input-group-text {
    background: var(--bg-glass);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1.5px solid var(--border-glass-dark);
    border-radius: var(--radius-md);
}

/* Dropdown menus */
.dropdown-menu {
    background: var(--bg-glass-dark);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    padding: 0.5rem;
}

.dropdown-item {
    border-radius: var(--radius-sm);
    padding: 0.5rem 1rem;
    transition: all var(--transition-fast);
}

.dropdown-item:hover {
    background: rgba(154, 0, 5, 0.1);
    color: var(--brand-red);
}

.dropdown-item.active {
    background: var(--brand-red);
    color: white;
}

/* Pagination */
.pagination .page-link {
    background: var(--bg-glass);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--border-glass-dark);
    color: var(--text-primary);
    border-radius: var(--radius-sm);
    margin: 0 0.25rem;
}

.pagination .page-link:hover {
    background: rgba(154, 0, 5, 0.1);
    border-color: var(--brand-red);
    color: var(--brand-red);
}

.pagination .page-item.active .page-link {
    background: var(--brand-red);
    border-color: var(--brand-red);
    color: white;
}

/* List groups */
.list-group-item {
    background: var(--bg-glass);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--border-glass-dark);
    border-radius: var(--radius-md) !important;
    margin-bottom: 0.5rem;
}

.list-group-item.active {
    background: var(--brand-red);
    border-color: var(--brand-red);
    color: white;
}

/* Progress bars */
.progress {
    background: var(--bg-glass);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: var(--radius-md);
    height: 0.75rem;
}

.progress-bar {
    background: var(--brand-red);
    border-radius: var(--radius-md);
}

/* Tooltips */
.tooltip .tooltip-inner {
    background: var(--text-primary);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: var(--radius-sm);
    padding: 0.5rem 0.75rem;
}

/* Popovers */
.popover {
    background: var(--bg-glass-dark);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
}

.popover-header {
    background: linear-gradient(135deg, rgba(154, 0, 5, 0.1) 0%, rgba(154, 0, 5, 0.05) 100%);
    border-bottom: 1px solid var(--border-glass-dark);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

/* Loading states */
.spinner-border,
.spinner-grow {
    color: var(--brand-red);
}

/* Disabled states */
.btn:disabled,
.form-control:disabled,
.form-select:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Print styles */
@media print {
    .card,
    .sidebar,
    .navbar {
        box-shadow: none;
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
        background: white;
    }
}

