/*
 * MOT Reminder - Main Stylesheet
 * Professional blue/green color scheme
 */

/* ============================================================
   CSS Variables - Color Scheme
   ============================================================ */
:root {
    --primary-color: #0d6efd;
    --primary-dark: #0a58ca;
    --primary-light: #6ea8fe;
    --secondary-color: #198754;
    --secondary-dark: #146c43;
    --secondary-light: #75b798;
    --accent-color: #0dcaf0;
    --warning-color: #ffc107;
    --danger-color: #dc3545;
    --success-color: #198754;
    --info-color: #0dcaf0;
    --dark-color: #212529;
    --light-color: #f8f9fa;
    --gray-100: #f8f9fa;
    --gray-200: #e9ecef;
    --gray-300: #dee2e6;
    --gray-400: #ced4da;
    --gray-500: #adb5bd;
    --gray-600: #6c757d;
    --gray-700: #495057;
    --gray-800: #343a40;
    --gray-900: #212529;
    --shadow-sm: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    --shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
    --shadow-lg: 0 1rem 3rem rgba(0, 0, 0, 0.175);
    --border-radius: 0.375rem;
    --border-radius-lg: 0.5rem;
    --transition-speed: 0.2s;
}

/* ============================================================
   Base Styles
   ============================================================ */
body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background-color: var(--gray-100);
    min-height: 100vh;
}

a {
    transition: color var(--transition-speed) ease;
}

/* ============================================================
   Navigation Styles
   ============================================================ */
.navbar {
    box-shadow: var(--shadow-sm);
}

.navbar-brand {
    font-weight: 600;
    letter-spacing: -0.5px;
}

.nav-link {
    font-weight: 500;
    transition: all var(--transition-speed) ease;
}

.nav-link:hover {
    transform: translateY(-1px);
}

/* Sidebar Navigation */
.sidebar {
    min-height: calc(100vh - 56px);
    background: linear-gradient(180deg, var(--gray-800) 0%, var(--gray-900) 100%);
    box-shadow: var(--shadow);
}

.sidebar .nav-link {
    color: var(--gray-400);
    padding: 0.75rem 1rem;
    border-radius: var(--border-radius);
    margin: 0.125rem 0.5rem;
    transition: all var(--transition-speed) ease;
}

.sidebar .nav-link:hover {
    color: #fff;
    background-color: rgba(255, 255, 255, 0.1);
}

.sidebar .nav-link.active {
    color: #fff;
    background-color: var(--primary-color);
}

.sidebar .nav-link i {
    width: 1.5rem;
    text-align: center;
    margin-right: 0.5rem;
}

/* ============================================================
   Card Styles
   ============================================================ */
.card {
    border: none;
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-sm);
    transition: all var(--transition-speed) ease;
}

.card:hover {
    box-shadow: var(--shadow);
}

.card-header {
    background-color: transparent;
    border-bottom: 1px solid var(--gray-200);
    font-weight: 600;
}

/* Dashboard Stats Cards */
.stats-card {
    border-left: 4px solid var(--primary-color);
    transition: all var(--transition-speed) ease;
}

.stats-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.stats-card.primary { border-left-color: var(--primary-color); }
.stats-card.success { border-left-color: var(--success-color); }
.stats-card.warning { border-left-color: var(--warning-color); }
.stats-card.danger { border-left-color: var(--danger-color); }
.stats-card.info { border-left-color: var(--info-color); }

.stats-card .stats-icon {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-size: 1.25rem;
}

.stats-card .stats-value {
    font-size: 1.75rem;
    font-weight: 700;
    line-height: 1;
}

.stats-card .stats-label {
    color: var(--gray-600);
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ============================================================
   Table Styles
   ============================================================ */
.table {
    margin-bottom: 0;
}

.table thead th {
    background-color: var(--gray-100);
    border-bottom: 2px solid var(--gray-300);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.5px;
    color: var(--gray-700);
    white-space: nowrap;
}

.table tbody tr {
    transition: background-color var(--transition-speed) ease;
}

.table tbody tr:hover {
    background-color: var(--gray-100);
}

.table td {
    vertical-align: middle;
    padding: 0.75rem;
}

/* Responsive Tables */
.table-responsive {
    border-radius: var(--border-radius);
}

@media (max-width: 768px) {
    .table-responsive-stack thead {
        display: none;
    }

    .table-responsive-stack tbody tr {
        display: block;
        margin-bottom: 1rem;
        border: 1px solid var(--gray-300);
        border-radius: var(--border-radius);
        padding: 0.5rem;
    }

    .table-responsive-stack tbody td {
        display: flex;
        justify-content: space-between;
        padding: 0.5rem;
        border: none;
        border-bottom: 1px solid var(--gray-200);
    }

    .table-responsive-stack tbody td:last-child {
        border-bottom: none;
    }

    .table-responsive-stack tbody td::before {
        content: attr(data-label);
        font-weight: 600;
        color: var(--gray-700);
    }
}

/* ============================================================
   Form Styles
   ============================================================ */
.form-control, .form-select {
    border-radius: var(--border-radius);
    border-color: var(--gray-300);
    transition: all var(--transition-speed) ease;
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.15);
}

.form-control.is-invalid:focus {
    box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.15);
}

.form-label {
    font-weight: 500;
    color: var(--gray-700);
    margin-bottom: 0.375rem;
}

/* Plate Number Input */
.plate-input {
    font-family: 'Courier New', monospace;
    font-size: 1.25rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 2px;
    background-color: #ffcc00;
    border: 2px solid var(--gray-900);
    text-align: center;
}

.plate-input:focus {
    background-color: #ffcc00;
    border-color: var(--gray-900);
}

/* Form Validation */
.was-validated .form-control:invalid,
.form-control.is-invalid {
    border-color: var(--danger-color);
    background-image: none;
}

.invalid-feedback {
    font-size: 0.8rem;
}

/* ============================================================
   Button Styles
   ============================================================ */
.btn {
    font-weight: 500;
    border-radius: var(--border-radius);
    transition: all var(--transition-speed) ease;
    padding: 0.5rem 1rem;
}

.btn:hover {
    transform: translateY(-1px);
}

.btn:active {
    transform: translateY(0);
}

.btn-primary {
    background: linear-gradient(180deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    border: none;
}

.btn-primary:hover {
    background: linear-gradient(180deg, var(--primary-dark) 0%, var(--primary-color) 100%);
}

.btn-success {
    background: linear-gradient(180deg, var(--success-color) 0%, var(--secondary-dark) 100%);
    border: none;
}

.btn-icon {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

/* ============================================================
   Loading Spinner
   ============================================================ */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(255, 255, 255, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-speed) ease;
}

.loading-overlay.active {
    opacity: 1;
    visibility: visible;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--gray-200);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Inline spinner */
.spinner-inline {
    display: inline-block;
    width: 1rem;
    height: 1rem;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: spin 0.75s linear infinite;
    vertical-align: middle;
    margin-right: 0.5rem;
}

/* ============================================================
   Alert & Flash Messages
   ============================================================ */
.alert {
    border: none;
    border-radius: var(--border-radius);
    border-left: 4px solid;
}

.alert-success { border-left-color: var(--success-color); }
.alert-danger { border-left-color: var(--danger-color); }
.alert-warning { border-left-color: var(--warning-color); }
.alert-info { border-left-color: var(--info-color); }

.alert-dismissible {
    padding-right: 3rem;
}

/* Flash message animation */
.flash-message {
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ============================================================
   Badge Styles
   ============================================================ */
.badge {
    font-weight: 500;
    padding: 0.4em 0.65em;
}

.badge-mot-valid {
    background-color: var(--success-color);
}

.badge-mot-due-soon {
    background-color: var(--warning-color);
    color: var(--dark-color);
}

.badge-mot-overdue {
    background-color: var(--danger-color);
}

/* ============================================================
   Modal Styles
   ============================================================ */
.modal-content {
    border: none;
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-lg);
}

.modal-header {
    border-bottom: 1px solid var(--gray-200);
}

.modal-footer {
    border-top: 1px solid var(--gray-200);
}

/* Confirmation Modal */
.modal-confirm .modal-header {
    background-color: var(--danger-color);
    color: #fff;
    border-radius: var(--border-radius-lg) var(--border-radius-lg) 0 0;
}

.modal-confirm .btn-close {
    filter: brightness(0) invert(1);
}

/* ============================================================
   Empty State
   ============================================================ */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--gray-600);
}

.empty-state-icon {
    font-size: 4rem;
    color: var(--gray-400);
    margin-bottom: 1rem;
}

.empty-state-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 0.5rem;
}

/* ============================================================
   QR Code Display
   ============================================================ */
.qr-code-container {
    background: #fff;
    padding: 1rem;
    border-radius: var(--border-radius);
    display: inline-block;
    box-shadow: var(--shadow-sm);
}

.qr-code-container canvas,
.qr-code-container img {
    display: block;
}

/* ============================================================
   MOT Status Indicator
   ============================================================ */
.mot-status {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.25rem 0.75rem;
    border-radius: 50px;
    font-size: 0.875rem;
    font-weight: 500;
}

.mot-status-valid {
    background-color: rgba(25, 135, 84, 0.1);
    color: var(--success-color);
}

.mot-status-warning {
    background-color: rgba(255, 193, 7, 0.1);
    color: #997404;
}

.mot-status-danger {
    background-color: rgba(220, 53, 69, 0.1);
    color: var(--danger-color);
}

/* ============================================================
   Utility Classes
   ============================================================ */
.text-truncate-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.cursor-pointer {
    cursor: pointer;
}

.hover-shadow:hover {
    box-shadow: var(--shadow);
}

/* ============================================================
   Mobile Responsive
   ============================================================ */
@media (max-width: 768px) {
    .stats-card .stats-value {
        font-size: 1.5rem;
    }

    .btn {
        padding: 0.625rem 1rem;
    }

    .card-body {
        padding: 1rem;
    }

    /* Hide columns on mobile */
    .d-mobile-none {
        display: none !important;
    }
}

@media (max-width: 576px) {
    .container {
        padding-left: 1rem;
        padding-right: 1rem;
    }

    h1, .h1 { font-size: 1.75rem; }
    h2, .h2 { font-size: 1.5rem; }
    h3, .h3 { font-size: 1.25rem; }
}

/* ============================================================
   Print Styles
   ============================================================ */
@media print {
    .sidebar,
    .navbar,
    .btn,
    .no-print {
        display: none !important;
    }

    .card {
        box-shadow: none;
        border: 1px solid #ddd;
    }
}
