/* 
 * FleetOS™ Premium Core Theme & Stylesheet
 * Brand Identity: Charcoal/Graphite Base with Operational Amber & Electric Blue
 * Developed by Damerax Cloud Solutions
 */

:root {
    --bg-base: #0f131a;
    --bg-surface: #151b26;
    --bg-surface-elevated: #1e2638;
    --border-color: #263147;
    --text-main: #f1f5f9;
    --text-muted: #94a3b8;
    --color-success: #10b981;
    --color-danger: #ef4444;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.3), 0 4px 6px -2px rgba(0, 0, 0, 0.15);
    --transition-fast: 0.15s ease;
    --transition-normal: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    background-color: var(--bg-base);
    color: var(--text-main);
    font-family: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    font-size: 16px;
    line-height: 1.5;
    overflow-x: hidden;
    min-height: 100vh;
}

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

a:hover {
    color: var(--color-accent);
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: var(--bg-base);
}
::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* Layout Grid Structure */
.layout-shell {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.container {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* Flex Utilities */
.flex { display: flex; }
.flex-column { flex-direction: column; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.align-center { align-items: center; }
.flex-wrap { flex-wrap: wrap; }
.gap-1 { gap: 0.25rem; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 1rem; }
.gap-4 { gap: 1.5rem; }
.flex-1 { flex: 1; }

/* Grid Utilities */
.grid {
    display: grid;
    gap: 1.5rem;
}
.grid-cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid-cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid-cols-4 { grid-template-columns: repeat(4, 1fr); }

@media (max-width: 1024px) {
    .grid-cols-4 { grid-template-columns: repeat(2, 1fr); }
    .grid-cols-3 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
    .grid-cols-4 { grid-template-columns: 1fr; }
    .grid-cols-3 { grid-template-columns: 1fr; }
    .grid-cols-2 { grid-template-columns: 1fr; }
}

/* Global Header styling */
.app-header {
    background-color: var(--bg-surface);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
    height: 70px;
    box-shadow: var(--shadow-md);
}

.header-container {
    height: 100%;
}

.brand-link {
    display: flex;
    align-items: center;
    color: var(--text-main);
    font-weight: 700;
    font-size: 1.25rem;
    letter-spacing: 0.5px;
}

.brand-logo {
    max-height: 40px;
    object-fit: contain;
}

.brand-icon {
    width: 38px;
    height: 38px;
    background: linear-gradient(135deg, var(--color-primary), var(--color-accent));
    border-radius: 8px;
    color: #fff;
    box-shadow: 0 0 12px rgba(59, 130, 246, 0.3);
}

.brand-name {
    text-transform: uppercase;
    background: linear-gradient(to right, #ffffff, #cbd5e1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Language Switcher */
.lang-switcher {
    background-color: var(--bg-base);
    border: 1px solid var(--border-color);
    padding: 4px 8px;
    border-radius: 20px;
}

.lang-btn {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    padding: 2px 6px;
    border-radius: 10px;
}

.lang-btn.active {
    color: #fff;
    background-color: var(--color-primary);
}

.lang-divider {
    color: var(--border-color);
    font-size: 0.75rem;
}

/* User Menu & Logout */
.user-menu {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.user-name-display {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-muted);
}

.logout-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background-color: var(--bg-surface-elevated);
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.logout-btn:hover {
    color: var(--color-danger);
    border-color: rgba(239, 68, 68, 0.4);
    background-color: rgba(239, 68, 68, 0.05);
}

/* Main Body & Sidebar layout */
.main-body-container {
    display: flex;
    flex: 1;
    position: relative;
    padding-top: 1.5rem;
    padding-bottom: 3rem;
}

.sidebar {
    width: 250px;
    flex-shrink: 0;
    margin-right: 2rem;
    display: flex;
    flex-direction: column;
}

.sidebar-nav-list {
    position: sticky;
    top: 90px;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.sidebar-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    color: var(--text-muted);
    font-weight: 500;
    transition: all var(--transition-fast);
}

.sidebar-item svg {
    color: var(--text-muted);
    transition: stroke var(--transition-fast);
}

.sidebar-item:hover, .sidebar-item.active {
    color: #fff;
    background-color: var(--bg-surface);
    box-shadow: var(--shadow-sm);
}

.sidebar-item.active {
    border-left: 3px solid var(--color-primary);
    border-radius: 0 8px 8px 0;
    padding-left: calc(1rem - 3px);
}

.sidebar-item:hover svg, .sidebar-item.active svg {
    stroke: var(--color-primary);
}

.sidebar-item.active:hover svg {
    stroke: var(--color-accent);
}

.main-content {
    flex: 1;
    min-width: 0;
}

/* Hamburger mobile button */
.mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    flex-direction: column;
    justify-content: space-between;
    width: 20px;
    height: 14px;
}

.mobile-menu-toggle .bar {
    width: 100%;
    height: 2px;
    background-color: var(--text-main);
    border-radius: 1px;
    transition: all var(--transition-fast);
}

/* Responsive sidebars */
@media (max-width: 900px) {
    .mobile-menu-toggle {
        display: flex;
    }
    
    .sidebar {
        position: fixed;
        top: 70px;
        left: -270px;
        height: calc(100vh - 70px);
        background-color: var(--bg-surface);
        z-index: 99;
        margin-right: 0;
        padding: 1.5rem;
        box-shadow: var(--shadow-lg);
        transition: left var(--transition-normal);
        border-right: 1px solid var(--border-color);
        width: 250px;
    }
    
    .sidebar.open {
        left: 0;
    }
    
    .sidebar-nav-list {
        position: static;
    }
}

/* PWA Banner */
.offline-banner {
    background-color: var(--color-danger);
    color: #fff;
    font-size: 0.875rem;
    font-weight: 500;
    padding: 8px 0;
    position: sticky;
    top: 70px;
    z-index: 101;
    text-align: center;
    box-shadow: var(--shadow-sm);
    animation: slideDown 0.3s ease-out;
}

.btn-close-banner {
    background: none;
    border: none;
    color: #fff;
    font-size: 1.25rem;
    cursor: pointer;
    line-height: 1;
}

@keyframes slideDown {
    from { transform: translateY(-100%); }
    to { transform: translateY(0); }
}

/* Dashboard Cards styling */
.dashboard-grid {
    grid-template-columns: repeat(4, 1fr);
}

@media (max-width: 1200px) {
    .dashboard-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}
@media (max-width: 600px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
}

.card {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: var(--shadow-md);
    transition: transform var(--transition-fast), border-color var(--transition-fast);
}

.card:hover {
    transform: translateY(-2px);
    border-color: var(--color-primary);
}

.card-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.75rem;
}

.card-value {
    font-size: 2rem;
    font-weight: 700;
    line-height: 1;
    margin-bottom: 0.5rem;
    background: linear-gradient(135deg, #fff, #94a3b8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.card-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.card-icon-wrapper {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-icon {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    background-color: var(--bg-surface-elevated);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-primary);
}

/* Alerts Block */
.alert {
    padding: 1rem 1.25rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    font-weight: 500;
    border: 1px solid transparent;
}

.alert-success {
    background-color: rgba(16, 185, 129, 0.05);
    border-color: rgba(16, 185, 129, 0.3);
    color: var(--color-success);
}

.alert-warning {
    background-color: rgba(245, 158, 11, 0.05);
    border-color: rgba(245, 158, 11, 0.3);
    color: var(--color-accent);
}

.alert-danger {
    background-color: rgba(239, 68, 68, 0.05);
    border-color: rgba(239, 68, 68, 0.3);
    color: var(--color-danger);
}

/* Common UI Elements: Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
    border: 1px solid transparent;
    text-align: center;
    font-size: 0.875rem;
}

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

.btn-primary:hover {
    background-color: var(--color-accent);
    box-shadow: 0 0 12px rgba(245, 158, 11, 0.4);
    color: #fff !important;
}

.btn-accent {
    background-color: var(--color-accent);
    color: #fff;
}

.btn-accent:hover {
    opacity: 0.9;
}

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

.btn-danger:hover {
    opacity: 0.9;
}

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

.btn-secondary:hover {
    background-color: var(--border-color);
}

.btn-outline {
    background: transparent;
    border-color: var(--color-primary);
    color: var(--color-primary);
}

.btn-outline:hover {
    background-color: var(--color-primary);
    color: #fff;
}

.btn-sm {
    padding: 0.375rem 0.75rem;
    border-radius: 6px;
    font-size: 0.75rem;
}

/* Form Styles */
.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.form-control {
    width: 100%;
    min-height: 46px;
    background-color: var(--bg-surface-elevated);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-main);
    padding: 0.75rem 1rem;
    font-family: inherit;
    font-size: 0.95rem;
    transition: all var(--transition-fast);
}

.form-control:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    background-size: 1.2rem;
    padding-right: 2.5rem;
}

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

/* Data Tables */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    background-color: var(--bg-surface);
}

.table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 0.925rem;
}

.table th, .table td {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border-color);
}

.table th {
    background-color: var(--bg-surface-elevated);
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.5px;
}

.table tr:last-child td {
    border-bottom: none;
}

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

.table tbody tr:hover {
    background-color: rgba(255, 255, 255, 0.015);
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.625rem;
    border-radius: 50px;
    font-size: 0.725rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-success {
    background-color: rgba(16, 185, 129, 0.1);
    color: var(--color-success);
}

.badge-warning {
    background-color: rgba(245, 158, 11, 0.1);
    color: var(--color-accent);
}

.badge-danger {
    background-color: rgba(239, 68, 68, 0.1);
    color: var(--color-danger);
}

.badge-secondary {
    background-color: rgba(148, 163, 184, 0.1);
    color: var(--text-muted);
}

/* Section Header */
.section-header {
    margin-bottom: 1.5rem;
}

.section-title {
    font-size: 1.5rem;
    font-weight: 700;
}

.section-subtitle {
    font-size: 0.875rem;
    color: var(--text-muted);
}

/* Footer Section */
.app-footer {
    background-color: var(--bg-surface);
    border-top: 1px solid var(--border-color);
    padding: 1.25rem 0;
    font-size: 0.825rem;
    color: var(--text-muted);
    margin-top: auto;
}

.footer-container {
    height: 100%;
}

.version-label {
    background-color: var(--bg-base);
    padding: 2px 8px;
    border-radius: 4px;
    border: 1px solid var(--border-color);
}

/* Login Page specific layout */
.login-body {
    background-color: var(--bg-base);
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 1.5rem;
}

.login-card {
    width: 100%;
    max-width: 440px;
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 2.5rem 2rem;
    box-shadow: var(--shadow-lg);
}

.login-logo-wrapper {
    text-align: center;
    margin-bottom: 2rem;
}

.login-logo {
    max-height: 50px;
    margin: 0 auto;
}

.login-brand-icon {
    width: 50px;
    height: 50px;
    margin: 0 auto 0.75rem;
    background: linear-gradient(135deg, var(--color-primary), var(--color-accent));
    border-radius: 12px;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 16px rgba(59, 130, 246, 0.4);
}

.login-title {
    font-size: 1.25rem;
    font-weight: 700;
    text-align: center;
    margin-bottom: 0.5rem;
}

.login-subtitle {
    font-size: 0.875rem;
    color: var(--text-muted);
    text-align: center;
    margin-bottom: 2rem;
}

/* Details and Info Grids */
.details-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.info-item {
    background-color: var(--bg-surface-elevated);
    padding: 1rem;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.info-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.info-value {
    font-weight: 600;
    font-size: 1rem;
}

.hidden {
    display: none !important;
}
