/* 
 * Main Stylesheet
 * eCar Booking System
 */

:root {
    --primary-color: #0d6efd;
    --secondary-color: #6c757d;
    --success-color: #198754;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --info-color: #0dcaf0;
    --light-color: #f8f9fa;
    --dark-color: #212529;
}

/* Typography */
body {
    font-family: 'Sarabun', sans-serif;
    font-size: 16px;
    line-height: 1.6;
    background-color: #f5f5f5;
}

h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
}

/* Layout */
.main-content {
    min-height: calc(100vh - 200px);
    padding: 20px 0;
}

/* Card */
.card {
    border: none;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    margin-bottom: 20px;
}

.card-header {
    background: linear-gradient(135deg, var(--primary-color) 0%, #0a58ca 100%);
    color: white;
    border-radius: 10px 10px 0 0 !important;
    padding: 15px 20px;
    font-weight: 600;
}

.card-header i {
    margin-right: 8px;
}

/* Navbar */
.navbar {
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    padding: 10px 0;
}

.navbar-brand {
    font-weight: 600;
    font-size: 1.3rem;
}

.navbar .badge {
    position: relative;
    top: -2px;
    margin-left: 5px;
}

/* Buttons */
.btn {
    border-radius: 8px;
    padding: 8px 20px;
    font-weight: 500;
    transition: all 0.3s;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.btn-sm {
    padding: 5px 15px;
    font-size: 0.875rem;
}

.btn-group-sm .btn {
    padding: 5px 10px;
}

/* Tables */
.table {
    background: white;
    border-radius: 8px;
    overflow: hidden;
}

.table thead th {
    background-color: var(--primary-color);
    color: white;
    border: none;
    font-weight: 600;
    vertical-align: middle;
}

.table tbody tr {
    transition: background-color 0.2s;
}

.table tbody tr:hover {
    background-color: #f8f9fa;
}

.table-responsive {
    border-radius: 8px;
}

/* Badges */
.badge {
    padding: 6px 12px;
    font-weight: 500;
    border-radius: 6px;
}

/* Status Badges */
.status-pending {
    background-color: #fff3cd;
    color: #856404;
}

.status-approved {
    background-color: #d1e7dd;
    color: #0f5132;
}

.status-rejected {
    background-color: #f8d7da;
    color: #842029;
}

.status-cancelled {
    background-color: #e2e3e5;
    color: #41464b;
}

.status-completed {
    background-color: #cfe2ff;
    color: #084298;
}

/* Vehicle Status */
.status-available {
    background-color: #d1e7dd;
    color: #0f5132;
}

.status-in_use {
    background-color: #cfe2ff;
    color: #084298;
}

.status-maintenance {
    background-color: #fff3cd;
    color: #856404;
}

.status-inactive {
    background-color: #f8d7da;
    color: #842029;
}

/* Forms */
.form-label {
    font-weight: 600;
    color: #495057;
    margin-bottom: 8px;
}

.form-control, .form-select {
    border-radius: 8px;
    border: 1px solid #ced4da;
    padding: 10px 15px;
    transition: border-color 0.2s;
}

.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, .form-select.is-invalid {
    border-color: var(--danger-color);
}

.invalid-feedback {
    display: block;
    margin-top: 5px;
}

/* Login Page */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.login-card {
    max-width: 450px;
    width: 100%;
}

.login-header {
    text-align: center;
    padding: 30px 20px 20px;
}

.login-header i {
    font-size: 4rem;
    color: var(--primary-color);
    margin-bottom: 15px;
}

.login-header h2 {
    color: #333;
    font-weight: 700;
}

.login-body {
    padding: 30px;
}

/* Dashboard Cards */
.stat-card {
    border-left: 4px solid;
    transition: transform 0.3s;
}

.stat-card:hover {
    transform: translateY(-5px);
}

.stat-card.card-primary {
    border-left-color: var(--primary-color);
}

.stat-card.card-success {
    border-left-color: var(--success-color);
}

.stat-card.card-warning {
    border-left-color: var(--warning-color);
}

.stat-card.card-danger {
    border-left-color: var(--danger-color);
}

.stat-icon {
    font-size: 3rem;
    opacity: 0.3;
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
}

/* Vehicle Card */
.vehicle-card {
    transition: transform 0.3s;
    cursor: pointer;
}

.vehicle-card:hover {
    transform: translateY(-5px);
}

.vehicle-image {
    height: 200px;
    object-fit: cover;
    border-radius: 8px 8px 0 0;
}

/* Calendar/Booking */
.booking-calendar .fc-toolbar-title {
    font-family: 'Sarabun', sans-serif;
}

/* Pagination */
.pagination {
    margin-top: 20px;
}

.page-link {
    border-radius: 6px;
    margin: 0 3px;
    color: var(--primary-color);
    font-weight: 500;
}

.page-link:hover {
    background-color: var(--primary-color);
    color: white;
}

.page-item.active .page-link {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

/* Footer */
.footer {
    border-top: 1px solid #dee2e6;
    margin-top: auto;
}

/* Loading Spinner */
.loading-spinner {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 9999;
}

/* Print Styles */
@media print {
    .navbar, .footer, .btn, .no-print {
        display: none !important;
    }
    
    .main-content {
        margin: 0;
        padding: 0;
    }
    
    .card {
        box-shadow: none;
        border: 1px solid #dee2e6;
    }
}

/* Responsive */
@media (max-width: 768px) {
    .table-responsive {
        font-size: 0.875rem;
    }
    
    .btn {
        padding: 6px 15px;
        font-size: 0.875rem;
    }
    
    .card-header {
        font-size: 1rem;
    }
    
    .stat-icon {
        font-size: 2rem;
    }
}

/* Utilities */
.text-small {
    font-size: 0.875rem;
}

.text-tiny {
    font-size: 0.75rem;
}

.cursor-pointer {
    cursor: pointer;
}

.hover-shadow:hover {
    box-shadow: 0 4px 15px rgba(0,0,0,0.2) !important;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.5s ease-in;
}

/* Required field marker */
.required::after {
    content: " *";
    color: var(--danger-color);
}

/* ==========================================
   RESPONSIVE MOBILE IMPROVEMENTS
   ========================================== */

/* Mobile Navigation */
@media (max-width: 991px) {
    .navbar-collapse {
        background-color: rgba(255, 255, 255, 0.98);
        padding: 15px;
        margin-top: 10px;
        border-radius: 8px;
        box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    }
    
    .navbar-nav .nav-link {
        padding: 12px 15px;
        border-bottom: 1px solid #e9ecef;
        color: #212529 !important;
    }
    
    .navbar-nav .nav-link:hover {
        background-color: #f8f9fa;
        border-radius: 5px;
    }
    
    .dropdown-menu {
        border: none;
        box-shadow: none;
        padding-left: 20px;
    }
}

/* Mobile Tables */
@media (max-width: 768px) {
    .table-responsive {
        border: none;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .table {
        font-size: 0.85rem;
        min-width: 600px;
    }
    
    .table thead th {
        white-space: nowrap;
        font-size: 0.8rem;
        padding: 8px;
    }
    
    .table tbody td {
        padding: 8px;
        vertical-align: middle;
    }
    
    /* Stack form controls on mobile */
    .row > [class*="col-"] {
        margin-bottom: 15px;
    }
    
    /* Full width buttons on mobile */
    .btn-group {
        display: flex;
        flex-direction: column;
        gap: 5px;
    }
    
    .btn-group .btn {
        width: 100%;
        margin-bottom: 5px;
    }
}

/* Small Mobile Devices */
@media (max-width: 576px) {
    body {
        font-size: 14px;
    }
    
    h1 {
        font-size: 1.5rem;
    }
    
    h2 {
        font-size: 1.3rem;
    }
    
    h3 {
        font-size: 1.2rem;
    }
    
    h4, h5, h6 {
        font-size: 1rem;
    }
    
    /* Compact cards */
    .card {
        margin-bottom: 10px;
    }
    
    .card-body {
        padding: 15px;
    }
    
    .card-header {
        padding: 10px 15px;
        font-size: 0.95rem;
    }
    
    /* Smaller buttons */
    .btn {
        font-size: 0.875rem;
        padding: 8px 12px;
    }
    
    .btn-sm {
        font-size: 0.75rem;
        padding: 5px 10px;
    }
    
    /* Stack stat cards */
    .stat-card {
        margin-bottom: 15px;
    }
    
    .stat-card h2 {
        font-size: 1.8rem;
    }
    
    .stat-card h6 {
        font-size: 0.75rem;
    }
    
    .stat-icon {
        font-size: 2.5rem !important;
    }
    
    /* Breadcrumb */
    .breadcrumb {
        font-size: 0.8rem;
        padding: 8px;
    }
    
    .breadcrumb-item {
        max-width: 150px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    
    /* Modal adjustments */
    .modal-dialog {
        margin: 10px;
    }
    
    .modal-header {
        padding: 12px 15px;
    }
    
    .modal-body {
        padding: 15px;
    }
    
    .modal-footer {
        padding: 12px 15px;
    }
}

/* Touch-friendly tap targets */
@media (hover: none) and (pointer: coarse) {
    .btn, .nav-link, .dropdown-item, a {
        min-height: 44px;
        display: inline-flex;
        align-items: center;
    }
    
    .form-control, .form-select {
        min-height: 44px;
        font-size: 16px; /* Prevent zoom on iOS */
    }
    
    /* Larger checkboxes and radios */
    .form-check-input {
        width: 1.25rem;
        height: 1.25rem;
    }
}

/* Time Input - Force 24-hour format */
input[type="time"] {
    -webkit-appearance: textfield;
    -moz-appearance: textfield;
    appearance: textfield;
}

/* Hide AM/PM selector in time input (for browsers that show it) */
input[type="time"]::-webkit-calendar-picker-indicator {
    filter: invert(0.5);
    cursor: pointer;
}

/* Force hide AM/PM field in webkit browsers */
input[type="time"]::-webkit-datetime-edit-ampm-field {
    display: none !important;
}

/* Ensure 24-hour format display */
input[type="time"]::-webkit-datetime-edit-hour-field,
input[type="time"]::-webkit-datetime-edit-minute-field {
    padding: 0 5px;
}

/* Firefox specific - hide AM/PM */
input[type="time"]::-moz-datetime-edit-ampm-field {
    display: none !important;
}

/* Print styles */
@media print {
    .navbar, .breadcrumb, .btn, .card-header .btn, 
    .no-print, .sidebar {
        display: none !important;
    }
    
    .main-content {
        padding: 0;
    }
    
    .card {
        box-shadow: none;
        border: 1px solid #ddd;
    }
    
    body {
        background-color: white;
    }
}
