/* Vehicare - Mobile First Responsive CSS */

/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --secondary: #64748b;
    --success: #22c55e;
    --warning: #f59e0b;
    --danger: #ef4444;
    --light: #f8fafc;
    --dark: #1e293b;
    --gray: #e2e8f0;
    --white: #ffffff;
    --font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    --border-radius: 8px;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 4px 6px rgba(0, 0, 0, 0.1);
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-family);
    background-color: var(--light);
    color: var(--dark);
    line-height: 1.6;
    min-height: 100vh;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    margin-bottom: 0.5rem;
    font-weight: 600;
    line-height: 1.2;
}

h1 { font-size: 1.75rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.25rem; }
h4 { font-size: 1rem; }

p {
    margin-bottom: 1rem;
}

a {
    color: var(--primary);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* Container */
.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

/* Header */
.header {
    background-color: var(--white);
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
}

/* Navigation */
.nav {
    display: none;
}

/* Mobile-first: compact fixed bottom bar (single horizontal row of icons).
   Client pages render the nav with class="nav active" (always open in markup),
   so this is the default state below 768px. */
.nav.active {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-around;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 64px;
    background-color: var(--white);
    border-top: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
    z-index: 1000;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1 1 auto;
    min-width: 0;
    padding: 0.5rem 0.25rem;
    color: var(--secondary);
    font-size: 0.68rem;
    text-decoration: none;
    transition: color 0.2s;
    overflow: hidden;
    white-space: nowrap;
}

.nav-item:hover, .nav-item.active {
    color: var(--primary);
    text-decoration: none;
}

.nav-item svg {
    width: 22px;
    height: 22px;
    margin-bottom: 0.2rem;
    flex-shrink: 0;
}

/* Main content */
.main {
    padding: 1rem;
    padding-bottom: 80px;
}

/* Cards */
.card {
    background-color: var(--white);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    padding: 1rem;
    margin-bottom: 1rem;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.card-title {
    font-size: 1.125rem;
    font-weight: 600;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: 500;
    border-radius: var(--border-radius);
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

.btn-primary {
    background-color: var(--primary);
    color: var(--white);
}

.btn-primary:hover {
    background-color: var(--primary-dark);
}

.btn-secondary {
    background-color: var(--gray);
    color: var(--dark);
}

.btn-secondary:hover {
    background-color: #cbd5e1;
}

.btn-danger {
    background-color: var(--danger);
    color: var(--white);
}

.btn-danger:hover {
    background-color: #dc2626;
}

.btn-block {
    width: 100%;
}

.logout-btn {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    flex-shrink: 0;
}

/* Forms */
.form-group {
    margin-bottom: 1rem;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.form-control {
    width: 100%;
    padding: 0.75rem;
    font-size: 1rem;
    border: 1px solid var(--gray);
    border-radius: var(--border-radius);
    transition: border-color 0.2s;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 0.5rem center;
    background-repeat: no-repeat;
    background-size: 1.5em 1.5em;
    padding-right: 2.5rem;
}

/* Vehicle cards */
.vehicle-card {
    display: flex;
    align-items: center;
    padding: 1rem;
    background-color: var(--white);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    margin-bottom: 1rem;
}

.vehicle-icon {
    width: 48px;
    height: 48px;
    background-color: var(--primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 1rem;
}

.vehicle-icon svg {
    width: 24px;
    height: 24px;
    color: var(--white);
}

.vehicle-info {
    flex: 1;
}

.vehicle-name {
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.vehicle-details {
    font-size: 0.875rem;
    color: var(--secondary);
}

.vehicle-status {
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 500;
}

.status-ok {
    background-color: #dcfce7;
    color: #166534;
}

.status-warning {
    background-color: #fef3c7;
    color: #92400e;
}

.status-critical {
    background-color: #fee2e2;
    color: #991b1b;
}

/* Maintenance list */
.maintenance-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    border-bottom: 1px solid var(--gray);
}

.maintenance-item:last-child {
    border-bottom: none;
}

.maintenance-info {
    flex: 1;
}

.maintenance-service {
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.maintenance-date {
    font-size: 0.875rem;
    color: var(--secondary);
}

.maintenance-cost {
    font-weight: 600;
    color: var(--primary);
}

/* Provider cards */
.provider-card {
    background-color: var(--white);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    padding: 1rem;
    margin-bottom: 1rem;
}

.provider-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.5rem;
}

.provider-name {
    font-weight: 600;
    font-size: 1.125rem;
}

.provider-distance {
    font-size: 0.875rem;
    color: var(--secondary);
}

.provider-rating {
    display: flex;
    align-items: center;
    margin-bottom: 0.5rem;
}

.provider-rating svg {
    width: 16px;
    height: 16px;
    color: #fbbf24;
    margin-right: 0.25rem;
}

.provider-services {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.service-tag {
    background-color: var(--gray);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
}

/* Offer cards */
.offer-card {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: var(--white);
    border-radius: var(--border-radius);
    padding: 1rem;
    margin-bottom: 1rem;
}

.offer-discount {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.offer-title {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.offer-provider {
    font-size: 0.875rem;
    opacity: 0.9;
}

.offer-expiry {
    font-size: 0.75rem;
    opacity: 0.8;
    margin-top: 0.5rem;
}

/* Notification badge */
.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--white);
    background-color: var(--danger);
    border-radius: 9999px;
}

/* Alerts */
.alert {
    padding: 1rem;
    border-radius: var(--border-radius);
    margin-bottom: 1rem;
}

.alert-success {
    background-color: #dcfce7;
    color: #166534;
    border: 1px solid #bbf7d0;
}

.alert-warning {
    background-color: #fef3c7;
    color: #92400e;
    border: 1px solid #fde68a;
}

.alert-danger {
    background-color: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

/* Loading spinner */
.spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid var(--gray);
    border-radius: 50%;
    border-top-color: var(--primary);
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Utility classes */
.text-center { text-align: center; }
.text-right { text-align: right; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.d-none { display: none; }
.d-flex { display: flex; }
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}
.modal-overlay.d-none { display: none; }
.flex-column { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }

/* Tablet breakpoint */
@media (min-width: 768px) {
    .container {
        padding: 0 2rem;
    }

    .nav,
    .nav.active {
        display: flex;
        flex-direction: row;
        justify-content: center;
        gap: 2rem;
        position: static;
        height: auto;
        border-top: none;
        background-color: transparent;
        box-shadow: none;
    }

    .nav-item {
        flex-direction: row;
        flex: 0 0 auto;
        padding: 0.5rem 1rem;
        font-size: 1rem;
    }

    .nav-item svg {
        margin-bottom: 0;
        margin-right: 0.5rem;
    }

    .main {
        padding: 2rem;
        padding-bottom: 2rem;
    }

    .vehicle-card {
        padding: 1.5rem;
    }

    .provider-card {
        padding: 1.5rem;
    }
}

/* Desktop breakpoint */
@media (min-width: 1024px) {
    .container {
        padding: 0 4rem;
    }

    /* Sidebar navigation (fixed left column) */
    .nav,
    .nav.active {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        width: 220px;
        height: auto;
        flex-direction: column;
        align-items: stretch;
        justify-content: flex-start;
        gap: 4px;
        margin: 0;
        padding: 16px 10px;
        background-color: var(--white);
        border-top: none;
        border-right: 1px solid rgba(0, 0, 0, 0.08);
        box-shadow: 2px 0 8px rgba(0, 0, 0, 0.05);
    }

    .nav-item {
        flex-direction: row;
        flex: 0 0 auto;
        justify-content: flex-start;
        min-width: 0;
        white-space: nowrap;
        padding: 0.65rem 0.75rem;
        font-size: 0.95rem;
        border-radius: 8px;
    }

    .nav-item:hover,
    .nav-item.active {
        background-color: rgba(37, 99, 235, 0.08);
    }

    .nav-item svg {
        margin-bottom: 0;
        margin-right: 0.75rem;
    }

    /* Offset header and content from the fixed sidebar */
    .header,
    .header-content,
    .main,
    .admin-tabs {
        margin-left: 220px;
    }

    .header-content {
        padding: 1rem 2rem;
    }

    .main {
        padding: 2rem 4rem;
    }

    .card {
        padding: 1.5rem;
    }

    h1 { font-size: 2rem; }
    h2 { font-size: 1.75rem; }
    h3 { font-size: 1.5rem; }
}
