/**
 * Driver Profile Page Styles
 * Mobile-responsive tables and enhanced UI components
 */

/* Profile Card Responsive */
@media (max-width: 575.98px) {
    .driver-profile-card .d-flex {
        flex-direction: column;
        text-align: center;
    }

    .driver-profile-card .flex-shrink-0 {
        margin-right: 0 !important;
        margin-bottom: 1rem;
    }
}

/* Charts Section */
#charts .card {
    min-height: 280px;
}

#charts canvas {
    max-height: 220px;
}

@media (max-width: 767.98px) {
    #charts .col-md-8,
    #charts .col-md-4 {
        margin-bottom: 1rem;
    }

    #charts .card {
        min-height: auto;
    }
}

/* Favorite Cards */
.alert.border-start {
    transition: transform 0.2s ease;
}

.alert.border-start:hover {
    transform: translateX(4px);
}

/* Tables Mobile Responsiveness */
@media (max-width: 991.98px) {
    /* Hide less important columns on tablets */
    .driver-profile-table .col-brand,
    .driver-profile-table .col-unique {
        display: none;
    }
}

@media (max-width: 767.98px) {
    /* Hide more columns on mobile */
    .driver-profile-table .col-percent,
    .driver-profile-table .col-date {
        display: none;
    }

    /* Reduce font size */
    .driver-profile-table td,
    .driver-profile-table th {
        font-size: 0.85rem;
        padding: 0.5rem 0.4rem;
    }

    /* Compact table */
    .table-responsive {
        font-size: 0.9rem;
    }
}

@media (max-width: 575.98px) {
    /* Very small screens - card layout */
    .driver-profile-table thead {
        display: none;
    }

    .driver-profile-table tbody tr {
        display: block;
        margin-bottom: 0.5rem;
        padding: 0.75rem;
        background: var(--bs-card-bg, #fff);
        border: 1px solid var(--bs-border-color, #d9dee3);
        border-radius: 0.375rem;
    }

    .driver-profile-table tbody td {
        display: flex;
        justify-content: space-between;
        padding: 0.25rem 0;
        border: none;
    }

    .driver-profile-table tbody td::before {
        content: attr(data-label);
        font-weight: 600;
        color: var(--bs-heading-color, #566a7f);
        margin-right: 0.5rem;
    }

    .driver-profile-table tbody td:first-child {
        display: none;
    }
}

/* Quick Navigation */
.quick-nav .btn {
    white-space: nowrap;
}

@media (max-width: 575.98px) {
    .quick-nav .d-flex {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }

    .quick-nav .d-flex::-webkit-scrollbar {
        display: none;
    }

    .quick-nav .btn {
        flex-shrink: 0;
    }
}

/* Stats Cards */
@media (max-width: 767.98px) {
    #stats .col-md-3 {
        flex: 0 0 50%;
        max-width: 50%;
    }
}

@media (max-width: 575.98px) {
    #stats .col-md-3 {
        flex: 0 0 100%;
        max-width: 100%;
    }

    #stats .d-flex.align-items-center {
        padding: 0.5rem;
        background: var(--bs-light, #f5f5f9);
        border-radius: 0.375rem;
        margin-bottom: 0.5rem !important;
    }
}

/* Pagination Mobile */
@media (max-width: 575.98px) {
    .pagination .page-link {
        padding: 0.375rem 0.5rem;
        font-size: 0.8rem;
    }

    .pagination .page-item:not(.active):not(:first-child):not(:last-child) {
        display: none;
    }

    .pagination .page-item:nth-child(2),
    .pagination .page-item:nth-last-child(2) {
        display: block;
    }
}

/* Lap Time Styling */
.lap-time {
    font-family: 'Roboto Mono', monospace;
    font-weight: 500;
}

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

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .driver-profile-table tbody tr {
        background: var(--bs-dark-bg-subtle, #2b2c40);
    }
}

[data-bs-theme="dark"] .driver-profile-table tbody tr {
    background: var(--bs-dark-bg-subtle, #2b2c40);
}

/* ============================================
   Lap Details Page Styles
   ============================================ */

/* Hero block styling */
.bg-white-50 {
    background-color: rgba(255, 255, 255, 0.2) !important;
}

/* Lap time font */
.lap-time {
    font-family: 'Roboto Mono', monospace;
    font-weight: 500;
    letter-spacing: -0.5px;
}

/* Progress bars for sectors */
.progress {
    border-radius: 0.5rem;
    overflow: hidden;
}

.progress-bar {
    transition: width 0.6s ease;
}

/* Info cards hover effect */
.col-md-4 .card {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.col-md-4 .card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* Technical details cards */
.bg-light.rounded,
.bg-warning-subtle.rounded,
.bg-danger-subtle.rounded,
.bg-success-subtle.rounded {
    transition: transform 0.2s ease;
}

.bg-light.rounded:hover,
.bg-warning-subtle.rounded:hover,
.bg-danger-subtle.rounded:hover,
.bg-success-subtle.rounded:hover {
    transform: scale(1.02);
}

/* Best laps table - current row highlight */
.table-primary {
    --bs-table-bg: rgba(105, 108, 255, 0.15);
    border-left: 3px solid var(--bs-primary) !important;
}

/* Crown badge animation */
.badge .ti-crown {
    animation: crown-shine 2s ease-in-out infinite;
}

@keyframes crown-shine {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
}

/* Lap Details Mobile Responsiveness */
@media (max-width: 767.98px) {
    /* Hero block adjustments */
    .card.bg-primary .display-4 {
        font-size: 2.5rem;
    }

    .card.bg-primary .card-body {
        padding: 2rem 1rem;
    }

    /* Info cards stack better */
    .col-md-4 .card .card-body {
        padding: 0.75rem;
    }

    /* Technical details grid */
    .col-lg-6 .row.g-3 .col-sm-6 {
        flex: 0 0 100%;
        max-width: 100%;
    }

    /* Breadcrumbs wrap */
    .breadcrumb {
        flex-wrap: wrap;
        font-size: 0.85rem;
    }
}

@media (max-width: 575.98px) {
    /* Even smaller hero on very small screens */
    .card.bg-primary .display-4 {
        font-size: 2rem;
    }

    .card.bg-primary .badge {
        font-size: 0.7rem;
        padding: 0.35rem 0.5rem;
    }

    /* Stack header elements */
    .d-flex.justify-content-between.align-items-center.py-4 {
        flex-direction: column;
        align-items: flex-start !important;
        gap: 0.5rem;
    }

    .d-flex.justify-content-between.align-items-center.py-4 > div:last-child {
        align-self: flex-start;
    }

    /* Compact table on mobile */
    .table th,
    .table td {
        padding: 0.5rem;
        font-size: 0.85rem;
    }

    /* Hide delta column on very small screens */
    .table th:nth-child(3),
    .table td:nth-child(3) {
        display: none;
    }
}

/* Dark mode adjustments for lap details */
[data-bs-theme="dark"] .bg-light.rounded {
    background-color: var(--bs-dark-bg-subtle) !important;
}

[data-bs-theme="dark"] .bg-warning-subtle.rounded {
    background-color: rgba(255, 171, 0, 0.15) !important;
}

[data-bs-theme="dark"] .bg-danger-subtle.rounded {
    background-color: rgba(255, 62, 29, 0.15) !important;
}

[data-bs-theme="dark"] .bg-success-subtle.rounded {
    background-color: rgba(113, 221, 55, 0.15) !important;
}
