/* Global Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #4CAF50;
    --secondary-color: #2196F3;
    --danger-color: #f44336;
    --warning-color: #ff9800;
    --success-color: #4CAF50;
    --dark-color: #333;
    --light-color: #f4f4f4;
    --border-color: #ddd;
    --sidebar-width: 250px;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: var(--dark-color);
    background-color: #f8f9fa;
}

/* Login Page */
.login-page {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.login-container {
    width: 100%;
    max-width: 450px;
    padding: 20px;
}

.login-box {
    background: white;
    border-radius: 10px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    padding: 40px;
}

.logo {
    text-align: center;
    margin-bottom: 30px;
}

.logo img {
    max-width: 80px;
    margin-bottom: 10px;
}

.logo h1 {
    font-size: 24px;
    color: var(--primary-color);
}

.login-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.tab-btn {
    flex: 1;
    padding: 10px;
    border: 1px solid var(--border-color);
    background: white;
    cursor: pointer;
    border-radius: 5px;
    transition: all 0.3s;
}

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

.login-footer {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
    font-size: 12px;
    color: #666;
    text-align: center;
}

/* Dashboard Layout */
.dashboard {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: var(--sidebar-width);
    background: #2c3e50;
    color: white;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
}

.sidebar-header {
    padding: 20px;
    background: #1a252f;
    text-align: center;
}

.sidebar-header h2 {
    font-size: 20px;
}

.sidebar-nav {
    padding: 20px 0;
}

.nav-item {
    display: block;
    padding: 15px 25px;
    color: #ecf0f1;
    text-decoration: none;
    transition: all 0.3s;
    border-left: 3px solid transparent;
}

.nav-item:hover,
.nav-item.active {
    background: #34495e;
    border-left-color: var(--primary-color);
}

.main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    padding: 0;
}

.content-header {
    background: white;
    padding: 20px 30px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.content-header h1 {
    font-size: 28px;
    color: var(--dark-color);
}

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

.dashboard-content {
    padding: 30px;
}

/* Cards */
.card {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
}

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

.card-header h3 {
    font-size: 20px;
    color: var(--dark-color);
}

.card-body {
    padding: 20px;
}

.card-footer {
    padding: 15px 20px;
    background: #f8f9fa;
    border-top: 1px solid var(--border-color);
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: white;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    gap: 15px;
}

.stat-card.highlight {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.stat-icon {
    font-size: 40px;
}

.stat-content h3 {
    font-size: 32px;
    margin-bottom: 5px;
}

.stat-content p {
    font-size: 14px;
    opacity: 0.8;
}

/* Forms */
.form-group {
    margin-bottom: 20px;
}

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

.form-control {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 5px;
    font-size: 14px;
    transition: border-color 0.3s;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
}

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

.form-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

/* Buttons */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s;
    text-decoration: none;
    display: inline-block;
}

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

.btn-primary:hover {
    background: #45a049;
}

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

.btn-success:hover {
    background: #45a049;
}

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

.btn-danger:hover {
    background: #da190b;
}

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

.btn-warning:hover {
    background: #e68a00;
}

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

.btn-info:hover {
    background: #0b7dda;
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #5a6268;
}

.btn-sm {
    padding: 5px 10px;
    font-size: 12px;
}

.btn-lg {
    padding: 15px 30px;
    font-size: 16px;
}

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

/* Tables */
.table-responsive {
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
}

.table thead {
    background: #f8f9fa;
}

.table th,
.table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.table th {
    font-weight: 600;
    color: var(--dark-color);
}

.table tbody tr:hover {
    background: #f8f9fa;
}

/* Badges */
.badge {
    display: inline-block;
    padding: 4px 8px;
    font-size: 12px;
    border-radius: 3px;
    font-weight: 500;
}

.badge-success {
    background: #d4edda;
    color: #155724;
}

.badge-danger {
    background: #f8d7da;
    color: #721c24;
}

.badge-info {
    background: #d1ecf1;
    color: #0c5460;
}

.badge-warning {
    background: #fff3cd;
    color: #856404;
}

/* Status Badge */
.status-badge {
    padding: 5px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.status-online {
    background: #d4edda;
    color: #155724;
}

.status-offline {
    background: #f8d7da;
    color: #721c24;
}

.status-active {
    background: #d4edda;
    color: #155724;
}

.status-inactive {
    background: #e2e3e5;
    color: #383d41;
}

/* Alerts */
.alert {
    padding: 15px;
    border-radius: 5px;
    margin-bottom: 20px;
}

.alert-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.alert-warning {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
}

.alert-info {
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

/* Info Grid */
.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.info-item {
    padding: 10px;
    background: #f8f9fa;
    border-radius: 5px;
}

.info-item label {
    display: block;
    font-size: 12px;
    color: #666;
    margin-bottom: 5px;
}

.info-item span {
    font-weight: 600;
    color: var(--dark-color);
}

/* GPS Status */
.gps-status {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
}

.status-item {
    padding: 15px;
    background: #f8f9fa;
    border-radius: 5px;
    text-align: center;
}

.status-item label {
    display: block;
    font-size: 12px;
    color: #666;
    margin-bottom: 5px;
}

.status-item span {
    font-size: 18px;
    font-weight: 600;
    color: var(--dark-color);
}

/* Tracking Info */
.tracking-info {
    display: flex;
    justify-content: space-around;
    align-items: center;
}

.tracking-info .info-item {
    text-align: center;
    flex: 1;
}

/* Map Controls */
.map-controls {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 1000;
    background: white;
    padding: 10px;
    border-radius: 5px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
    display: flex;
    gap: 10px;
    align-items: center;
}

/* Live Tracking Layout */
.tracking-layout {
    display: flex;
    gap: 20px;
}

.trip-list {
    width: 300px;
    background: white;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    max-height: calc(100vh - 100px);
    overflow-y: auto;
}

.trip-list h3 {
    margin-bottom: 15px;
    color: var(--dark-color);
}

.trip-card {
    padding: 15px;
    border: 1px solid var(--border-color);
    border-radius: 5px;
    margin-bottom: 10px;
    cursor: pointer;
    transition: all 0.3s;
}

.trip-card:hover {
    background: #f8f9fa;
    border-color: var(--primary-color);
}

.trip-card.selected {
    background: #e7f3e7;
    border-color: var(--primary-color);
}

.trip-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.trip-info p {
    margin: 5px 0;
}

.map-container {
    flex: 1;
    position: relative;
}

/* Quick Actions */
.quick-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

/* Utilities */
.mt-3 { margin-top: 1rem; }
.mt-4 { margin-top: 1.5rem; }
.mb-3 { margin-bottom: 1rem; }
.mb-4 { margin-bottom: 1.5rem; }
.p-0 { padding: 0; }
.text-center { text-align: center; }
.text-muted { color: #6c757d; }
.text-success { color: var(--success-color); }
.text-danger { color: var(--danger-color); }
.text-warning { color: var(--warning-color); }

/* Mobile Navigation */
.mobile-nav-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 24px;
    color: white;
    cursor: pointer;
    padding: 10px;
}

.sidebar.mobile-hidden {
    transform: translateX(-100%);
}

/* Responsive */
@media (max-width: 768px) {
    /* Mobile Navigation */
    .mobile-nav-toggle {
        display: block;
        position: fixed;
        top: 15px;
        left: 15px;
        z-index: 1001;
        background: var(--primary-color);
        border-radius: 5px;
    }
    
    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        width: 280px;
        height: 100vh;
        z-index: 1000;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }
    
    .sidebar.mobile-visible {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
        width: 100%;
    }
    
    .content-header {
        flex-direction: column;
        gap: 10px;
        padding: 60px 20px 20px 20px;
    }
    
    .content-header h1 {
        font-size: 24px;
    }
    
    .dashboard-content {
        padding: 20px;
    }
    
    /* Login page mobile */
    .login-container {
        padding: 15px;
    }
    
    .login-box {
        padding: 30px 20px;
    }
    
    .logo h1 {
        font-size: 20px;
    }
    
    /* Cards and grids */
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .stat-card {
        padding: 15px;
    }
    
    .stat-content h3 {
        font-size: 24px;
    }
    
    /* Forms */
    .form-row {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .form-control {
        padding: 12px;
        font-size: 16px; /* Prevents zoom on iOS */
    }
    
    .btn {
        padding: 12px 20px;
        font-size: 16px;
        min-height: 44px; /* Touch-friendly */
    }
    
    .btn-block {
        width: 100%;
    }
    
    /* Tables */
    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .table {
        min-width: 600px;
    }
    
    .table th,
    .table td {
        padding: 8px;
        font-size: 14px;
    }
    
    /* Tracking layout */
    .tracking-layout {
        flex-direction: column;
        gap: 15px;
    }
    
    .trip-list {
        width: 100%;
        max-height: 300px;
        order: 2;
    }
    
    .map-container {
        order: 1;
        height: 400px;
    }
    
    /* Map controls */
    .map-controls {
        position: relative;
        top: auto;
        left: auto;
        margin-bottom: 10px;
        flex-wrap: wrap;
        gap: 5px;
    }
    
    .map-controls .btn {
        padding: 8px 12px;
        font-size: 12px;
        min-height: auto;
    }
    
    /* Trip status box */
    .trip-status-box {
        padding: 15px;
        margin-bottom: 15px;
    }
    
    .info-display {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
    
    .info-card {
        padding: 10px;
    }
    
    .info-card-value {
        font-size: 18px;
    }
    
    /* Info grid */
    .info-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    .info-item {
        padding: 8px;
    }
    
    /* Navigation items */
    .nav-item {
        padding: 12px 20px;
        font-size: 16px;
    }
    
    /* Header actions */
    .header-actions {
        flex-direction: column;
        gap: 8px;
        width: 100%;
    }
    
    .header-actions .btn {
        width: 100%;
    }
    
    /* Alert messages */
    .alert {
        padding: 12px;
        font-size: 14px;
    }
    
    /* Quick actions */
    .quick-actions {
        flex-direction: column;
        gap: 8px;
    }
    
    .quick-actions .btn {
        width: 100%;
    }
}

/* Small phone styles */
@media (max-width: 480px) {
    .content-header {
        padding: 50px 15px 15px 15px;
    }
    
    .dashboard-content {
        padding: 15px;
    }
    
    .login-container {
        padding: 10px;
    }
    
    .login-box {
        padding: 25px 15px;
    }
    
    .card {
        margin-bottom: 15px;
    }
    
    .card-header,
    .card-body {
        padding: 15px;
    }
    
    .logo h1 {
        font-size: 18px;
    }
    
    .stat-card {
        padding: 12px;
        flex-direction: column;
        text-align: center;
        gap: 10px;
    }
    
    .stat-icon {
        font-size: 30px;
    }
    
    .stat-content h3 {
        font-size: 20px;
    }
    
    .info-display {
        grid-template-columns: 1fr;
        gap: 8px;
    }
    
    .info-card {
        padding: 8px;
    }
    
    .info-card-value {
        font-size: 16px;
    }
    
    .form-control {
        padding: 10px;
    }
    
    .btn {
        padding: 10px 15px;
        font-size: 14px;
    }
    
    .map-container {
        height: 300px;
    }
    
    .trip-list {
        max-height: 250px;
    }
    
    .trip-card {
        padding: 12px;
    }
    
    .sidebar {
        width: 100%;
    }
    
    .table {
        font-size: 12px;
    }
    
    .table th,
    .table td {
        padding: 6px;
    }
}

/* Active trip info */
.active-trip-info {
    background: #e7f3e7;
    padding: 15px;
    border-radius: 5px;
    margin-bottom: 15px;
}

.active-trip-info p {
    margin: 5px 0;
}

/* Trip status colors */
.trip-status {
    padding: 5px 15px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
}
