/* ============================================================
   TaiheCarFace - Site Styles
   ============================================================ */

/* ---- CSS Variables ---- */
:root {
    --sidebar-width: 250px;
    --sidebar-collapsed-width: 0;
    --topbar-height: 56px;
    --sidebar-bg: #2c3e50;
    --sidebar-hover: #34495e;
    --sidebar-active: #1a8a5c;
    --sidebar-submenu-bg: #1e2d3d;
    --transition-speed: 0.3s;
}

/* ---- Reset & Global ---- */
html, body {
    height: 100%;
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
        "Helvetica Neue", Arial, "PingFang SC", "Microsoft YaHei", sans-serif;
    background-color: #f4f6f9;
}

/* ============================================================
   Top Navbar
   ============================================================ */
.top-navbar {
    height: var(--topbar-height);
    z-index: 1040;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.top-navbar .navbar-brand {
    font-size: 1.15rem;
    font-weight: 600;
    letter-spacing: 0.5px;
}

/* ============================================================
   Sidebar
   ============================================================ */
.sidebar {
    position: fixed;
    top: var(--topbar-height);
    left: 0;
    width: var(--sidebar-width);
    height: calc(100vh - var(--topbar-height));
    background-color: var(--sidebar-bg);
    overflow-y: auto;
    overflow-x: hidden;
    z-index: 1030;
    transition: transform var(--transition-speed) ease;
}

.sidebar-header {
    padding: 16px 20px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: rgba(255, 255, 255, 0.4);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

/* Sidebar nav list */
.sidebar-nav {
    list-style: none;
    padding: 0;
    margin: 0;
}

/* Section / group */
.nav-section {
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

/* Section header (collapsible toggle) */
.nav-link-header {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    color: rgba(255, 255, 255, 0.85);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s, color 0.2s;
}

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

.nav-section.active > .nav-link-header,
.nav-link-header.active {
    background-color: var(--sidebar-active);
    color: #fff;
}

.nav-link-header i:first-child {
    width: 20px;
    text-align: center;
    margin-right: 10px;
    font-size: 1.05rem;
}

.collapse-icon {
    font-size: 0.75rem;
    transition: transform var(--transition-speed) ease;
}

.nav-link-header[aria-expanded="true"] .collapse-icon {
    transform: rotate(180deg);
}

/* Submenu */
.submenu {
    background-color: var(--sidebar-submenu-bg);
    list-style: none;
    padding: 0;
    margin: 0;
}

.submenu li a {
    display: block;
    padding: 9px 20px 9px 50px;
    color: rgba(255, 255, 255, 0.65);
    text-decoration: none;
    font-size: 0.85rem;
    transition: background-color 0.2s, color 0.2s, padding-left 0.2s;
}

.submenu li a:hover {
    background-color: rgba(255, 255, 255, 0.08);
    color: #fff;
    padding-left: 54px;
}

.submenu li a.active {
    color: #fff;
    background-color: var(--sidebar-active);
    border-left: 3px solid #fff;
    padding-left: 47px;
}

/* Sidebar scrollbar */
.sidebar::-webkit-scrollbar {
    width: 5px;
}
.sidebar::-webkit-scrollbar-thumb {
    background-color: rgba(255, 255, 255, 0.15);
    border-radius: 3px;
}

/* ============================================================
   Main Content
   ============================================================ */
.main-content {
    margin-left: var(--sidebar-width);
    margin-top: var(--topbar-height);
    min-height: calc(100vh - var(--topbar-height));
    transition: margin-left var(--transition-speed) ease;
}

.content-wrapper {
    padding: 24px;
}

/* ============================================================
   Cards
   ============================================================ */
.card {
    border: none;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    transition: box-shadow 0.2s;
}

.card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

.card-header {
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    background-color: #fff;
    font-weight: 600;
    border-radius: 8px 8px 0 0 !important;
}

/* Page header (title bar) */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.page-header h4 {
    margin: 0;
    font-weight: 600;
    color: #2c3e50;
}

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

.table thead th {
    background-color: #f8f9fa;
    border-bottom: 2px solid #dee2e6;
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #6c757d;
    white-space: nowrap;
}

.table-striped > tbody > tr:nth-of-type(odd) > * {
    background-color: #fafbfc;
}

.table-hover > tbody > tr:hover > * {
    background-color: #eef2f7;
}

.table td {
    vertical-align: middle;
    font-size: 0.9rem;
}

/* ============================================================
   Forms
   ============================================================ */
.form-control, .form-select {
    border-radius: 6px;
    border-color: #dce0e4;
    font-size: 0.9rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-control:focus, .form-select:focus {
    border-color: #1a8a5c;
    box-shadow: 0 0 0 0.2rem rgba(26, 138, 92, 0.15);
}

.form-label {
    font-weight: 500;
    font-size: 0.85rem;
    color: #495057;
    margin-bottom: 4px;
}

/* ============================================================
   Buttons
   ============================================================ */
.btn {
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s;
}

.btn-primary {
    background-color: #1a8a5c;
    border-color: #1a8a5c;
}

.btn-primary:hover {
    background-color: #157a50;
    border-color: #157a50;
}

/* ============================================================
   Toast
   ============================================================ */
.toast {
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* ============================================================
   Login Page
   ============================================================ */
.login-body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #2c3e50 0%, #1a8a5c 100%);
}

.login-wrapper {
    width: 100%;
    max-width: 420px;
    padding: 20px;
}

.login-card {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    overflow: hidden;
}

.login-card-header {
    background: var(--sidebar-bg);
    color: #fff;
    text-align: center;
    padding: 30px 20px;
}

.login-card-header i {
    font-size: 2.5rem;
    display: block;
    margin-bottom: 10px;
}

.login-card-header h3 {
    margin: 0;
    font-size: 1.2rem;
    font-weight: 600;
}

.login-card-body {
    padding: 30px;
}

.login-card-body .form-control {
    border-radius: 8px;
    padding: 10px 14px;
    height: auto;
}

.login-card-body .btn-primary {
    padding: 10px;
    font-size: 1rem;
    font-weight: 600;
    width: 100%;
    border-radius: 8px;
}

/* ============================================================
   Pagination (common override)
   ============================================================ */
.pagination .page-link {
    color: #1a8a5c;
    border-radius: 6px !important;
    margin: 0 2px;
}

.pagination .page-item.active .page-link {
    background-color: #1a8a5c;
    border-color: #1a8a5c;
}

/* ============================================================
   Confirm Modal
   ============================================================ */
#confirmModal .modal-content {
    border: none;
    border-radius: 12px;
}

#confirmModal .modal-header {
    border-bottom: 1px solid #eee;
}

#confirmModal .modal-footer {
    border-top: 1px solid #eee;
}

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

    .sidebar.show {
        transform: translateX(0);
    }

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

@media (max-width: 575.98px) {
    .content-wrapper {
        padding: 16px 12px;
    }

    .top-navbar .navbar-brand {
        font-size: 1rem;
    }

    .login-wrapper {
        padding: 12px;
    }
}
