/* =============================================
   Cargo Management System - Main Stylesheet
   ============================================= */

:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-light: #3b82f6;
    --secondary: #64748b;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --info: #06b6d4;
    --dark: #1e293b;
    --light: #f8fafc;
    --sidebar-width: 250px;
    --navbar-height: 60px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: #f1f5f9;
    color: #334155;
    min-height: 100vh;
}

/* ============ Layout ============ */
.main-wrapper {
    display: flex;
    min-height: 100vh;
}

.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: calc(var(--navbar-height) + 20px) 24px 24px;
    min-height: 100vh;
    transition: margin-left 0.3s;
}

/* ============ Sidebar ============ */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: linear-gradient(180deg, #111827 0%, #0f172a 100%);
    z-index: 1000;
    overflow-y: auto;
    transition: transform 0.3s;
    box-shadow: 4px 0 20px rgba(2, 6, 23, 0.2);
}

.sidebar-header {
    padding: 18px 20px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}

.sidebar-logo {
    width: 38px;
    height: 38px;
    object-fit: cover;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.sidebar-menu {
    list-style: none;
    padding: 10px 0 16px;
    margin: 0;
}

.sidebar-header {
    padding: 14px 20px 8px;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: #94a3b8;
    font-weight: 700;
}

.sidebar-item {
    margin: 2px 0;
}

.sidebar-link {
    display: flex;
    align-items: center;
    padding: 10px 18px;
    color: #cbd5e1;
    text-decoration: none;
    transition: all 0.2s ease;
    border-left: 3px solid transparent;
    font-size: 0.95rem;
    font-weight: 500;
}

.sidebar-link:hover {
    background: rgba(255,255,255,0.08);
    color: #fff;
    text-decoration: none;
}

.sidebar-link.active {
    background: rgba(37, 99, 235, 0.16);
    color: #fff;
    border-left-color: var(--primary);
}

.sidebar-link i {
    width: 22px;
    margin-right: 10px;
    text-align: center;
    font-size: 0.95rem;
}

/* ============ Navbar ============ */
.navbar {
    height: var(--navbar-height);
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.12);
}

.notification-dropdown {
    width: 350px;
    max-height: 400px;
    overflow-y: auto;
}

/* ============ Sidebar Submenu ============ */
.sidebar-submenu {
    padding: 2px 0 4px;
}

.sidebar-sublink {
    display: block;
    padding: 8px 16px 8px 40px;
    color: #cbd5e1;
    text-decoration: none;
    transition: all 0.2s ease;
    border-left: 3px solid transparent;
    border-radius: 6px;
    margin: 3px 8px;
    font-size: 0.92rem;
}

.sidebar-sublink:hover {
    background: rgba(255,255,255,0.05);
    color: #fff;
    text-decoration: none;
}

/* Active submenu item */
.sidebar-submenu .active,
.sidebar-sublink.active {
    background: rgba(37, 99, 235, 0.18);
    color: #fff;
    border-left-color: var(--primary);
    padding-left: 42px;
}

/* Smaller chevron alignment for collapsed parent */
.sidebar-item > .sidebar-link .fa-chevron-down {
    transition: transform 0.2s;
}

.sidebar-item .collapse.show + .sidebar-link .fa-chevron-down,
.sidebar-item .sidebar-link[aria-expanded="true"] .fa-chevron-down {
    transform: rotate(180deg);
}

/* ============ Cards ============ */
.card {
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.06);
    margin-bottom: 20px;
    overflow: hidden;
}

.card-header {
    background: #fff;
    border-bottom: 1px solid #e2e8f0;
    padding: 15px 20px;
    border-radius: 14px 14px 0 0 !important;
    font-weight: 600;
    color: #1e293b;
}

.card-body {
    padding: 20px;
}

/* ============ Stat Cards ============ */
.stat-card {
    border-radius: 12px;
    padding: 20px;
    color: #fff;
    position: relative;
    overflow: hidden;
}

.stat-card .stat-icon {
    position: absolute;
    right: 15px;
    top: 15px;
    font-size: 2.5rem;
    opacity: 0.3;
}

.stat-card .stat-value {
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 5px;
}

.stat-card .stat-label {
    font-size: 0.9rem;
    opacity: 0.9;
}

.stat-card.blue { background: linear-gradient(135deg, #3b82f6, #2563eb); }
.stat-card.green { background: linear-gradient(135deg, #10b981, #059669); }
.stat-card.orange { background: linear-gradient(135deg, #f59e0b, #d97706); }
.stat-card.red { background: linear-gradient(135deg, #ef4444, #dc2626); }
.stat-card.purple { background: linear-gradient(135deg, #8b5cf6, #7c3aed); }
.stat-card.teal { background: linear-gradient(135deg, #14b8a6, #0d9488); }

/* ============ Tables ============ */
.table {
    margin-bottom: 0;
}

.table thead th {
    background: #f8fafc;
    border-bottom: 2px solid #e2e8f0;
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #64748b;
    white-space: nowrap;
}

.table tbody tr:hover {
    background: #f8fafc;
}

.table td {
    vertical-align: middle;
}

/* ============ Buttons ============ */
.btn {
    border-radius: 8px;
    font-weight: 500;
    padding: 8px 16px;
    box-shadow: none;
}

.btn:hover {
    transform: translateY(-1px);
}

.btn-primary {
    background: var(--primary);
    border-color: var(--primary);
}

.btn-primary:hover {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
}

.btn-outline-primary:hover,
.btn-outline-success:hover,
.btn-outline-info:hover,
.btn-outline-warning:hover {
    transform: translateY(-1px);
}

.btn-icon {
    padding: 6px 10px;
    font-size: 0.85rem;
}

/* ============ Forms ============ */
.form-control, .form-select {
    border-radius: 8px;
    border-color: #e2e8f0;
    padding: 10px 12px;
    background-color: #fff;
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 0.2rem rgba(37, 99, 235, 0.12);
}

.form-label {
    font-weight: 600;
    font-size: 0.9rem;
    color: #475569;
    margin-bottom: 6px;
}

/* ============ Badges ============ */
.badge {
    padding: 6px 10px;
    font-weight: 500;
    border-radius: 6px;
}

/* ============ Page Header ============ */
.page-header {
    padding: 20px 0 16px;
    margin-bottom: 8px;
}

.page-header h4 {
    color: #1e293b;
    font-weight: 700;
    margin-bottom: 4px;
}

.breadcrumb {
    font-size: 0.85rem;
    padding: 0;
    margin: 0;
}

.breadcrumb-item a {
    color: var(--primary);
    text-decoration: none;
}

.breadcrumb-item.active {
    color: #64748b;
}

/* ============ Login Page ============ */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    padding: 20px;
}

.login-card {
    max-width: 420px;
    width: 100%;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.2);
    padding: 40px;
}

.login-logo {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 50%;
    margin: 0 auto 20px;
    display: block;
}

/* ============ Landing Page ============ */
.landing-page {
    background: #fff;
}

.hero-section {
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    color: #fff;
    padding: 120px 0 80px;
    position: relative;
    overflow: hidden;
}

.hero-section::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(37,99,235,0.3) 0%, transparent 70%);
    border-radius: 50%;
}

.hero-title {
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: 20px;
}

.hero-subtitle {
    font-size: 1.2rem;
    opacity: 0.9;
    margin-bottom: 30px;
}

.feature-card {
    padding: 30px;
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    transition: transform 0.3s;
    height: 100%;
}

.feature-card:hover {
    transform: translateY(-5px);
}

.feature-icon {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    margin-bottom: 20px;
    color: #fff;
}

/* ============ Invoice ============ */
.invoice-container {
    max-width: 900px;
    margin: 0 auto;
    background: #fff;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.invoice-header {
    border-bottom: 2px solid #e2e8f0;
    padding-bottom: 20px;
    margin-bottom: 20px;
}

.invoice-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #1e293b;
}

.invoice-table th {
    background: #f8fafc;
    font-size: 0.85rem;
}

.invoice-totals {
    max-width: 300px;
    margin-left: auto;
}

.invoice-totals .row {
    padding: 5px 0;
}

.invoice-totals .total-row {
    border-top: 2px solid #e2e8f0;
    font-weight: 700;
    font-size: 1.1rem;
}

/* ============ Print Styles ============ */
.print-header {
    padding: 20px;
    border-bottom: 2px solid #000;
    margin-bottom: 20px;
}

.print-logo {
    max-height: 80px;
    object-fit: contain;
}

.print-company-name {
    font-size: 1.5rem;
    font-weight: 700;
    color: #000;
}

.print-address, .print-contact, .print-gst {
    font-size: 0.85rem;
    color: #333;
}

.print-divider {
    border-top: 2px solid #000;
    margin: 10px 0;
}

/* ============ Responsive ============ */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }
    
    .sidebar.show {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
        padding: calc(var(--navbar-height) + 20px) 15px 15px;
    }
    
    .hero-title {
        font-size: 2rem;
    }
    
    .stat-card .stat-value {
        font-size: 1.4rem;
    }
}

/* Sidebar overlay for mobile */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 999;
}

.sidebar-overlay.show {
    display: block;
}

/* ============ Utilities ============ */
.text-primary { color: var(--primary) !important; }
.bg-primary { background-color: var(--primary) !important; }

.cursor-pointer { cursor: pointer; }

.text-decoration-none { text-decoration: none; }

.shadow-sm { box-shadow: 0 1px 3px rgba(0,0,0,0.1) !important; }

/* Loading spinner */
.spinner-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255,255,255,0.8);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 40px;
    color: #94a3b8;
}

.empty-state i {
    font-size: 3rem;
    margin-bottom: 15px;
}

/* Status badges */
.status-paid { background: #dcfce7; color: #166534; }
.status-partial { background: #fef3c7; color: #92400e; }
.status-unpaid { background: #fee2e2; color: #991b1b; }
.status-cancelled { background: #f1f5f9; color: #475569; }
.status-active { background: #dcfce7; color: #166534; }
.status-inactive { background: #f1f5f9; color: #475569; }