/* ============================================
   MOTORISTI.EU - Bootstrap 5 Custom Theme
   ============================================ */

/* Override Bootstrap variables with Motoristi branding */
:root {
    /* Primary colors - Motoristi Orange */
    --bs-primary: #ff6b35;
    --bs-primary-rgb: 255, 107, 53;
    --bs-secondary: #e55a2b;
    --bs-secondary-rgb: 229, 90, 43;
    
    /* Dark theme colors */
    --bs-dark: #0f0f23;
    --bs-dark-rgb: 15, 15, 35;
    --bs-body-bg: #0f0f23;
    --bs-body-color: #ffffff;
    
    /* Borders and surfaces */
    --bs-border-color: #404040;
    --bs-border-color-translucent: rgba(255, 255, 255, 0.1);
    
    /* Link colors */
    --bs-link-color: #ff6b35;
    --bs-link-hover-color: #ff8c42;
    
    /* Border radius - keep existing style */
    --bs-border-radius: 12px;
    --bs-border-radius-sm: 8px;
    --bs-border-radius-lg: 16px;
    
    /* Spacing */
    --bs-gutter-x: 1.5rem;
}

/* ============================================
   PRESERVE CUSTOM BUTTONS
   ============================================ */
.btn-primary,
.login-btn,
.btn-submit {
    background: linear-gradient(135deg, #ff6b35, #e55a2b) !important;
    border: none !important;
    color: white !important;
    font-weight: 600 !important;
    border-radius: 12px !important;
    padding: 12px 24px !important;
    transition: all 0.3s ease !important;
    box-shadow: 0 4px 12px rgba(255, 107, 53, 0.3) !important;
}

.btn-primary:hover,
.login-btn:hover,
.btn-submit:hover {
    background: linear-gradient(135deg, #e55a2b, #d14920) !important;
    transform: translateY(-2px) !important;
    box-shadow: 0 6px 16px rgba(255, 107, 53, 0.4) !important;
}

.btn-primary:active,
.login-btn:active,
.btn-submit:active {
    transform: translateY(0) !important;
}

/* Secondary button style */
.btn-secondary {
    background: rgba(255, 255, 255, 0.1) !important;
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
    color: white !important;
    border-radius: 12px !important;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.15) !important;
    border-color: var(--bs-primary) !important;
}

/* ============================================
   CARDS WITH MOTORISTI STYLING
   ============================================ */
.card {
    background: rgba(255, 255, 255, 0.03) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    border-radius: 12px !important;
    transition: all 0.3s ease !important;
    backdrop-filter: blur(10px);
}

.card:hover {
    border-color: var(--bs-primary) !important;
    box-shadow: 0 4px 12px rgba(255, 107, 53, 0.2) !important;
    transform: translateY(-4px) !important;
}

.card-header {
    background: rgba(255, 107, 53, 0.1) !important;
    border-bottom: 1px solid rgba(255, 107, 53, 0.3) !important;
    color: #ff6b35 !important;
    font-weight: 600;
}

.card-body {
    color: rgba(255, 255, 255, 0.9);
}

/* ============================================
   FORMS - TOUCH FRIENDLY
   ============================================ */
.form-control,
.form-select {
    background: rgba(255, 255, 255, 0.05) !important;
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
    border-radius: 8px !important;
    color: #e0e0e0 !important;
    padding: 12px 16px !important;
    font-size: 1rem !important;
    min-height: 48px; /* Touch-friendly */
}

.form-control:focus,
.form-select:focus {
    background: rgba(255, 255, 255, 0.08) !important;
    border-color: var(--bs-primary) !important;
    box-shadow: 0 0 0 0.25rem rgba(255, 107, 53, 0.25) !important;
    color: white !important;
}

.form-control::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

.form-label {
    color: rgba(255, 255, 255, 0.9);
    font-weight: 500;
    margin-bottom: 0.5rem;
}

/* ============================================
   MODALS - PRESERVE CUSTOM STYLING
   ============================================ */
.modal-content {
    background: #1a1a2e !important;
    border: 2px solid var(--bs-primary) !important;
    border-radius: 12px !important;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5) !important;
}

.modal-header {
    border-bottom: 1px solid rgba(255, 107, 53, 0.3) !important;
    background: rgba(255, 107, 53, 0.1);
}

.modal-title {
    color: #ff6b35 !important;
    font-weight: 600;
}

.modal-body {
    color: rgba(255, 255, 255, 0.9);
}

.modal-footer {
    border-top: 1px solid rgba(255, 107, 53, 0.3) !important;
}

.btn-close {
    filter: invert(1);
}

/* ============================================
   TABLES - RESPONSIVE & STYLED
   ============================================ */
.table {
    color: rgba(255, 255, 255, 0.9) !important;
    border-color: rgba(255, 255, 255, 0.1) !important;
}

.table-dark {
    --bs-table-bg: rgba(255, 255, 255, 0.03);
    --bs-table-border-color: rgba(255, 255, 255, 0.1);
}

.table-hover tbody tr:hover {
    background: rgba(255, 107, 53, 0.1) !important;
    cursor: pointer;
}

.table thead {
    background: rgba(255, 107, 53, 0.2);
    border-bottom: 2px solid var(--bs-primary);
}

.table thead th {
    color: #ff6b35 !important;
    font-weight: 600;
    border: none !important;
    padding: 1rem;
}

/* Mobile table cards */
@media (max-width: 768px) {
    .table-responsive {
        border: 1px solid rgba(255, 255, 255, 0.1);
        border-radius: 12px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
}

/* ============================================
   OFFCANVAS - MOBILE MENU REPLACEMENT
   ============================================ */
.offcanvas {
    background: #0f0f23 !important;
    border-left: 2px solid var(--bs-primary) !important;
}

.offcanvas-header {
    border-bottom: 1px solid rgba(255, 107, 53, 0.3);
}

.offcanvas-title {
    color: #ff6b35;
    font-weight: 600;
}

.offcanvas-body {
    padding: 1.5rem;
}

/* ============================================
   NAVIGATION - TOUCH FRIENDLY
   ============================================ */
.nav-link {
    color: rgba(255, 255, 255, 0.8) !important;
    padding: 12px 20px !important;
    border-radius: 8px !important;
    transition: all 0.3s ease !important;
    font-weight: 500;
    min-height: 44px; /* Touch target */
    display: flex;
    align-items: center;
}

.nav-link:hover,
.nav-link.active {
    color: white !important;
    background: rgba(255, 107, 53, 0.2) !important;
}

/* Remove left border - only show bottom border on hover */
.nav-link.active {
    border-left: none;
}

/* ============================================
   BADGES & ALERTS
   ============================================ */
.badge {
    border-radius: 6px;
    padding: 0.35em 0.65em;
    font-weight: 600;
}

.badge.bg-primary {
    background: linear-gradient(135deg, #ff6b35, #e55a2b) !important;
}

.alert {
    border-radius: 12px;
    border: none;
    backdrop-filter: blur(10px);
}

.alert-primary {
    background: rgba(255, 107, 53, 0.2) !important;
    color: #ff8c42 !important;
    border-left: 4px solid var(--bs-primary);
}

.alert-success {
    background: rgba(76, 175, 80, 0.2) !important;
    color: #81c784 !important;
    border-left: 4px solid #4caf50;
}

.alert-danger {
    background: rgba(244, 67, 54, 0.2) !important;
    color: #e57373 !important;
    border-left: 4px solid #f44336;
}

/* ============================================
   DROPDOWNS
   ============================================ */
.dropdown-menu {
    background: #1e1e2e !important;
    border: 1px solid rgba(255, 107, 53, 0.3) !important;
    border-radius: 12px !important;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3) !important;
    backdrop-filter: blur(10px);
}

.dropdown-item {
    color: rgba(255, 255, 255, 0.9) !important;
    padding: 12px 20px !important;
    border-radius: 8px !important;
    margin: 4px 8px;
    transition: all 0.2s ease;
}

.dropdown-item:hover {
    background: rgba(255, 107, 53, 0.2) !important;
    color: white !important;
}

.dropdown-item.active {
    background: var(--bs-primary) !important;
}

/* ============================================
   PAGINATION
   ============================================ */
.pagination {
    gap: 0.5rem;
}

.page-link {
    background: rgba(255, 255, 255, 0.05) !important;
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
    color: rgba(255, 255, 255, 0.9) !important;
    border-radius: 8px !important;
    padding: 0.5rem 1rem;
    min-width: 44px; /* Touch-friendly */
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.page-link:hover {
    background: rgba(255, 107, 53, 0.2) !important;
    border-color: var(--bs-primary) !important;
    color: white !important;
}

.page-item.active .page-link {
    background: var(--bs-primary) !important;
    border-color: var(--bs-primary) !important;
}

/* ============================================
   LIST GROUPS
   ============================================ */
.list-group-item {
    background: rgba(255, 255, 255, 0.03) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    color: rgba(255, 255, 255, 0.9) !important;
    border-radius: 8px !important;
    margin-bottom: 0.5rem;
    transition: all 0.3s ease;
}

.list-group-item:hover {
    background: rgba(255, 107, 53, 0.1) !important;
    border-color: var(--bs-primary) !important;
}

.list-group-item.active {
    background: var(--bs-primary) !important;
    border-color: var(--bs-primary) !important;
}

/* ============================================
   TOOLTIPS & POPOVERS
   ============================================ */
.tooltip-inner {
    background: #1e1e2e;
    color: white;
    border: 1px solid rgba(255, 107, 53, 0.3);
}

.tooltip.bs-tooltip-top .tooltip-arrow::before {
    border-top-color: #1e1e2e;
}

/* ============================================
   ACCORDION
   ============================================ */
.accordion-item {
    background: rgba(255, 255, 255, 0.03) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    border-radius: 12px !important;
    margin-bottom: 1rem;
}

.accordion-button {
    background: rgba(255, 107, 53, 0.1) !important;
    color: white !important;
    border-radius: 12px !important;
    font-weight: 600;
}

.accordion-button:not(.collapsed) {
    background: rgba(255, 107, 53, 0.2) !important;
    color: #ff6b35 !important;
    box-shadow: none !important;
}

.accordion-button:focus {
    box-shadow: 0 0 0 0.25rem rgba(255, 107, 53, 0.25) !important;
}

.accordion-body {
    color: rgba(255, 255, 255, 0.9);
}

/* ============================================
   SPINNERS & LOADING
   ============================================ */
.spinner-border,
.spinner-grow {
    color: var(--bs-primary);
}

/* ============================================
   RESPONSIVE UTILITIES
   ============================================ */

/* Container adjustments */
@media (min-width: 1400px) {
    .container-xxl {
        max-width: 1320px;
    }
}

/* Mobile optimizations */
@media (max-width: 768px) {
    .card {
        margin-bottom: 1rem;
    }
    
    .btn {
        width: 100%;
        margin-bottom: 0.5rem;
    }
    
    .btn-group {
        width: 100%;
        flex-direction: column;
    }
    
    .btn-group .btn {
        border-radius: 12px !important;
    }
    
    /* Stack columns on mobile */
    .row > [class*='col-'] {
        margin-bottom: 1rem;
    }
}

/* Touch-friendly sizing */
@media (hover: none) and (pointer: coarse) {
    .btn {
        min-height: 44px;
        padding: 12px 20px !important;
    }
    
    .form-control,
    .form-select {
        min-height: 48px;
        font-size: 16px !important; /* Prevents zoom on iOS */
    }
    
    .nav-link {
        min-height: 48px;
    }
}

/* ============================================
   PRESERVE EXISTING THEME SYSTEM
   ============================================ */

/* Light theme overrides */
body[data-theme*="-light"] {
    --bs-body-bg: #ffffff;
    --bs-body-color: #1a1a1a;
    --bs-border-color: #e0e0e0;
}

body[data-theme*="-light"] .card {
    background: rgba(0, 0, 0, 0.03) !important;
    border: 1px solid rgba(0, 0, 0, 0.1) !important;
}

body[data-theme*="-light"] .form-control,
body[data-theme*="-light"] .form-select {
    background: rgba(0, 0, 0, 0.05) !important;
    border: 1px solid rgba(0, 0, 0, 0.2) !important;
    color: #1a1a1a !important;
}

body[data-theme*="-light"] .table {
    color: #1a1a1a !important;
}

body[data-theme*="-light"] .modal-content {
    background: #ffffff !important;
}

body[data-theme*="-light"] .offcanvas {
    background: #ffffff !important;
}

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

/* Smooth scrolling */
html {
    scroll-behavior: smooth;
}

/* GPU acceleration for transforms */
.card,
.btn,
.nav-link {
    will-change: transform;
    transform: translateZ(0);
}

/* Reduce motion for accessibility */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
