/* =========================================
   AFCON360 TRANSPORT - BASE STYLES
   Shared across all transport pages
   ========================================= */

/* ----- DESIGN TOKENS ----- */
:root {
    --afcon-green: #006400;
    --afcon-gold: #FFD700;
    --afcon-dark-green: #004d00;
    --afcon-light-green: #e6f2e6;

    --bg-base: var(--bg-body, #f5f4f1);
    --bg-surface: var(--bg-surface, #ffffff);
    --bg-elevated: var(--bg-elevated, #ffffff);
    --bg-hover: var(--bg-surface-alt, #fafaf9);
    --border: rgba(255,255,255,0.07);
    --border-light: rgba(255,255,255,0.12);

    --amber: #f59e0b;
    --amber-bright: #fbbf24;
    --amber-dim: rgba(245,158,11,0.15);
    --green: var(--brand-primary, #16a34a);
    --green-dim: rgba(22,163,74,0.12);
    --red: #ef4444;
    --red-dim: rgba(239,68,68,0.12);
    --blue: #3b82f6;
    --blue-dim: rgba(59,130,246,0.12);
    --purple: #a855f7;
    --purple-dim: rgba(168,85,247,0.12);

    --text-primary: var(--text-primary, #1a1916);
    --text-secondary: var(--text-secondary, #3d3b36);
    --text-muted: var(--text-muted, #8a8880);

    --sidebar-w: 256px;
    --header-h: 60px;
    --radius: 10px;
    --radius-lg: 16px;

    --font-display: 'Syne', sans-serif;
    --font-body: 'DM Sans', sans-serif;
    --font-mono: 'DM Mono', monospace;

    --shadow-card: 0 1px 3px rgba(0,0,0,0.4), 0 4px 16px rgba(0,0,0,0.3);
}

/* ----- RESET & BASE ----- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}
html {
    font-size: 15px;
    -webkit-font-smoothing: antialiased;
}
body {
    font-family: var(--font-body);
    background: var(--bg-base);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }
input, select, textarea { font-family: inherit; }

/* ----- LAYOUT SHELL ----- */
.t-shell {
    display: flex;
    min-height: 100vh;
}

/* ----- SIDEBAR ----- */
.t-sidebar {
    width: var(--sidebar-w);
    background: var(--bg-surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
    transition: transform 0.3s ease;
    overflow: hidden;
}
.t-sidebar::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 1px;
    height: 100%;
    background: linear-gradient(to bottom, transparent, var(--green) 40%, var(--green) 60%, transparent);
    opacity: 0.2;
}
.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 18px 20px;
    border-bottom: 1px solid var(--border);
}
.logo-icon {
    width: 36px; height: 36px;
    background: linear-gradient(135deg, var(--amber) 0%, #d97706 100%);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
}
.logo-text {
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 1.05rem;
}
.logo-text span { color: var(--amber); }

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 12px 0;
}
.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-track { background: transparent; }
.sidebar-nav::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 2px; }

.nav-section-label {
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text-muted);
    padding: 16px 20px 6px;
}
.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 20px;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    transition: all 0.15s ease;
    position: relative;
}
.nav-item:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
}
.nav-item.active {
    color: var(--amber);
    background: var(--amber-dim);
}
.nav-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: var(--amber);
    border-radius: 0 2px 2px 0;
}
.nav-item i {
    width: 16px;
    text-align: center;
    font-size: 0.875rem;
    opacity: 0.8;
}
.nav-item .badge {
    margin-left: auto;
    background: var(--red);
    color: #fff;
    font-size: 0.65rem;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 20px;
    min-width: 18px;
    text-align: center;
}
.nav-item .badge.amber { background: var(--amber); color: #000; }
.nav-item .badge.green { background: var(--green); }

.sidebar-bottom {
    padding: 12px 20px 20px;
    border-top: 1px solid var(--border);
}
.sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px;
    border-radius: var(--radius);
    background: var(--bg-elevated);
    transition: background 0.15s;
}
.sidebar-user:hover { background: var(--bg-hover); }
.user-avatar {
    width: 30px; height: 30px;
    background: linear-gradient(135deg, var(--amber), var(--blue));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-display);
    font-size: 0.75rem;
    font-weight: 700;
}
.user-info {
    flex: 1;
    min-width: 0;
}
.user-name {
    font-size: 0.8rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.user-role {
    font-size: 0.68rem;
    color: var(--text-muted);
}
.logout-link {
    color: var(--text-muted);
    font-size: 0.8rem;
    margin-left: 4px;
}
.logout-link:hover { color: var(--text-primary); }

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 99;
}

/* ----- MAIN CONTENT ----- */
.t-main {
    flex: 1;
    margin-left: var(--sidebar-w);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* ----- TOPBAR ----- */
.t-topbar {
    height: var(--header-h);
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0 24px;
    gap: 16px;
    position: sticky;
    top: 0;
    z-index: 90;
    backdrop-filter: blur(12px);
}
.topbar-toggle {
    display: none;
    color: var(--text-secondary);
    font-size: 1.1rem;
    padding: 4px;
}
.breadcrumb {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    color: var(--text-muted);
    flex: 1;
}
.breadcrumb a:hover { color: var(--amber); }
.breadcrumb .sep { opacity: 0.4; }
.breadcrumb .current { color: var(--text-secondary); font-weight: 500; }

.topbar-search {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 6px 12px;
    width: 240px;
    transition: border-color 0.15s, width 0.3s;
    position: relative;
}
.topbar-search:focus-within {
    border-color: var(--amber);
    width: 300px;
}
.topbar-search i { color: var(--text-muted); font-size: 0.8rem; }
.topbar-search input {
    background: none; border: none; outline: none;
    color: var(--text-primary); font-size: 0.8rem; width: 100%;
}
.search-results-dropdown {
    position: absolute; top: 100%; left: 0; right: 0;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 8px;
    margin-top: 4px;
    max-height: 300px;
    overflow-y: auto;
    z-index: 100;
    display: none;
}
.search-results-dropdown.show { display: block; }

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
}
.topbar-btn {
    position: relative;
    width: 34px; height: 34px;
    display: flex; align-items: center; justify-content: center;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-secondary);
    font-size: 0.875rem;
    transition: all 0.15s;
}
.topbar-btn:hover { color: var(--text-primary); border-color: var(--border-light); }
.topbar-btn .dot {
    position: absolute; top: 6px; right: 6px;
    width: 7px; height: 7px;
    background: var(--red);
    border-radius: 50%;
    border: 2px solid var(--bg-surface);
}
.notification-badge { display: none; }

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

.page-header {
    display: flex; align-items: flex-start; justify-content: space-between;
    margin-bottom: 24px; gap: 16px;
}
.page-title {
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
}
.page-subtitle {
    font-size: 0.82rem;
    color: var(--text-muted);
    margin-top: 3px;
}
.page-actions { display: flex; gap: 8px; flex-shrink: 0; }

/* ----- CARDS ----- */
.card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    overflow: hidden;
}
.card-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
}
.card-title {
    font-family: var(--font-display);
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-primary);
}
.card-body { padding: 20px; }

/* ----- STATS CARDS ----- */
.stat-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    position: relative;
    overflow: hidden;
    transition: border-color 0.2s, transform 0.2s;
}
.stat-card:hover { border-color: var(--border-light); transform: translateY(-1px); }
.stat-card::after {
    content: ''; position: absolute; top: 0; right: 0;
    width: 80px; height: 80px; border-radius: 50%;
    opacity: 0.05; transform: translate(20px, -20px);
}
.stat-card.amber::after { background: var(--amber); }
.stat-card.green::after { background: var(--green); }
.stat-card.blue::after  { background: var(--blue); }
.stat-card.red::after   { background: var(--red); }
.stat-card.purple::after{ background: var(--purple); }

.stat-icon {
    width: 40px; height: 40px;
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1rem; margin-bottom: 12px;
}
.stat-icon.amber { background: var(--amber-dim); color: var(--amber); }
.stat-icon.green { background: var(--green-dim); color: var(--green); }
.stat-icon.blue  { background: var(--blue-dim);  color: var(--blue); }
.stat-icon.red   { background: var(--red-dim);   color: var(--red); }
.stat-icon.purple{ background: var(--purple-dim);color: var(--purple); }

.stat-value {
    font-family: var(--font-display);
    font-size: 1.8rem; font-weight: 800; line-height: 1; margin-bottom: 4px;
}
.stat-label {
    font-size: 0.78rem; color: var(--text-muted); font-weight: 500;
}
.stat-trend {
    display: inline-flex; align-items: center; gap: 3px;
    font-size: 0.72rem; font-weight: 600;
    margin-top: 6px; padding: 2px 6px; border-radius: 4px;
}
.stat-trend.up   { color: var(--green); background: var(--green-dim); }
.stat-trend.down { color: var(--red);   background: var(--red-dim); }

/* ----- BUTTONS ----- */
.btn {
    display: inline-flex; align-items: center; gap: 7px;
    padding: 8px 16px; border-radius: 8px;
    font-size: 0.82rem; font-weight: 600;
    transition: all 0.15s; white-space: nowrap;
    cursor: pointer; text-decoration: none;
}
.btn-primary {
    background: var(--amber); color: #000;
}
.btn-primary:hover { background: var(--amber-bright); }
.btn-secondary {
    background: var(--bg-elevated); color: var(--text-secondary);
    border: 1px solid var(--border);
}
.btn-secondary:hover { color: var(--text-primary); border-color: var(--border-light); }
.btn-danger {
    background: var(--red-dim); color: var(--red);
    border: 1px solid rgba(239,68,68,0.2);
}
.btn-danger:hover { background: rgba(239,68,68,0.2); }
.btn-success {
    background: var(--green-dim); color: var(--green);
    border: 1px solid rgba(34,197,94,0.2);
}
.btn-sm { padding: 5px 10px; font-size: 0.75rem; }
.btn-icon { padding: 7px; width: 34px; height: 34px; justify-content: center; }

/* ----- BADGES / PILLS ----- */
.badge {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 2px 8px; border-radius: 4px;
    font-size: 0.68rem; font-weight: 700; letter-spacing: 0.03em;
}
.badge::before { content: '●'; font-size: 0.5em; }
.badge-green  { background: var(--green-dim);  color: var(--green); }
.badge-amber  { background: var(--amber-dim);  color: var(--amber); }
.badge-red    { background: var(--red-dim);    color: var(--red); }
.badge-blue   { background: var(--blue-dim);   color: var(--blue); }
.badge-purple { background: var(--purple-dim); color: var(--purple); }
.badge-gray   { background: rgba(148,163,184,0.1); color: var(--text-muted); }

/* ----- TABLES ----- */
.t-table-wrap { overflow-x: auto; }
table.t-table {
    width: 100%; border-collapse: collapse;
}
.t-table th {
    font-size: 0.7rem; font-weight: 700; letter-spacing: 0.06em;
    text-transform: uppercase; color: var(--text-muted);
    padding: 10px 14px; text-align: left;
    border-bottom: 1px solid var(--border);
    background: var(--bg-elevated); white-space: nowrap;
}
.t-table td {
    padding: 12px 14px; font-size: 0.82rem; color: var(--text-secondary);
    border-bottom: 1px solid var(--border); vertical-align: middle;
}
.t-table tr:last-child td { border-bottom: none; }
.t-table tbody tr:hover td { background: var(--bg-elevated); }
.t-table .td-primary { color: var(--text-primary); font-weight: 500; }
.t-table .td-mono { font-family: var(--font-mono); font-size: 0.78rem; }

/* ----- FORMS ----- */
.form-group { margin-bottom: 16px; }
.form-label {
    display: block; font-size: 0.75rem; font-weight: 600;
    color: var(--text-secondary); margin-bottom: 6px; letter-spacing: 0.03em;
}
.form-label .req { color: var(--red); margin-left: 2px; }
.form-control {
    width: 100%; background: var(--bg-elevated);
    border: 1px solid var(--border); border-radius: 8px;
    color: var(--text-primary); padding: 9px 12px;
    font-size: 0.85rem; transition: border-color 0.15s, box-shadow 0.15s;
    outline: none;
}
.form-control:focus { border-color: var(--amber); box-shadow: 0 0 0 3px var(--amber-dim); }
.form-control::placeholder { color: var(--text-muted); }
select.form-control option { background: var(--bg-elevated); }
.form-hint { font-size: 0.72rem; color: var(--text-muted); margin-top: 4px; }
.form-error { font-size: 0.72rem; color: var(--red); margin-top: 4px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }

/* ----- ALERTS / FLASH MESSAGES ----- */
.flash-messages { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.alert {
    display: flex; align-items: flex-start; gap: 10px;
    padding: 12px 16px; border-radius: var(--radius);
    font-size: 0.82rem; margin-bottom: 16px;
}
.alert i { margin-top: 1px; flex-shrink: 0; }
.alert-amber { background: var(--amber-dim); color: var(--amber); border: 1px solid rgba(245,158,11,0.2); }
.alert-red    { background: var(--red-dim);  color: var(--red);   border: 1px solid rgba(239,68,68,0.2); }
.alert-green  { background: var(--green-dim);color: var(--green); border: 1px solid rgba(34,197,94,0.2); }
.alert-blue   { background: var(--blue-dim); color: var(--blue);  border: 1px solid rgba(59,130,246,0.2); }
.alert-close {
    margin-left: auto; background: transparent; border: none;
    color: currentColor; opacity: 0.6; cursor: pointer;
}
.alert-close:hover { opacity: 1; }

/* ----- LIVE INDICATOR ----- */
.live-dot {
    display: inline-flex; align-items: center; gap: 5px;
    font-size: 0.7rem; font-weight: 700; color: var(--green);
    letter-spacing: 0.06em;
}
.live-dot::before {
    content: ''; width: 7px; height: 7px;
    background: var(--green); border-radius: 50%;
    animation: pulse 2s ease infinite;
}
@keyframes pulse {
    0%,100% { box-shadow: 0 0 0 0 rgba(34,197,94,0.5); }
    50%     { box-shadow: 0 0 0 5px rgba(34,197,94,0); }
}

/* ----- EMPTY STATE ----- */
.empty-state {
    text-align: center; padding: 48px 24px; color: var(--text-muted);
}
.empty-state i { font-size: 2.5rem; margin-bottom: 12px; opacity: 0.3; }
.empty-state h3 {
    font-family: var(--font-display); font-size: 1rem; font-weight: 700;
    color: var(--text-secondary); margin-bottom: 6px;
}
.empty-state p { font-size: 0.82rem; }

/* ----- PAGINATION ----- */
.pagination {
    display: flex; align-items: center; gap: 4px;
    padding: 16px 20px; border-top: 1px solid var(--border);
}
.page-btn {
    min-width: 32px; height: 32px;
    display: flex; align-items: center; justify-content: center;
    font-size: 0.8rem; border-radius: 6px;
    color: var(--text-secondary); border: 1px solid var(--border);
    transition: all 0.15s; cursor: pointer;
}
.page-btn:hover { border-color: var(--amber); color: var(--amber); }
.page-btn.active { background: var(--amber); color: #000; border-color: var(--amber); font-weight: 700; }
.page-info { margin-left: auto; font-size: 0.75rem; color: var(--text-muted); }

/* ----- GRID HELPERS ----- */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3,1fr); gap: 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(4,1fr); gap: 16px; }
.grid-stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px,1fr)); gap: 14px; }

/* ----- RESPONSIVE ----- */
@media (max-width:1024px) {
    :root { --sidebar-w:220px; }
    .grid-4 { grid-template-columns: repeat(2,1fr); }
}
@media (max-width:768px) {
    .t-sidebar { transform: translateX(-100%); }
    .t-sidebar.open { transform: translateX(0); box-shadow: 4px 0 24px rgba(0,0,0,0.5); }
    .t-main { margin-left: 0; }
    .topbar-toggle { display: flex; }
    .topbar-search { display: none; }
    .grid-3 { grid-template-columns: 1fr 1fr; }
    .grid-2 { grid-template-columns: 1fr; }
    .page-header { flex-direction: column; }
    .t-content { padding: 16px; }
}
@media (max-width:480px) {
    .grid-3, .grid-4 { grid-template-columns: 1fr; }
    .grid-stats { grid-template-columns: 1fr 1fr; }
    .stat-value { font-size: 1.4rem; }
}
