/**
 * Vehicle Log Book - Styles
 * 
 * Modern, mobile-first, minimalist design
 * Designed to feel like a PWA/mobile web app
 */

/* ===================
   CSS VARIABLES
   =================== */
:root {
    /* Stitch Design Color Palette */
    --vlb-bg-app: #0f1923;
    /* background-dark */
    --vlb-bg-card: #1E1E1E;
    /* card-dark */
    --vlb-bg-input: #111827;
    /* darker input bg */

    --vlb-primary: #359EFF;
    /* primary */
    --vlb-primary-hover: #2563eb;
    --vlb-primary-gradient: linear-gradient(135deg, #359EFF 0%, #2563eb 100%);

    --vlb-secondary: #9CA3AF;
    /* text-dark-secondary */
    --vlb-secondary-bg: #374151;
    /* border-dark */

    --vlb-success: #10b981;
    --vlb-success-gradient: linear-gradient(135deg, #10b981 0%, #059669 100%);
    --vlb-warning: #f59e0b;
    --vlb-danger: #ef4444;
    --vlb-danger-gradient: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);

    /* Text */
    --vlb-text-main: #E5E7EB;
    /* text-dark-primary */
    --vlb-text-muted: #9CA3AF;
    /* text-dark-secondary */
    --vlb-text-inverse: #1F2937;

    /* Borders & Shadows */
    --vlb-border: #374151;
    /* border-dark */
    --vlb-shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --vlb-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --vlb-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);

    /* Spacing & Radius */
    --vlb-radius: 0.5rem;
    /* rounded-lg */
    --vlb-radius-sm: 0.25rem;
    /* rounded */
    --vlb-spacing: 1.5rem;
    /* p-6 */

    /* Typography */
    --vlb-font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* ===================
   GLOBAL RESETS
   =================== */
.vlb-app-container *,
.vlb-login-container *,
.vlb-modal * {
    box-sizing: border-box;
}

/* ===================
   LOGIN PAGE
   =================== */
.vlb-login-container {
    min-height: 80vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--vlb-spacing);
    font-family: var(--vlb-font-family);
}

.vlb-login-card {
    background: #fff;
    border-radius: var(--vlb-radius);
    box-shadow: var(--vlb-shadow-lg);
    padding: 40px;
    width: 100%;
    max-width: 420px;
}

.vlb-login-header {
    text-align: center;
    margin-bottom: 30px;
}

.vlb-login-header h2 {
    margin: 0 0 10px;
    color: var(--vlb-dark);
    font-size: 28px;
    font-weight: 600;
}

.vlb-login-header p {
    margin: 0;
    color: var(--vlb-secondary);
    font-size: 14px;
}

.vlb-error-message {
    background: #ffe6e6;
    border: 1px solid var(--vlb-danger);
    color: var(--vlb-danger);
    padding: 12px;
    border-radius: var(--vlb-radius-sm);
    margin-bottom: 20px;
    font-size: 14px;
}

.vlb-login-form .vlb-form-group {
    margin-bottom: 20px;
}

.vlb-login-form label {
    display: block;
    margin-bottom: 8px;
    color: var(--vlb-dark);
    font-weight: 500;
    font-size: 14px;
}

.vlb-login-form input[type="text"],
.vlb-login-form input[type="password"] {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--vlb-border);
    border-radius: var(--vlb-radius-sm);
    font-size: 16px;
    font-family: var(--vlb-font-family);
    transition: border-color 0.2s;
}

.vlb-login-form input[type="text"]:focus,
.vlb-login-form input[type="password"]:focus {
    outline: none;
    border-color: var(--vlb-primary);
}

.vlb-checkbox-group {
    display: flex;
    align-items: center;
}

.vlb-checkbox-group label {
    margin-bottom: 0;
    font-weight: normal;
    cursor: pointer;
    display: flex;
    align-items: center;
}

.vlb-checkbox-group input[type="checkbox"] {
    margin-right: 8px;
    cursor: pointer;
}

/* ===================
   MAIN APP CONTAINER
   =================== */
.vlb-app-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: var(--vlb-spacing);
    font-family: var(--vlb-font-family);
    background: var(--vlb-bg-app);
    min-height: 100vh;
    color: var(--vlb-text-main);
}

/* ===================
   HEADER
   =================== */
.vlb-app-header {
    background: var(--vlb-bg-card);
    border-radius: var(--vlb-radius);
    box-shadow: none;
    padding: 20px;
    margin-bottom: var(--vlb-spacing);
}

.vlb-header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: nowrap;
    /* Prevent wrapping */
    gap: 12px;
}

.vlb-app-header h1 {
    margin: 0;
    font-size: 20px;
    color: var(--vlb-text-main);
    font-weight: 600;
}

.vlb-header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.vlb-user-name {
    color: var(--vlb-secondary);
    font-size: 14px;
    font-weight: 500;
}

/* ===================
   VEHICLE SELECTOR
   =================== */
.vlb-vehicle-selector {
    background: var(--vlb-bg-card);
    border-radius: var(--vlb-radius);
    box-shadow: none;
    padding: 20px;
    margin-bottom: var(--vlb-spacing);
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.vlb-vehicle-selector label {
    font-weight: 500;
    color: var(--vlb-text-muted);
    white-space: nowrap;
}

.vlb-vehicle-selector select {
    flex: 1;
    min-width: 200px;
}

/* ===================
   TABS
   =================== */
.vlb-tabs {
    display: flex;
    gap: 0;
    background: var(--vlb-bg-card);
    border-radius: var(--vlb-radius);
    box-shadow: var(--vlb-shadow-sm);
    padding: 6px;
    margin-bottom: var(--vlb-spacing);
    overflow-x: auto;
}

.vlb-tab-btn {
    flex: 1;
    padding: 8px 16px;
    border: none;
    background: transparent;
    color: var(--vlb-text-muted);
    font-size: 14px;
    font-weight: 500;
    border-radius: 0.375rem;
    /* rounded-md */
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    font-family: var(--vlb-font-family);
    text-align: center;
}

.vlb-tab-btn:hover {
    color: var(--vlb-text-main);
}

.vlb-tab-btn.active {
    background: var(--vlb-primary);
    color: #fff;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}

/* ===================
   TAB CONTENT
   =================== */
.vlb-tab-pane {
    display: none;
}

.vlb-tab-pane.active {
    display: block;
}

.vlb-tab-header {
    background: var(--vlb-bg-card);
    border-radius: var(--vlb-radius);
    box-shadow: none;
    padding: 20px;
    margin-bottom: var(--vlb-spacing);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}

.vlb-tab-header h2 {
    margin: 0;
    font-size: 20px;
    color: var(--vlb-text-main);
    font-weight: 600;
}

/* ===================
   DASHBOARD WIDGETS
   =================== */
.vlb-dashboard-widgets {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    /* Responsive grid */
    gap: 24px;
    /* gap-6 */
    margin-bottom: 24px;
}

.vlb-widget {
    background: var(--vlb-bg-card);
    border-radius: var(--vlb-radius);
    padding: 20px;
    box-shadow: none;
    /* Flat look */
    display: flex;
    align-items: center;
    gap: 16px;
    border: none;
}

.vlb-widget:hover {
    transform: none;
    box-shadow: none;
}

.vlb-widget-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    background: rgba(59, 130, 246, 0.2);
    /* Default blue tint */
    color: var(--vlb-primary);
}

.vlb-widget-content {
    flex: 1;
}

.vlb-widget-label {
    color: var(--vlb-text-muted);
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 2px;
}

.vlb-widget-value {
    color: var(--vlb-text-main);
    font-size: 28px;
    font-weight: 700;
    line-height: 1.2;
}

/* ===================
   DATA LIST & CARDS
   =================== */
.vlb-data-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: var(--vlb-spacing);
}

.vlb-data-card {
    background: var(--vlb-bg-card);
    border-radius: var(--vlb-radius);
    box-shadow: none;
    border: none;
    overflow: hidden;
    margin-bottom: 16px;
    transition: all 0.3s ease;
}

.vlb-data-card:hover {
    transform: none;
    box-shadow: none;
}

.vlb-data-card.vlb-clickable {
    cursor: pointer;
}

.vlb-card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--vlb-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.vlb-card-title {
    color: var(--vlb-text-main);
    font-weight: 600;
    font-size: 16px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.vlb-icon {
    color: var(--vlb-danger);
    /* Red icon like in image */
    font-size: 20px;
}

.vlb-card-actions {
    display: flex;
    gap: 8px;
}

.vlb-btn-icon {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 4px;
    font-size: 18px;
    transition: transform 0.2s;
}

.vlb-btn-icon:hover {
    transform: scale(1.2);
}

.vlb-card-body {
    padding: 16px 20px;
}

.vlb-info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid var(--vlb-border);
}

.vlb-info-row:last-child {
    border-bottom: none;
}

.vlb-label {
    color: var(--vlb-text-muted);
    font-size: 14px;
    font-weight: 500;
}

.vlb-highlight {
    color: var(--vlb-primary);
    font-weight: 600;
    font-size: 16px;
}

.vlb-empty-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 40px 20px;
    color: var(--vlb-secondary);
    font-size: 16px;
}

/* ===================
   BUTTONS
   =================== */
.vlb-btn {
    padding: 10px 20px;
    border: none;
    border-radius: var(--vlb-radius-sm);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-family: var(--vlb-font-family);
    text-decoration: none;
    display: inline-block;
    text-align: center;
}

.vlb-btn-primary {
    background: var(--vlb-primary);
    color: #fff;
    border-radius: var(--vlb-radius-sm);
    font-weight: 500;
    box-shadow: none;
}

.vlb-btn-primary:hover {
    background: var(--vlb-primary-hover);
    transform: none;
    box-shadow: none;
}

.vlb-btn-secondary {
    background: var(--vlb-secondary-bg);
    color: var(--vlb-text-main);
    border: none;
}

.vlb-btn-secondary:hover {
    background: #4b5563;
}

.vlb-btn-sm {
    padding: 8px 16px;
    font-size: 13px;
}

.vlb-btn-block {
    width: 100%;
}

/* ===================
   FORMS
   =================== */
.vlb-form-group {
    margin-bottom: 20px;
}

.vlb-form-group label {
    display: block;
    margin-bottom: 8px;
    color: var(--vlb-dark);
    font-weight: 500;
    font-size: 14px;
}

.vlb-input,
.vlb-select {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--vlb-border);
    border-radius: var(--vlb-radius-sm);
    font-size: 15px;
    font-family: var(--vlb-font-family);
    background: var(--vlb-bg-input);
    color: var(--vlb-text-main);
    transition: border-color 0.2s;
}

.vlb-input:focus,
.vlb-select:focus {
    outline: none;
    border-color: var(--vlb-primary);
}

.vlb-input::placeholder {
    color: var(--vlb-text-muted);
}

.vlb-form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
}

.vlb-form-actions {
    display: flex;
    gap: 12px;
    margin-top: 24px;
    flex-wrap: wrap;
}

/* ===================
   DATE FILTER
   =================== */
.vlb-date-filter {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.vlb-date-filter label {
    font-size: 14px;
    color: var(--vlb-secondary);
    font-weight: 500;
}

.vlb-date-filter input {
    padding: 8px 12px;
    border: 1px solid var(--vlb-border);
    border-radius: var(--vlb-radius-sm);
    font-size: 14px;
}

/* ===================
   CHART
   =================== */
/* ===================
   CALENDAR
   =================== */
.vlb-calendar-container {
    background: var(--vlb-bg-card);
    border-radius: var(--vlb-radius);
    box-shadow: none;
    padding: 24px;
    margin-bottom: var(--vlb-spacing);
}

#vlb-tab-performance .vlb-tab-header {
    flex-direction: column;
    justify-content: center;
    align-items: center;
    /* Ensure horizontal centering in column mode */
    text-align: center;
    gap: 16px;
}

.vlb-month-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    font-size: 18px;
    font-weight: 600;
    color: var(--vlb-text-main);
}

.vlb-calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 8px;
}

.vlb-calendar-header-cell {
    text-align: center;
    font-weight: 600;
    color: var(--vlb-text-muted);
    padding: 10px 0;
    font-size: 14px;
}

.vlb-calendar-day {
    aspect-ratio: 1;
    border: 1px solid var(--vlb-border);
    border-radius: var(--vlb-radius-sm);
    padding: 8px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: flex-start;
    position: relative;
    background: var(--vlb-bg-card);
    color: var(--vlb-text-main);
}

.vlb-calendar-day:hover {
    border-color: var(--vlb-primary);
    box-shadow: var(--vlb-shadow);
    z-index: 1;
}

.vlb-calendar-day.vlb-day-empty {
    background: transparent;
    border-color: transparent;
    cursor: default;
}

.vlb-calendar-day.vlb-day-has-trip {
    background-color: rgba(59, 130, 246, 0.2);
    /* Stronger blue tint */
    border-color: var(--vlb-primary);
    color: #fff;
    /* Force white text for better contrast */
}

.vlb-calendar-day.vlb-day-has-trip:hover {
    background-color: rgba(59, 130, 246, 0.3);
}

.vlb-day-number {
    font-weight: 600;
    font-size: 14px;
    color: var(--vlb-text-main);
    margin-bottom: 4px;
}

.vlb-day-indicator {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: var(--vlb-primary);
    position: absolute;
    top: 8px;
    right: 8px;
}

.vlb-day-fuel-indicator {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: var(--vlb-success);
    position: absolute;
    top: 8px;
    right: 18px;
}

@media (max-width: 600px) {
    .vlb-calendar-grid {
        gap: 4px;
    }

    .vlb-calendar-day {
        padding: 4px;
        font-size: 12px;
    }

    .vlb-day-number {
        font-size: 12px;
    }

    .vlb-day-indicator,
    .vlb-day-fuel-indicator {
        width: 4px;
        height: 4px;
        top: 4px;
    }

    .vlb-day-indicator {
        right: 4px;
    }

    .vlb-day-fuel-indicator {
        right: 10px;
    }
}

/* ===================
   DAY LIST
   =================== */
.vlb-day-list {
    background: #fff;
    border-radius: var(--vlb-radius);
    box-shadow: var(--vlb-shadow);
    padding: 20px;
}

.vlb-day-list h3 {
    margin: 0 0 16px;
    font-size: 18px;
    color: var(--vlb-dark);
    font-weight: 600;
}

.vlb-day-detail-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.vlb-detail-item {
    padding: 12px;
    background: var(--vlb-light);
    border-radius: var(--vlb-radius-sm);
    font-size: 14px;
    line-height: 1.6;
}

.vlb-detail-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}

/* ===================
   MODAL
   =================== */
.vlb-modal {
    display: none;
    position: fixed;
    z-index: 999999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
}

.vlb-modal-content {
    background: #fff;
    margin: 5% auto;
    padding: 0;
    border-radius: var(--vlb-radius);
    box-shadow: var(--vlb-shadow-lg);
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
    animation: vlb-modal-slide-in 0.3s ease;
}

@keyframes vlb-modal-slide-in {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.vlb-modal-close {
    position: sticky;
    top: 0;
    right: 0;
    float: right;
    font-size: 32px;
    font-weight: bold;
    color: var(--vlb-secondary);
    cursor: pointer;
    padding: 12px 20px;
    line-height: 1;
    background: #fff;
    z-index: 1;
}

.vlb-modal-close:hover {
    color: var(--vlb-dark);
}

#vlb-modal-body {
    padding: 20px 32px 32px;
}

#vlb-modal-body h2 {
    margin: 0 0 24px;
    font-size: 22px;
    color: var(--vlb-dark);
    font-weight: 600;
}

#vlb-modal-body h3 {
    margin: 20px 0 12px;
    font-size: 18px;
    color: var(--vlb-dark);
    font-weight: 600;
}

/* ===================
   NOTIFICATIONS
   =================== */
.vlb-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 16px 24px;
    border-radius: var(--vlb-radius-sm);
    box-shadow: var(--vlb-shadow-lg);
    z-index: 999999;
    font-weight: 500;
    font-size: 15px;
    animation: vlb-notification-slide-in 0.3s ease;
}

@keyframes vlb-notification-slide-in {
    from {
        transform: translateX(400px);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.vlb-notification-success {
    background: var(--vlb-success);
    color: #fff;
}

.vlb-notification-error {
    background: var(--vlb-danger);
    color: #fff;
}

/* ===================
   RESPONSIVE
   =================== */
@media (max-width: 768px) {
    .vlb-app-container {
        padding: 12px;
    }

    .vlb-header-content {
        /* Keep side-by-side on mobile as requested */
        flex-direction: row;
        align-items: center;
        flex-wrap: nowrap;
    }

    .vlb-app-header h1 {
        font-size: 18px;
        /* Reduce size slightly to fit */
    }

    .vlb-vehicle-selector {
        flex-direction: column;
        align-items: stretch;
    }

    .vlb-vehicle-selector select {
        width: 100%;
    }

    .vlb-tabs {
        padding: 6px;
    }

    .vlb-tab-btn {
        padding: 10px 16px;
        font-size: 14px;
    }

    .vlb-data-list {
        grid-template-columns: 1fr;
    }

    .vlb-tab-header {
        flex-direction: column;
        align-items: flex-start;
    }

    /* Specific override for Monthly Record tab to keep it centered */
    #vlb-tab-performance .vlb-tab-header {
        align-items: center;
    }

    .vlb-date-filter {
        width: 100%;
    }

    .vlb-date-filter input {
        flex: 1;
    }

    .vlb-modal-content {
        width: 95%;
        margin: 10% auto;
        max-height: 85vh;
    }

    #vlb-modal-body {
        padding: 16px 20px 24px;
    }

    .vlb-form-actions {
        flex-direction: column;
    }

    .vlb-form-actions .vlb-btn {
        width: 100%;
    }

    .vlb-login-card {
        padding: 30px 24px;
    }

    .vlb-notification {
        right: 10px;
        left: 10px;
        top: 10px;
    }
}

@media (max-width: 480px) {
    .vlb-app-header h1 {
        font-size: 18px;
    }

    .vlb-tab-btn {
        padding: 8px 12px;
        font-size: 13px;
    }

    .vlb-chart-container {
        padding: 16px;
    }
}

/* ===================
   PRINT STYLES
   =================== */
@media print {

    .vlb-app-header,
    .vlb-tabs,
    .vlb-btn,
    .vlb-card-actions,
    .vlb-modal {
        display: none !important;
    }

    .vlb-tab-pane {
        display: block !important;
    }

    .vlb-data-card {
        break-inside: avoid;
    }
}