/* Fleet Management System - Custom Styles */
/* Based on E-Barangay Design System */

/* Critical CSS for preventing FOUC - Load First */
html {
    font-size: 16px;
    line-height: 1.5;
}

body {
    font-family: 'Inter', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-size: 0.875rem;
    line-height: 1.6;
    color: #374151;
    background-color: #f8fafc;
    margin: 0;
    padding: 0;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Ensure content is hidden until CSS loads */
.main-content,
.dashboard-layout,
.login-container {
    opacity: 1;
    transition: opacity 0.3s ease-in-out;
}

/* Loading states */
body:not(.loaded) .main-content,
body:not(.loaded) .dashboard-layout,
body:not(.loaded) .login-container {
    visibility: hidden;
}

body.loaded .main-content,
body.loaded .dashboard-layout,
body.loaded .login-container {
    visibility: visible;
}

/* E-Barangay Color Scheme - Bootstrap Overrides */
.btn-primary {
    background-color: #f97316 !important;
    border-color: #f97316 !important;
    color: white !important;
}

.btn-primary:hover,
.btn-primary:focus,
.btn-primary:active {
    background-color: #ea580c !important;
    border-color: #ea580c !important;
    color: white !important;
    box-shadow: 0 4px 15px rgba(249, 115, 22, 0.3) !important;
}

.bg-primary {
    background-color: #f97316 !important;
}

.text-primary {
    color: #f97316 !important;
}

.border-primary {
    border-color: #f97316 !important;
}

/* E-Barangay CSS Variables - Exact Color Match */
:root {
    /* Primary E-Barangay Colors - Matching the image */
    --primary-color: #f97316;        /* Orange from the image */
    --secondary-color: #ea580c;      /* Darker orange */
    --primary-orange: #f97316;       /* Main orange */
    --accent-orange: #ea580c;        /* Accent orange */
    --light-orange: #fed7aa;         /* Very light orange */
    --warm-white: #ffffff;           /* Pure white background */
    --warm-gray: #6b7280;            /* Gray text */
    --dark-gray: #374151;            /* Dark gray text */

    /* System Colors */
    --success-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --info-color: #3b82f6;
    --light-color: #f9fafb;
    --dark-color: #1f2937;

    /* Layout Variables */
    --sidebar-width: 280px;
    --sidebar-collapsed-width: 80px;
    --header-height: 70px;
    --border-color: #e5e7eb;
    --text-muted: #6b7280;
    --bg-primary: #ffffff;
    --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 -2px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
}

body {
    background-color: var(--light-color);
    font-family: 'Inter', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    margin: 0;
    padding: 0;
}

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

/* Sidebar Styles */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-primary);
    border-right: 1px solid var(--border-color);
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 1000;
    transition: all 0.3s ease;
    overflow-y: auto;
    box-shadow: var(--shadow-sm);
}

.sidebar.collapsed {
    width: var(--sidebar-collapsed-width);
}

.sidebar-header {
    padding: 1.5rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    min-height: 100px;
}

.sidebar-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.sidebar-logo i {
    color: var(--primary-color);
    font-size: 1.2rem;
}

.sidebar-title {
    font-size: 1.1rem;
    font-weight: 600;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin: 0;
    transition: opacity 0.3s ease;
    line-height: 1.2;
}

.sidebar.collapsed .sidebar-title {
    opacity: 0;
    display: none;
}

.sidebar-nav {
    padding: 1rem 0;
}

.nav-section {
    margin-bottom: 2rem;
}

.nav-section-title {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0 1.5rem;
    margin-bottom: 0.5rem;
    transition: opacity 0.3s ease;
}

.sidebar.collapsed .nav-section-title {
    opacity: 0;
    display: none;
}

.nav-item {
    margin: 0.25rem 0.75rem;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: 10px;
    transition: all 0.2s ease;
    font-weight: 500;
    position: relative;
}

.nav-link:hover {
    background: #f1f5f9;
    color: var(--primary-color);
    text-decoration: none;
}

.nav-link.active {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    box-shadow: var(--shadow-md);
}

.nav-link.active:hover {
    color: white;
}

.nav-icon {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
}

.nav-text {
    transition: opacity 0.3s ease;
}

.sidebar.collapsed .nav-text {
    opacity: 0;
    display: none;
}

.nav-badge {
    background: var(--danger-color);
    color: white;
    font-size: 0.7rem;
    padding: 0.2rem 0.5rem;
    border-radius: 10px;
    margin-left: auto;
    min-width: 18px;
    text-align: center;
    position: relative;
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    transition: margin-left 0.3s ease;
    min-height: 100vh;
    background: var(--light-color);
}

.main-content.sidebar-collapsed {
    margin-left: var(--sidebar-collapsed-width);
}

/* Top Header */
.top-header {
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-sm);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.sidebar-toggle {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.25rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.sidebar-toggle:hover {
    background: #f1f5f9;
    color: var(--primary-color);
}

.page-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--dark-color);
    margin: 0;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 10px;
    transition: background 0.2s ease;
}

.user-menu:hover {
    background: #f1f5f9;
}

.user-avatar {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 0.9rem;
}

.user-info {
    display: flex;
    flex-direction: column;
}

.user-name {
    font-weight: 600;
    color: var(--dark-color);
    font-size: 0.9rem;
    line-height: 1.2;
}

.user-role {
    font-size: 0.75rem;
    color: var(--text-muted);
    line-height: 1.2;
}

/* Dashboard Content */
.dashboard-content {
    padding: 2rem;
}

/* Modern Cards */
.modern-card {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    box-shadow: var(--shadow-sm);
    transition: all 0.3s ease;
    overflow: hidden;
}

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

.card-header-modern {
    padding: 1.5rem 1.5rem 0;
    border: none;
    background: transparent;
}

.card-title-modern {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--dark-color);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.card-body-modern {
    padding: 1.5rem;
}

/* Stats Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stats-card-modern {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 1.5rem;
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

.stats-card-modern::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
}

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

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

.stats-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: white;
}

.stats-icon.primary {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
}

.stats-icon.success {
    background: linear-gradient(135deg, var(--success-color), #059669);
}

.stats-icon.warning {
    background: linear-gradient(135deg, var(--warning-color), #d97706);
}

.stats-icon.danger {
    background: linear-gradient(135deg, var(--danger-color), #dc2626);
}

.stats-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--dark-color);
    line-height: 1;
    margin-bottom: 0.25rem;
}

.stats-label {
    font-size: 0.875rem;
    color: var(--text-muted);
    font-weight: 500;
}

/* Tables */
.table-custom {
    background: white;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.08);
}

.table-custom thead {
    background: var(--primary-color);
    color: white;
}

.table-custom th {
    border: none;
    font-weight: 600;
    padding: 1rem;
}

.table-custom td {
    border: none;
    padding: 1rem;
    vertical-align: middle;
}

.table-custom tbody tr {
    border-bottom: 1px solid #eee;
    transition: background-color 0.3s ease;
}

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

/* Buttons */
.btn-custom {
    border-radius: 8px;
    font-weight: 500;
    padding: 8px 20px;
    transition: all 0.3s ease;
}

.btn-custom:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

/* Enhanced Button Styles */
.btn-gradient-primary {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%) !important;
    border: none !important;
    color: white !important;
    font-weight: 600 !important;
    padding: 0.75rem 1.5rem !important;
    border-radius: 12px !important;
    box-shadow: 0 4px 15px rgba(37, 99, 235, 0.3) !important;
    transition: all 0.3s ease !important;
    position: relative !important;
    overflow: hidden !important;
}

.btn-gradient-primary:hover {
    transform: translateY(-2px) !important;
    box-shadow: 0 8px 25px rgba(255, 107, 53, 0.4) !important;
    color: white !important;
}

.btn-gradient-primary:active {
    transform: translateY(0) !important;
}

/* Action Buttons Group */
.action-buttons-group {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    align-items: center;
}

.btn-action {
    width: 36px !important;
    height: 36px !important;
    border-radius: 8px !important;
    border: none !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 0.9rem !important;
    cursor: pointer !important;
    transition: all 0.3s ease !important;
    position: relative !important;
    overflow: hidden !important;
    padding: 0 !important;
    margin: 0 !important;
}

.btn-action:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

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

/* Edit Button */
.btn-action-edit {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%) !important;
    color: white !important;
}

.btn-action-edit:hover {
    box-shadow: 0 4px 12px rgba(79, 172, 254, 0.4) !important;
    color: white !important;
}

/* Delete Button */
.btn-action-delete {
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a52 100%) !important;
    color: white !important;
}

.btn-action-delete:hover {
    box-shadow: 0 4px 12px rgba(255, 107, 107, 0.4) !important;
    color: white !important;
}

/* View Button */
.btn-action-view {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%) !important;
    color: white !important;
}

.btn-action-view:hover {
    box-shadow: 0 4px 12px rgba(255, 107, 53, 0.4) !important;
    color: white !important;
}

/* Forms */
.form-control {
    border-radius: 8px;
    border: 2px solid #e9ecef;
    transition: border-color 0.3s ease;
}

.form-control:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(255, 107, 53, 0.25);
}

/* Alerts */
.alert {
    border: none;
    border-radius: 10px;
    font-weight: 500;
}

/* Status badges */
.badge-status {
    padding: 8px 12px;
    border-radius: 20px;
    font-weight: 500;
    font-size: 0.8rem;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.mobile-open {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
    }

    .stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    }
}

@media (max-width: 768px) {
    .dashboard-content {
        padding: 1rem;
    }

    .top-header {
        padding: 1rem;
    }

    .user-info {
        display: none;
    }

    .stats-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
}

/* Mobile Overlay */
.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

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

/* Scrollbar Styling */
.sidebar::-webkit-scrollbar {
    width: 4px;
}

.sidebar::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 2px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}
