/* ============================================
   TMS Backoffice - Modern Theme
   Inspired by Paces Admin Template
   ============================================ */

:root {
    --sidebar-width: 260px;
    --sidebar-bg: #1e2a3a;
    --sidebar-hover: #2c3e50;
    --sidebar-active: #3498db;
    --sidebar-text: #a4b5c7;
    --sidebar-heading: #6c7f93;
    --topbar-height: 60px;
    --topbar-bg: #ffffff;
    --body-bg: #f4f6f9;
    --card-bg: #ffffff;
    --text-primary: #3c4858;
    --text-muted: #8492a6;
    --border-color: #e8ecf1;
    --primary: #3498db;
    --success: #1abc9c;
    --danger: #e74c3c;
    --warning: #f39c12;
    --info: #00b8d4;
}

* {
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--body-bg);
    color: var(--text-primary);
    font-size: 0.875rem;
}

/* ============================================
   SIDEBAR
   ============================================ */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--sidebar-bg);
    z-index: 1050;
    overflow-y: auto;
    overflow-x: hidden;
    transition: transform 0.3s ease;
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: #fff;
    font-size: 1.1rem;
    font-weight: 600;
}

.sidebar-brand img {
    border-radius: 6px;
}

.sidebar-close-btn {
    background: none;
    border: none;
    color: var(--sidebar-text);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 4px;
}

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

.sidebar-menu {
    list-style: none;
    padding: 0;
    margin: 0;
}

.menu-label {
    padding: 12px 20px 6px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--sidebar-heading);
}

.menu-item {
    margin: 2px 8px;
}

.menu-link {
    display: flex;
    align-items: center;
    padding: 10px 12px;
    color: var(--sidebar-text);
    text-decoration: none;
    border-radius: 6px;
    transition: all 0.2s ease;
    font-size: 0.85rem;
    cursor: pointer;
}

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

.menu-link.active,
.menu-item.active > .menu-link {
    color: #fff;
    background: var(--sidebar-active);
}

.menu-icon {
    font-size: 1.1rem;
    width: 24px;
    margin-right: 10px;
    text-align: center;
    flex-shrink: 0;
}

.menu-arrow {
    margin-left: auto;
    font-size: 0.7rem;
    transition: transform 0.3s ease;
}

.menu-link[aria-expanded="true"] .menu-arrow {
    transform: rotate(180deg);
}

.submenu {
    list-style: none;
    padding: 4px 0 4px 44px;
    margin: 0;
}

.submenu li a {
    display: block;
    padding: 7px 12px;
    color: var(--sidebar-text);
    text-decoration: none;
    font-size: 0.82rem;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.submenu li a:hover {
    color: #fff;
}

.submenu li a.active {
    color: var(--sidebar-active);
}

/* ============================================
   MAIN CONTENT
   ============================================ */
.main-content {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: margin-left 0.3s ease;
}

/* ============================================
   TOPBAR
   ============================================ */
.topbar {
    position: sticky;
    top: 0;
    z-index: 1040;
    background: var(--topbar-bg);
    border-bottom: 1px solid var(--border-color);
    height: var(--topbar-height);
}

.topbar-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    height: 100%;
}

.topbar-toggle {
    background: none;
    border: none;
    font-size: 1.4rem;
    color: var(--text-primary);
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    transition: background 0.2s;
}

.topbar-toggle:hover {
    background: var(--body-bg);
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.topbar-item {
    position: relative;
}

.topbar-link {
    background: none;
    border: none;
    padding: 8px 12px;
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 1.1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: background 0.2s;
}

.topbar-link:hover {
    background: var(--body-bg);
}

.topbar-link::after {
    display: none;
}

.topbar-badge {
    position: absolute;
    top: 4px;
    right: 4px;
    background: var(--danger);
    color: #fff;
    font-size: 0.65rem;
    font-weight: 600;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.notification-dropdown {
    width: 320px;
    padding: 0;
}

.notification-dropdown .dropdown-header {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
}

.notification-list {
    max-height: 280px;
    overflow-y: auto;
}

.notification-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 16px;
    white-space: normal;
}

.notification-dropdown .dropdown-footer {
    padding: 10px 16px;
    border-top: 1px solid var(--border-color);
}

/* ============================================
   PAGE CONTENT
   ============================================ */
.page-content {
    flex: 1;
    padding: 24px;
}

.page-header {
    margin-bottom: 24px;
}

.page-title {
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

/* ============================================
   CARDS
   ============================================ */
.card {
    border: 1px solid var(--border-color);
    border-radius: 10px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
    background: var(--card-bg);
    margin-bottom: 24px;
}

.card-header {
    padding: 16px 20px;
    background: transparent;
    border-bottom: 1px solid var(--border-color);
    font-weight: 600;
    font-size: 0.95rem;
}

.card-body {
    padding: 20px;
}

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

.table > thead > tr > th {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    border-bottom-width: 1px;
    padding: 12px 16px;
    white-space: nowrap;
}

.table > tbody > tr > td {
    padding: 12px 16px;
    vertical-align: middle;
    border-color: var(--border-color);
    color: var(--text-primary);
}

.table > tbody > tr:hover {
    background-color: rgba(52, 152, 219, 0.04);
}

.table-responsive {
    border-radius: 10px;
}

/* ============================================
   BUTTONS
   ============================================ */
.btn {
    font-size: 0.85rem;
    font-weight: 500;
    padding: 8px 16px;
    border-radius: 6px;
    transition: all 0.2s ease;
}

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

.btn-icon {
    width: 32px;
    height: 32px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
}

.btn-icon-sm {
    width: 28px;
    height: 28px;
    font-size: 0.8rem;
}

/* ============================================
   FORMS
   ============================================ */
.form-control,
.form-select {
    border-radius: 6px;
    border-color: var(--border-color);
    font-size: 0.875rem;
    padding: 8px 12px;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 0.2rem rgba(52, 152, 219, 0.15);
}

.form-label {
    font-weight: 500;
    font-size: 0.82rem;
    color: var(--text-primary);
    margin-bottom: 6px;
}

/* ============================================
   BADGES / STATUS
   ============================================ */
.badge {
    font-weight: 500;
    font-size: 0.72rem;
    padding: 4px 8px;
    border-radius: 4px;
}

/* ============================================
   FOOTER
   ============================================ */
.app-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
    background: var(--card-bg);
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: auto;
}

/* ============================================
   KPI TILES (Statistics)
   ============================================ */
.kpi-card {
    text-align: center;
    padding: 20px;
}

.kpi-card .kpi-value {
    font-size: 1.75rem;
    font-weight: 700;
    margin: 8px 0 4px;
}

.kpi-card .kpi-label {
    font-size: 0.82rem;
    color: var(--text-muted);
    font-weight: 500;
}

/* ============================================
   SIDEBAR OVERLAY (MOBILE)
   ============================================ */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1040;
}

body.sidebar-open .sidebar-overlay {
    display: block;
}

/* ============================================
   ACTION BUTTONS IN TABLES
   ============================================ */
.action-btns {
    display: flex;
    gap: 4px;
    align-items: center;
}

.action-btns .btn-icon {
    width: 30px;
    height: 30px;
}

/* ============================================
   ALERTS / MESSAGES
   ============================================ */
.alert {
    border-radius: 8px;
    font-size: 0.85rem;
}

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

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

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

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

    .topbar-inner {
        padding: 0 16px;
    }

    .card-body {
        padding: 16px;
    }

    .table > thead > tr > th,
    .table > tbody > tr > td {
        padding: 8px 10px;
        font-size: 0.8rem;
    }
}

/* ============================================
   NPROGRESS CUSTOMIZATION
   ============================================ */
#nprogress .bar {
    background: var(--primary);
    height: 3px;
}

#nprogress .peg {
    box-shadow: 0 0 10px var(--primary), 0 0 5px var(--primary);
}

/* ============================================
   UTILITIES
   ============================================ */
.row-action {
    margin: 3px;
}
