@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&display=swap');

:root {
    --bg-main: hsl(218, 50%, 97%);
    --bg-darker: hsl(210, 30%, 93%);
    --bg-card: rgba(255, 255, 255, 0.9);
    --border-card: rgba(0, 0, 0, 0.08);
    
    --primary: hsl(142, 76%, 33%);
    --primary-hover: hsl(142, 76%, 26%);
    --primary-glow: rgba(16, 185, 129, 0.12);
    
    --accent: hsl(217, 91%, 45%);
    --accent-hover: hsl(217, 91%, 38%);
    
    --text-primary: hsl(215, 28%, 17%);
    --text-muted: hsl(215, 16%, 47%);
    --text-dark: hsl(215, 28%, 17%);
    
    --danger: hsl(350, 80%, 48%);
    --success: hsl(142, 76%, 33%);
    --warning: hsl(38, 92%, 40%);
    
    --font-heading: 'Outfit', sans-serif;
    --font-body: 'Plus Jakarta Sans', sans-serif;
    --shadow-premium: 0 10px 30px rgba(0, 0, 0, 0.05);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background: linear-gradient(135deg, var(--bg-main) 0%, var(--bg-darker) 100%);
    color: var(--text-primary);
    font-family: var(--font-body);
    min-height: 100vh;
    display: flex;
    overflow-x: hidden;
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: var(--bg-darker);
}
::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
}

/* Layout */
.app-container {
    display: flex;
    width: 100%;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 260px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-right: 1px solid var(--border-card);
    display: flex;
    flex-direction: column;
    padding: 2rem 1.5rem;
    position: fixed;
    height: 100vh;
    z-index: 100;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-brand {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 2.5rem;
}

.sidebar-brand span {
    color: var(--primary);
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    flex-grow: 1;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 1rem;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: 12px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.nav-link:hover, .nav-link.active {
    background: rgba(0, 0, 0, 0.03);
    color: var(--text-primary);
}

.nav-link.active {
    border-left: 3px solid var(--primary);
    background: rgba(16, 185, 129, 0.08);
}

.sidebar-footer {
    padding-top: 1rem;
    border-top: 1px solid var(--border-card);
}

.user-badge {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    color: white;
}

.user-info h4 {
    font-size: 0.9rem;
    font-weight: 600;
}

.user-info p {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: capitalize;
}

/* Main Content */
.main-wrapper {
    flex-grow: 1;
    margin-left: 260px;
    padding: 2rem;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

/* Header */
.top-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.page-title h1 {
    font-family: var(--font-heading);
    font-size: 1.8rem;
    font-weight: 700;
}

.page-title p {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-top: 0.25rem;
}

/* Card / Glassmorphism Panel */
.glass-panel {
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-card);
    border-radius: 16px;
    padding: 1.5rem;
    box-shadow: var(--shadow-premium);
}

/* Grid System */
.grid-cols-4 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.5rem;
}

.grid-cols-2 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 1.5rem;
}

/* Stats Widget */
.stat-card {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    transition: transform 0.2s ease;
}

.stat-card:hover {
    transform: translateY(-4px);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.stat-icon.green { background: rgba(16, 185, 129, 0.15); color: var(--primary); }
.stat-icon.blue { background: rgba(59, 130, 246, 0.15); color: var(--accent); }
.stat-icon.yellow { background: rgba(245, 158, 11, 0.15); color: var(--warning); }
.stat-icon.red { background: rgba(239, 68, 68, 0.15); color: var(--danger); }

.stat-info p {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.stat-info h3 {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    font-weight: 700;
    margin-top: 0.25rem;
}

/* Forms */
.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.form-control {
    width: 100%;
    background: rgba(0, 0, 0, 0.02);
    border: 1px solid rgba(0, 0, 0, 0.12);
    border-radius: 10px;
    padding: 0.75rem 1rem;
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    background: #ffffff;
    box-shadow: 0 0 0 3px var(--primary-glow);
}

textarea.form-control {
    resize: vertical;
    min-height: 80px;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    font-family: var(--font-body);
    font-size: 0.9rem;
    font-weight: 600;
    border-radius: 10px;
    border: none;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    text-decoration: none;
}

.btn-primary {
    background: var(--primary);
    color: white;
    box-shadow: 0 4px 12px var(--primary-glow);
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
    border: 1px solid var(--border-card);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.12);
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-danger:hover {
    background: hsl(350, 89%, 50%);
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.8rem;
    border-radius: 8px;
}

/* Tables */
.table-responsive {
    overflow-x: auto;
    width: 100%;
}

.table-premium {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 0.9rem;
}

.table-premium th {
    padding: 1rem;
    color: var(--text-muted);
    font-weight: 600;
    border-bottom: 1px solid var(--border-card);
    font-family: var(--font-heading);
}

.table-premium td {
    padding: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    color: var(--text-primary);
    vertical-align: middle;
}

.table-premium tr:hover td {
    background: rgba(0, 0, 0, 0.01);
}

/* Badge styles */
.badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.badge-pending { background: rgba(245, 158, 11, 0.15); color: var(--warning); }
.badge-assigned { background: rgba(59, 130, 246, 0.15); color: var(--accent); }
.badge-intransit { background: rgba(99, 102, 241, 0.15); color: #818cf8; }
.badge-delivered { background: rgba(16, 185, 129, 0.15); color: var(--primary); }
.badge-success { background: rgba(16, 185, 129, 0.15); color: var(--primary); }
.badge-danger { background: rgba(239, 68, 68, 0.15); color: var(--danger); }

/* Login Page specifically */
.login-body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    width: 100vw;
}

.login-card {
    width: 100%;
    max-width: 420px;
    padding: 2.5rem;
}

/* Modal dialogs */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.modal.active {
    opacity: 1;
    pointer-events: auto;
}

.modal-content {
    background: var(--bg-main);
    border: 1px solid var(--border-card);
    border-radius: 16px;
    max-width: 500px;
    width: 90%;
    padding: 2rem;
    position: relative;
    box-shadow: var(--shadow-premium);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.modal-header h3 {
    font-family: var(--font-heading);
    font-size: 1.3rem;
}

.modal-close {
    cursor: pointer;
    font-size: 1.5rem;
    color: var(--text-muted);
}

/* Signature Pad */
.signature-container {
    border: 2px dashed rgba(0, 0, 0, 0.12);
    border-radius: 10px;
    overflow: hidden;
    background: #ffffff;
    margin-bottom: 0.5rem;
}

#signature-pad {
    display: block;
    width: 100%;
    height: 150px;
    cursor: crosshair;
}

/* Waybill Layout */
.waybill-sticker {
    background: white;
    color: black;
    width: 4in;
    height: 6in;
    padding: 0.4in;
    border-radius: 0;
    border: 2px solid black;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    font-family: 'Courier New', Courier, monospace;
}

.waybill-header {
    text-align: center;
    border-bottom: 2px solid black;
    padding-bottom: 0.2in;
    margin-bottom: 0.2in;
}

.waybill-header h2 {
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: 2px;
}

.waybill-body {
    flex-grow: 1;
    font-size: 0.85rem;
    line-height: 1.4;
}

.waybill-section {
    border-bottom: 1px dashed black;
    padding: 0.1in 0;
}

.waybill-section:last-child {
    border-bottom: none;
}

.waybill-footer {
    text-align: center;
    border-top: 2px solid black;
    padding-top: 0.2in;
    margin-top: 0.2in;
}

.barcode {
    height: 50px;
    background: linear-gradient(90deg, #000 0%, #000 5%, transparent 5%, transparent 7%, #000 7%, #000 12%, transparent 12%, transparent 15%, #000 15%, #000 18%, transparent 18%, transparent 25%, #000 25%, #000 35%, transparent 35%, transparent 40%, #000 40%, #000 42%, transparent 42%, transparent 48%, #000 48%, #000 55%, transparent 55%, transparent 58%, #000 58%, #000 62%, transparent 62%, transparent 68%, #000 68%, #000 70%, transparent 70%, transparent 75%, #000 75%, #000 85%, transparent 85%, transparent 90%, #000 90%, #000 95%, transparent 95%, transparent 100%);
    margin: 0.1in auto;
    width: 80%;
}

.price-breakdown {
    background: rgba(0, 0, 0, 0.01);
    border-radius: 10px;
    padding: 1rem;
    margin-top: 1rem;
    border: 1px solid var(--border-card);
}

.price-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

.price-row:last-child {
    margin-bottom: 0;
    border-top: 1px solid var(--border-card);
    padding-top: 0.5rem;
    font-weight: 700;
}

/* Mobile responsive fixes */
@media (max-width: 768px) {
    body {
        flex-direction: column;
    }
    .sidebar {
        width: 100%;
        height: auto;
        position: relative;
        padding: 1rem;
        border-right: none;
        border-bottom: 1px solid var(--border-card);
    }
    .sidebar-brand {
        margin-bottom: 1rem;
    }
    .sidebar-nav {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 0.25rem;
    }
    .nav-link {
        padding: 0.5rem 0.75rem;
        font-size: 0.8rem;
    }
    .main-wrapper {
        margin-left: 0;
        padding: 1rem;
    }
}

/* Print Overrides */
@media print {
    body * {
        visibility: hidden;
    }
    .waybill-printable-container, .waybill-printable-container * {
        visibility: visible;
    }
    .waybill-printable-container {
        position: absolute;
        left: 0;
        top: 0;
        width: 100vw;
        height: 100vh;
        display: flex;
        justify-content: center;
        align-items: center;
        background: white;
    }
}
