/* ==========================================================================
   Apple-Grade Steve Jobs Aesthetic Theme for LubeLogger (v4 Final Precision)
   Features: Perfect Top Margin, Seamless Modal Inputs, Split Button Gap
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* --- Root Color Palette & Variables --- */
:root, [data-bs-theme="dark"], [data-bs-theme="light"] {
    --bs-font-sans-serif: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif !important;
    --bs-body-font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif !important;
    
    --bs-body-bg: #000000 !important;
    --bs-body-color: #f5f5f7 !important;
    
    --bs-primary: #0A84FF !important; /* Apple iOS System Blue */
    --bs-primary-rgb: 10, 132, 255;
    --bs-secondary: #8E8E93 !important;
    --bs-success: #30D158 !important; /* Apple System Green */
    --bs-info: #5E5CE6 !important;    /* Apple System Indigo */
    --bs-warning: #FF9F0A !important; /* Apple System Orange */
    --bs-danger: #FF453A !important;  /* Apple System Red */
    
    --bs-border-color: rgba(255, 255, 255, 0.12) !important;
    --bs-card-bg: rgba(28, 28, 30, 0.65) !important;
    --bs-card-border-color: rgba(255, 255, 255, 0.12) !important;
    --bs-modal-bg: rgba(30, 30, 32, 0.95) !important;
    --bs-modal-color: #ffffff !important;
    
    --bs-secondary-color: #A1A1A6 !important;
    --bs-tertiary-color: #8E8E93 !important;
    --bs-tertiary-bg: transparent !important;
    --bs-secondary-bg: transparent !important;
}

/* --- Global Background & Canvas --- */
html, body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif !important;
    background-color: #000000 !important;
    background-image: 
        radial-gradient(circle at 50% 0%, rgba(10, 132, 255, 0.12) 0%, transparent 55%),
        radial-gradient(circle at 100% 100%, rgba(94, 92, 230, 0.08) 0%, transparent 50%) !important;
    background-attachment: fixed !important;
    color: #f5f5f7 !important;
    -webkit-font-smoothing: antialiased !important;
    -moz-osx-font-smoothing: grayscale !important;
    min-height: 100vh;
}

/* --- Typography & High Contrast Overrides --- */
h1, h2, h3, h4, h5, h6, .h1, .h2, .h3, .h4, .h5, .h6, .card-title, .modal-title {
    color: #ffffff !important;
    font-weight: 700 !important;
    letter-spacing: -0.025em !important;
}

p, span, div, td, th {
    color: #f5f5f7 !important;
}

/* High Contrast Subtitles & Labels */
.text-muted, .text-secondary, small, .small, .form-text, .text-black-50, [class*="text-secondary"] {
    color: #CBD5E1 !important;
    font-weight: 400 !important;
}

/* --- FIX 1: Top Navigation Offset & Spacing --- */

/* Fixed Header Navbar */
.lubelogger-navbar-container, .navbar, header, nav, .frosted, html[data-bs-theme="dark"] .frosted, html[data-bs-theme="light"] .frosted {
    background: rgba(22, 22, 24, 0.88) !important;
    backdrop-filter: blur(25px) saturate(190%) !important;
    -webkit-backdrop-filter: blur(25px) saturate(190%) !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.12) !important;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.6) !important;
    z-index: 1050 !important;
}

/* CRITICAL FIX 1: Increased top padding (7.5rem = ~120px) so header NEVER overlaps buttons or badges */
.lubelogger-body-container {
    padding-top: 7.5rem !important; 
    padding-bottom: 3.5rem !important;
    max-width: 1350px !important;
    margin-left: auto !important;
    margin-right: auto !important;
    padding-left: 1.5rem !important;
    padding-right: 1.5rem !important;
}

.vehicleTabPane, .vehicleDetailTabContainer, .reportTabContainer, #garageContainer {
    padding-top: 1.5rem !important;
    margin-top: 0.5rem !important;
}

.vehicleTabPane {
    height: auto !important;
    min-height: calc(100vh - 10rem) !important;
}

/* Action Buttons & Badges Bar Spacing */
.vehicle-record-tab, .vehicle-tab-actions, .d-flex.justify-content-between.align-items-center {
    margin-bottom: 1.5rem !important;
    padding-top: 0.75rem !important;
    gap: 0.75rem !important;
}

/* --- FIX 2: Split Dropdown Button Spacing --- */
.btn-group {
    display: inline-flex !important;
    gap: 4px !important;
}

.btn-group > .btn {
    border-radius: 12px !important;
}

.btn-group > .btn:first-child {
    border-top-right-radius: 10px !important;
    border-bottom-right-radius: 10px !important;
}

.btn-group > .btn.dropdown-toggle-split {
    border-top-left-radius: 10px !important;
    border-bottom-left-radius: 10px !important;
    padding-left: 0.75rem !important;
    padding-right: 0.75rem !important;
}

.vehiclesContainer, .row {
    --bs-gutter-x: 1.5rem !important;
    --bs-gutter-y: 1.5rem !important;
}

/* --- FIX 3: Seamless Modal Form Controls & Input Groups (No Double Boxes) --- */

/* Remove outer grey box wrappers around form fields */
.modal-body .row > div, 
.modal-body .col-12, 
.modal-body .col-md-6,
.modal-body .mb-3,
.form-group,
[data-type="fieldOptionContainer"] {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
}

/* Remove outer border/bg from .input-group wrapper */
.input-group {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    display: flex !important;
    align-items: stretch !important;
}

/* Seamless input + addon styling */
.input-group > .form-control, 
.input-group > .form-select {
    border-top-right-radius: 0 !important;
    border-bottom-right-radius: 0 !important;
    border-right: none !important;
    background-color: rgba(255, 255, 255, 0.08) !important;
    border: 1px solid rgba(255, 255, 255, 0.15) !important;
    border-right: none !important;
    box-shadow: none !important;
}

.input-group-text, 
.input-group > .input-group-text, 
.input-group > .btn {
    border-top-left-radius: 0 !important;
    border-bottom-left-radius: 0 !important;
    border-radius: 0 12px 12px 0 !important;
    border: 1px solid rgba(255, 255, 255, 0.15) !important;
    border-left: none !important;
    background-color: rgba(255, 255, 255, 0.08) !important;
    color: #ffffff !important;
}

.input-group .btn-primary {
    background: #0A84FF !important;
    border-color: #0A84FF !important;
    color: #ffffff !important;
}

/* Tags Input Container Single Box Fix */
.bootstrap-tagsinput {
    width: 100% !important;
    background-color: rgba(255, 255, 255, 0.08) !important;
    border: 1px solid rgba(255, 255, 255, 0.15) !important;
    border-radius: 12px !important;
    box-shadow: none !important;
    padding: 0.5rem 0.75rem !important;
    min-height: 48px !important;
}

.bootstrap-tagsinput .tag {
    background: #0A84FF !important;
    color: #ffffff !important;
    border-radius: 6px !important;
    padding: 3px 8px !important;
}

/* Hide Awkward "Attach Link" Button */
.lubelogger-link-uploader {
    display: none !important;
}

.lubelogger-uploader {
    border: 2px dashed rgba(255, 255, 255, 0.2) !important;
    border-radius: 16px !important;
    padding: 1.5rem !important;
    background: rgba(255, 255, 255, 0.03) !important;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

.lubelogger-uploader:hover {
    border-color: #0A84FF !important;
    background: rgba(10, 132, 255, 0.08) !important;
}

/* Datepicker Popup Styling */
.datepicker, .datepicker-dropdown, .datepicker-picker {
    background-color: rgba(30, 30, 32, 0.95) !important;
    backdrop-filter: blur(25px) !important;
    border: 1px solid rgba(255, 255, 255, 0.15) !important;
    color: #ffffff !important;
    border-radius: 16px !important;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.7) !important;
}

.datepicker table tr td, .datepicker table tr th {
    color: #ffffff !important;
    border-radius: 8px !important;
}

.datepicker table tr td.day:hover, .datepicker table tr td.focused {
    background: #0A84FF !important;
}

/* --- Navbar Brand, Logos & Header Text --- */
.navbar-brand {
    font-weight: 700 !important;
    font-size: 1.25rem !important;
    letter-spacing: -0.03em !important;
    color: #ffffff !important;
}

.nav-link {
    color: #CBD5E1 !important;
    font-weight: 500 !important;
    font-size: 0.95rem !important;
    padding: 0.5rem 1rem !important;
    border-radius: 10px !important;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

.nav-link:hover, .nav-link.active {
    color: #ffffff !important;
    background: rgba(255, 255, 255, 0.12) !important;
}

.lubelogger-vehicle-logo, img[src*="noimage"] {
    border-radius: 12px !important;
    border: 1px solid rgba(255, 255, 255, 0.15) !important;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3) !important;
    object-fit: cover !important;
}

/* --- Apple Vehicle Cards & Glass Containers --- */
.card {
    background: rgba(28, 28, 30, 0.65) !important;
    backdrop-filter: blur(20px) saturate(180%) !important;
    -webkit-backdrop-filter: blur(20px) saturate(180%) !important;
    border: 1px solid rgba(255, 255, 255, 0.12) !important;
    border-radius: 20px !important;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.1) !important;
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1) !important;
    overflow: hidden !important;
}

.card:hover {
    transform: translateY(-6px) scale(1.015) !important;
    border-color: rgba(10, 132, 255, 0.5) !important;
    box-shadow: 0 20px 45px rgba(0, 0, 0, 0.6), 0 0 20px rgba(10, 132, 255, 0.25) !important;
}

.garage-item .card img {
    height: 175px !important;
    object-fit: cover !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
    filter: brightness(0.95) contrast(1.05) !important;
    transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

.garage-item .card:hover img {
    transform: scale(1.05) !important;
}

.garage-item .card-body {
    padding: 1.25rem 1.5rem !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 0.2rem !important;
    background: linear-gradient(180deg, rgba(28, 28, 30, 0.4) 0%, rgba(20, 20, 22, 0.85) 100%) !important;
}

.garage-item .card-body h5.garage-item-attribute {
    margin: 0 !important;
    padding: 0 !important;
    font-size: 1.35rem !important;
    font-weight: 700 !important;
    color: #ffffff !important;
    letter-spacing: -0.025em !important;
    display: inline-block !important;
}

.garage-item .card-body small.garage-item-year {
    order: -1 !important;
    font-size: 0.75rem !important;
    font-weight: 700 !important;
    color: #38BDF8 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.1em !important;
    margin-bottom: 0.25rem !important;
}

.garage-item .card-body small.card-text {
    margin-top: 0.6rem !important;
    display: inline-flex !important;
    align-items: center !important;
    align-self: flex-start !important;
    padding: 4px 10px !important;
    background: rgba(255, 255, 255, 0.08) !important;
    border: 1px solid rgba(255, 255, 255, 0.12) !important;
    border-radius: 8px !important;
    color: #f5f5f7 !important;
    font-weight: 600 !important;
    font-size: 0.8rem !important;
    letter-spacing: 0.05em !important;
    font-family: SFMono-Regular, Consolas, monospace !important;
}

.garage-item-add .card {
    border: 2px dashed rgba(255, 255, 255, 0.2) !important;
    border-radius: 20px !important;
    background: rgba(255, 255, 255, 0.03) !important;
    backdrop-filter: blur(15px) !important;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

.garage-item-add .card:hover {
    border-color: #0A84FF !important;
    background: rgba(10, 132, 255, 0.1) !important;
    box-shadow: 0 0 25px rgba(10, 132, 255, 0.2) !important;
    transform: translateY(-4px) !important;
}

/* --- Apple iOS Style Buttons --- */
.btn {
    border-radius: 12px !important;
    font-weight: 600 !important;
    font-size: 0.95rem !important;
    padding: 0.6rem 1.25rem !important;
    letter-spacing: -0.01em !important;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

.btn-primary {
    background: #0A84FF !important;
    border: none !important;
    color: #ffffff !important;
    box-shadow: 0 4px 15px rgba(10, 132, 255, 0.35) !important;
}

.btn-primary:hover, .btn-primary:focus {
    background: #0071E3 !important;
    box-shadow: 0 6px 20px rgba(10, 132, 255, 0.55) !important;
    transform: translateY(-1px) !important;
}

.btn-secondary, .btn-outline-secondary {
    background: rgba(255, 255, 255, 0.1) !important;
    border: 1px solid rgba(255, 255, 255, 0.12) !important;
    color: #f5f5f7 !important;
}

.btn-secondary:hover, .btn-outline-secondary:hover {
    background: rgba(255, 255, 255, 0.18) !important;
    color: #ffffff !important;
}

/* --- Inputs & Form Controls --- */
label, .form-label {
    color: #e2e8f0 !important;
    font-weight: 600 !important;
    font-size: 0.875rem !important;
    margin-bottom: 0.4rem !important;
}

.form-control, .form-select, input[type="text"], input[type="number"], select, textarea {
    background-color: rgba(255, 255, 255, 0.08) !important;
    border: 1px solid rgba(255, 255, 255, 0.15) !important;
    color: #ffffff !important;
    border-radius: 12px !important;
    padding: 0.65rem 1rem !important;
    font-size: 0.95rem !important;
    backdrop-filter: blur(10px) !important;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

.form-control:focus, .form-select:focus, input:focus, select:focus, textarea:focus {
    background-color: rgba(255, 255, 255, 0.12) !important;
    border-color: #0A84FF !important;
    box-shadow: 0 0 0 4px rgba(10, 132, 255, 0.25) !important;
    color: #ffffff !important;
}

/* --- Modals & Popups --- */
.modal-content, .swal2-popup, .swal2-modal {
    background: rgba(30, 30, 32, 0.95) !important;
    backdrop-filter: blur(30px) saturate(200%) !important;
    -webkit-backdrop-filter: blur(30px) saturate(200%) !important;
    border: 1px solid rgba(255, 255, 255, 0.15) !important;
    border-radius: 24px !important;
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.7) !important;
    color: #ffffff !important;
    padding: 1.5rem !important;
}

.modal-header, .modal-footer {
    border-color: rgba(255, 255, 255, 0.1) !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
}

/* --- Tables & Data Grid --- */
.table {
    --bs-table-bg: transparent !important;
    --bs-table-color: #f5f5f7 !important;
    color: #f5f5f7 !important;
    border-color: rgba(255, 255, 255, 0.08) !important;
    margin-bottom: 0 !important;
}

.table thead th {
    background: rgba(255, 255, 255, 0.04) !important;
    color: #CBD5E1 !important;
    text-transform: uppercase !important;
    font-size: 0.75rem !important;
    letter-spacing: 0.08em !important;
    font-weight: 700 !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.12) !important;
    padding: 14px 18px !important;
}

.table tbody tr {
    transition: background-color 0.2s ease !important;
}

.table tbody tr:hover {
    background-color: rgba(10, 132, 255, 0.12) !important;
}

.table td, .table th {
    padding: 14px 18px !important;
    vertical-align: middle !important;
}

/* --- Dropdown Menus & Context Menu --- */
.dropdown-menu, .garage-context-menu {
    background: rgba(32, 32, 35, 0.95) !important;
    backdrop-filter: blur(25px) saturate(190%) !important;
    -webkit-backdrop-filter: blur(25px) saturate(190%) !important;
    border: 1px solid rgba(255, 255, 255, 0.15) !important;
    border-radius: 16px !important;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.5) !important;
    padding: 8px !important;
}

.dropdown-item {
    color: #f5f5f7 !important;
    border-radius: 10px !important;
    padding: 8px 14px !important;
    font-size: 0.9rem !important;
    font-weight: 500 !important;
    transition: all 0.15s ease !important;
}

.dropdown-item:hover {
    background: #0A84FF !important;
    color: #ffffff !important;
}

.dropdown-divider {
    border-color: rgba(255, 255, 255, 0.1) !important;
    margin: 6px 0 !important;
}

/* --- Scrollbars --- */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.4);
}
