/* =========================================================
   SLW Cargo Admin - Clean, Simple & Modern Design System
   ========================================================= */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

/* --- Reset & Variables --- */
:root {
    --primary: #4f46e5;
    --primary-hover: #4338ca;
    --primary-light: #eef2ff;
    --bg-main: #f8fafc;
    --bg-card: #ffffff;
    --border-color: #e2e8f0;
    --border-hover: #cbd5e1;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --text-light: #94a3b8;
    --sidebar-bg: #0f172a;
    --sidebar-surface: #1e293b;
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.05);
    --shadow-md: 0 4px 12px rgba(15, 23, 42, 0.06);
    --shadow-lg: 0 10px 25px rgba(15, 23, 42, 0.08);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

html, body {
    height: 100%;
}

body {
    background-color: var(--bg-main);
    color: var(--text-main);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

/* =========================
   Layout Structure
========================= */
.admin-container {
    display: flex;
    min-height: 100vh;
}

/* =========================
   Sidebar
========================= */
.sidebar {
    width: 230px;
    min-width: 230px;
    height: 100vh;
    background: var(--sidebar-bg);
    color: #f8fafc;
    position: fixed;
    top: 0;
    left: 0;
    transition: left 0.25s ease, box-shadow 0.25s ease;
    z-index: 1100;
    overflow-y: auto;
    overflow-x: hidden;
    border-right: 1px solid rgba(255, 255, 255, 0.08);
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.15) transparent;
}

.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.15); border-radius: 4px; }

.sidebar .logo {
    padding: 20px 18px;
    background: var(--sidebar-surface);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.sidebar .logo h2 {
    font-size: 16px;
    font-weight: 700;
    letter-spacing: 0.5px;
    color: #ffffff;
    display: flex;
    align-items: center;
    gap: 8px;
}

.sidebar-close-btn {
    display: none;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: #cbd5e1;
    border-radius: var(--radius-sm);
    width: 30px;
    height: 30px;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
}
.sidebar-close-btn:hover { background: rgba(255, 255, 255, 0.2); color: #fff; }

.sidebar .menu {
    list-style: none;
    padding: 12px 10px 30px;
}

.sidebar .menu li {
    margin-bottom: 3px;
}

.sidebar .menu li a {
    color: #94a3b8;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: var(--radius-md);
    transition: all 0.2s ease;
    font-size: 13.5px;
    font-weight: 500;
}

.sidebar .menu li a i {
    width: 18px;
    text-align: center;
    font-size: 14px;
    color: #64748b;
    transition: color 0.2s;
}

.sidebar .menu li a:hover {
    background: rgba(255, 255, 255, 0.06);
    color: #ffffff;
}

.sidebar .menu li a:hover i {
    color: #818cf8;
}

.sidebar .menu li a.active {
    background: var(--primary);
    color: #ffffff;
    font-weight: 600;
}

.sidebar .menu li a.active i {
    color: #ffffff;
}

/* =========================
   Mobile Overlay
========================= */
.overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(2px);
    opacity: 0;
    visibility: hidden;
    transition: all 0.25s ease;
    z-index: 1050;
}
.overlay.active { opacity: 1; visibility: visible; }

/* =========================
   Main Content Area
========================= */
.main-content {
    margin-left: 230px;
    width: calc(100% - 230px);
    transition: margin-left 0.25s ease, width 0.25s ease;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* =========================
   Topbar
========================= */
.topbar {
    background: var(--bg-card);
    padding: 12px 28px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 1000;
    min-height: 58px;
}

.topbar .toggle-btn {
    font-size: 18px;
    cursor: pointer;
    color: var(--text-main);
    display: none;
    padding: 8px;
    border-radius: var(--radius-sm);
    background: var(--bg-main);
    border: 1px solid var(--border-color);
}
.topbar .toggle-btn:hover { background: #e2e8f0; }

.admin-user {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13.5px;
    font-weight: 500;
    color: var(--text-muted);
}
.admin-user a {
    color: #ef4444;
    text-decoration: none;
    font-weight: 600;
    margin-left: 4px;
}
.admin-user a:hover { text-decoration: underline; }

/* =========================
   Content Container
========================= */
.content {
    padding: 24px 28px;
    flex: 1;
}

/* =========================
   Page Header
========================= */
.page-header {
    margin-bottom: 20px;
}

.page-header h2 {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.muted {
    color: var(--text-muted);
    font-size: 13.5px;
}

/* =========================
   Simple Dashboard Cards
========================= */
.dash-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-top: 16px;
    margin-bottom: 24px;
}

.dash-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 18px;
    box-shadow: var(--shadow-sm);
    display: flex;
    gap: 14px;
    align-items: center;
    transition: all 0.2s ease;
    cursor: pointer;
    text-decoration: none;
    color: inherit;
}

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

.dash-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    background: var(--primary-light);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}

.dash-number {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-main);
    line-height: 1.2;
}

.dash-label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted);
    margin-top: 2px;
}

.dash-actions {
    margin-top: 20px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}

/* =========================
   Buttons (Clean & Unified)
========================= */
.btn {
    padding: 9px 16px;
    border-radius: var(--radius-md);
    text-decoration: none;
    font-weight: 600;
    font-size: 13.5px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all 0.2s ease;
    border: 1px solid transparent;
    min-height: 38px;
    white-space: nowrap;
}

.btn-primary {
    background: var(--primary);
    color: #ffffff;
}
.btn-primary:hover {
    background: var(--primary-hover);
    color: #ffffff;
    box-shadow: var(--shadow-sm);
}

.btn-outline {
    background: var(--bg-card);
    color: var(--text-main);
    border-color: var(--border-color);
}
.btn-outline:hover {
    background: var(--bg-main);
    border-color: var(--border-hover);
}

.btn-danger {
    background: #ef4444;
    color: #ffffff;
}
.btn-danger:hover { background: #dc2626; color: #ffffff; }

.btn-sm {
    padding: 6px 12px;
    font-size: 12.5px;
    min-height: 32px;
    border-radius: var(--radius-sm);
}

.btn-full { width: 100%; }

/* =========================
   Search & Filter Containers
========================= */
.search-container {
    background: var(--bg-card);
    padding: 16px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    margin-bottom: 20px;
}

/* =========================
   Forms (Clean UI)
========================= */
.form-card,
.content form:not([id]) {
    max-width: 600px;
    width: 100%;
    background: var(--bg-card);
    padding: 24px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
}

.form-group {
    margin-bottom: 16px;
}

.form-group label,
.content form label {
    display: block;
    margin-bottom: 6px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-main);
}

.content form input[type="text"],
.content form input[type="number"],
.content form input[type="date"],
.content form input[type="email"],
.content form input[type="tel"],
.content form input[type="password"],
.content form select,
.content form textarea,
.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    outline: none;
    background: #ffffff;
    transition: all 0.2s ease;
    font-size: 13.5px;
    color: var(--text-main);
    min-height: 40px;
}

.content form input:focus,
.content form select:focus,
.content form textarea:focus,
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.12);
}

.content form textarea,
.form-group textarea {
    min-height: 90px;
    resize: vertical;
}

/* =========================
   Tables (Crisp & Simple)
========================= */
.table-wrap {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    overflow-x: auto;
    width: 100%;
    -webkit-overflow-scrolling: touch;
}

.table-wrap::-webkit-scrollbar { height: 5px; }
.table-wrap::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; }

.content table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-card);
    text-align: left;
}

.content table th {
    background: #f8fafc;
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 12px 14px;
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
}

.content table td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--border-color);
    font-size: 13px;
    color: var(--text-main);
    vertical-align: middle;
}

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

.content table tr:hover td {
    background: #f8fafc;
}

.content table td a {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 5px 10px;
    border-radius: var(--radius-sm);
    text-decoration: none;
    font-weight: 500;
    font-size: 12px;
    border: 1px solid var(--border-color);
    background: #ffffff;
    color: var(--text-main);
    transition: all 0.2s ease;
    white-space: nowrap;
}

.content table td a:hover {
    background: var(--primary);
    border-color: var(--primary);
    color: #ffffff;
}

/* =========================
   Action Dropdown Menu
========================= */
.action-dropdown {
    position: relative;
    display: inline-block;
}

.action-btn {
    padding: 6px 12px;
    border-radius: var(--radius-md);
    background: #ffffff;
    border: 1px solid var(--border-color);
    color: var(--text-main);
    font-size: 12.5px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.action-btn:hover, .action-dropdown.active .action-btn {
    background: var(--bg-main);
    border-color: var(--primary);
    color: var(--primary);
}

.action-menu {
    display: none;
    position: absolute;
    right: 0;
    top: calc(100% + 4px);
    background: #ffffff;
    min-width: 160px;
    box-shadow: 0 10px 25px rgba(15, 23, 42, 0.12);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 6px;
    z-index: 1200;
    text-align: left;
}

.action-dropdown.active .action-menu {
    display: block;
    animation: dropdownFade 0.15s ease;
}

@keyframes dropdownFade {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: translateY(0); }
}

.action-menu a, .action-menu button {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-main);
    text-decoration: none;
    border-radius: var(--radius-sm);
    transition: background 0.15s ease;
    border: none;
    background: none;
    width: 100%;
    box-sizing: border-box;
    cursor: pointer;
}

.action-menu a i, .action-menu button i {
    width: 16px;
    text-align: center;
    font-size: 13px;
    color: var(--text-muted);
}

.action-menu a:hover, .action-menu button:hover {
    background: #f1f5f9;
    color: var(--primary);
}

.action-menu a:hover i, .action-menu button:hover i {
    color: var(--primary);
}

.action-menu a.text-danger, .action-menu button.text-danger {
    color: #ef4444;
}
.action-menu a.text-danger i, .action-menu button.text-danger i {
    color: #ef4444;
}
.action-menu a.text-danger:hover, .action-menu button.text-danger:hover {
    background: #fef2f2;
    color: #dc2626;
}

.action-menu .dropdown-divider {
    height: 1px;
    background: var(--border-color);
    margin: 4px 0;
}

/* =========================
   Badges (Simple & Semantic)
========================= */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 9px;
    border-radius: 20px;
    font-size: 11.5px;
    font-weight: 600;
    white-space: nowrap;
}

.badge-success { background: #dcfce7; color: #15803d; }
.badge-pending { background: #fef3c7; color: #b45309; }
.badge-error, .badge-danger { background: #fee2e2; color: #b91c1c; }
.badge-info    { background: #e0f2fe; color: #0369a1; }
.badge-air     { background: #e0f2fe; color: #0284c7; }
.badge-sea     { background: #e0e7ff; color: #4338ca; }

/* =========================
   Alerts
========================= */
.alert {
    padding: 12px 16px;
    margin-bottom: 16px;
    border-radius: var(--radius-md);
    font-size: 13.5px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 10px;
    border: 1px solid transparent;
}
.alert-success { background: #f0fdf4; color: #166534; border-color: #bbf7d0; }
.alert-error   { background: #fef2f2; color: #991b1b; border-color: #fecaca; }
.alert-info    { background: #eff6ff; color: #1e40af; border-color: #bfdbfe; }
.alert-warning { background: #fffbeb; color: #92400e; border-color: #fde68a; }

/* =========================
   Footer
========================= */
.footer {
    background: transparent;
    color: var(--text-muted);
    text-align: center;
    padding: 16px;
    font-size: 12px;
    margin-top: auto;
    border-top: 1px solid var(--border-color);
}

/* =========================
/* =========================
   Dashboard Specific Layouts
========================= */
.dash-header-wrap {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 12px;
}

.dash-hero-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.dash-charts-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 20px;
    margin-bottom: 24px;
}

.dash-dual-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 24px;
}

.dash-shortcuts-bar {
    background: #ffffff;
    border-radius: 14px;
    padding: 16px 20px;
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
}

/* =========================
   Responsive Breakpoints
========================= */
@media (max-width: 1100px) {
    .dash-hero-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 1024px) {
    .sidebar { width: 200px; min-width: 200px; }
    .main-content { margin-left: 200px; width: calc(100% - 200px); }
    .dash-grid { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
}

@media (max-width: 900px) {
    .dash-grid { grid-template-columns: repeat(2, 1fr); }
    .dash-charts-grid { grid-template-columns: 1fr; gap: 16px; }
    .dash-dual-grid { grid-template-columns: 1fr; gap: 16px; }
    .content table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
        -webkit-overflow-scrolling: touch;
    }
}

@media (max-width: 768px) {
    .sidebar {
        left: -230px;
        width: 230px;
        box-shadow: none;
    }
    .sidebar.active {
        left: 0;
        box-shadow: 0 0 30px rgba(0,0,0,0.3);
    }
    .sidebar-close-btn { display: flex; }
    body.sidebar-open { overflow: hidden; }

    .main-content {
        margin-left: 0;
        width: 100%;
    }
    .topbar .toggle-btn { display: flex; }
    .topbar { padding: 10px 16px; }
    .content { padding: 16px; }
    .dash-actions { flex-direction: column; }
    .btn { width: 100%; justify-content: center; }
    .btn-sm { width: auto; }
}

@media (max-width: 600px) {
    .dash-hero-grid { grid-template-columns: 1fr; gap: 12px; }
    .dash-header-wrap { flex-direction: column; align-items: stretch; }
    .dash-header-wrap .header-actions { width: 100%; flex-direction: column; }
    .dash-header-wrap .header-actions .btn { width: 100%; }
    .dash-shortcuts-bar { flex-direction: column; align-items: stretch; }
    .dash-shortcuts-bar .shortcuts-list { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; width: 100%; }
    .dash-shortcuts-bar .shortcuts-list .btn { width: 100%; font-size: 11.5px; padding: 6px 8px; justify-content: center; }
}

@media (max-width: 480px) {
    .dash-grid { grid-template-columns: 1fr; gap: 12px; }
    .dash-card { padding: 14px; }
    .content { padding: 12px; }
}
