/* Basic Setup */
:root {
    --primary: #112A54;
    /* Deep Navy */
    --secondary: #E21E26;
    /* Vibrant Red */
    --light: #f4f4f4;
    --dark: #1E293B;
    --success: #28a745;
    --danger: #dc3545;
    --warning: #ffc107;
    --info: #17a2b8;
    --white: #ffffff;
    --bg-color: #F8FAFC;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

img, video, iframe, input, select, textarea {
    max-width: 100%;
}

html, body {
    overflow-x: hidden;
    width: 100%;
}

body {
    font-family: 'Outfit', sans-serif;
    line-height: 1.6;
    background-color: var(--bg-color);
    color: var(--dark);
}

a {
    text-decoration: none;
    color: inherit;
}

ul {
    list-style: none;
}

.container {
    width: 90%;
    max-width: 1200px;
    margin: auto;
    padding: 20px;
}

/* Layout Rows & Columns */
.row {
    display: flex;
    gap: 30px;
    margin-bottom: 25px;
}

.col {
    flex: 1;
    min-width: 0;
}

.btn {
    display: inline-block;
    padding: 10px 20px;
    background: var(--primary);
    color: var(--white);
    border: none;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 6px rgba(17, 42, 84, 0.2);
}

.btn:hover {
    background: #0B1C38;
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(17, 42, 84, 0.3);
}

.btn-secondary {
    background: #6c757d;
}

.btn-block {
    display: block;
    width: 100%;
}

.btn-sm {
    padding: 5px 10px;
    font-size: 0.8rem;
}

.form-control {
    width: 100%;
    padding: 10px;
    margin-bottom: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

/* Hide native browser password reveal eye icon (Edge, Chrome, IE) */
input[type="password"]::-ms-reveal,
input[type="password"]::-ms-clear,
input[type="password"]::-webkit-contacts-auto-fill-button,
input[type="password"]::-webkit-credentials-auto-fill-button {
    display: none !important;
    width: 0 !important;
    height: 0 !important;
    pointer-events: none !important;
}

.alert {
    padding: 10px;
    margin-bottom: 20px;
    border-radius: 4px;
}

.alert-danger {
    background: #f8d7da;
    color: #721c24;
}

.alert-warning {
    background: #fff3cd;
    color: #856404;
}

/* Navbar */
.navbar {
    background: var(--white);
    color: var(--primary);
    padding: 0.75rem 0;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.navbar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1400px;
    width: 95%;
}

.navbar .logo {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--primary);
}

.navbar .nav-links {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.navbar .nav-links a {
    color: var(--primary);
    margin-left: 0;
    font-weight: 500;
    font-size: 0.92rem;
    padding: 6px 4px;
    border-bottom: 2px solid transparent;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    white-space: nowrap;
    line-height: 1.2;
}

.navbar .nav-links a:hover {
    color: var(--secondary);
}

.navbar .nav-links a.active {
    color: var(--secondary);
    font-weight: 700;
    border-bottom: 2px solid var(--secondary);
}

/* Hero */
.hero {
    background: linear-gradient(rgba(17, 42, 84, 0.85), rgba(226, 30, 38, 0.75)), url('https://images.unsplash.com/photo-1578575437130-527eed3abbec?ixlib=rb-1.2.1&auto=format&fit=crop&w=1350&q=80');
    background-size: cover;
    background-position: center;
    height: 400px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: var(--white);
}

.hero h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
}

.tracking-box {
    margin-top: 20px;
    background: rgba(255, 255, 255, 0.2);
    padding: 20px;
    border-radius: 8px;
    backdrop-filter: blur(5px);
}

.tracking-box input {
    padding: 10px;
    width: 300px;
    border: none;
    border-radius: 4px;
}

.tracking-box button {
    border-radius: 4px;
}

/* Features */
.features {
    display: flex;
    justify-content: space-around;
    margin-top: 40px;
    text-align: center;
}

.feature {
    background: var(--white);
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    width: 30%;
}

.feature i {
    font-size: 2rem;
    color: var(--secondary);
    margin-bottom: 10px;
}

/* Auth */
.auth-container {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 80vh;
}

.auth-box {
    background: var(--white);
    padding: 40px;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 400px;
}

.auth-box h2 {
    text-align: center;
    margin-bottom: 20px;
    color: var(--primary);
}

/* Dashboard */
.dashboard .stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: var(--white);
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.04);
    text-align: center;
    border-bottom: 4px solid var(--secondary);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.08);
}

.stat-number {
    font-size: 2rem;
    font-weight: bold;
    color: var(--primary);
}

.admin-actions,
.user-actions {
    margin-bottom: 20px;
}

/* Tables */
.table {
    width: 100%;
    border-collapse: collapse;
    background: var(--white);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.table th,
.table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

.table th {
    background: var(--primary);
    color: var(--white);
}

.table tr:hover {
    background: #f1f1f1;
}

/* Forms */
.consignment-form .row {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
}

.consignment-form .col {
    flex: 1;
}

.form-group label {
    font-weight: 600;
    display: block;
    margin-bottom: 5px;
}

.badge {
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 0.85rem;
    font-weight: 500;
    color: #fff;
    display: inline-block;
}

.status-badge {
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    display: inline-block;
    letter-spacing: 0.5px;
}

.status-badge.booked {
    background: #e2e3e5;
    color: #383d41;
}

.status-badge.in-transit {
    background: #cce5ff;
    color: #004085;
}

.status-badge.out-for-delivery {
    background: #fff3cd;
    color: #856404;
}

.status-badge.delivered {
    background: #d4edda;
    color: #155724;
}

/* Consignment View */
.consignment-view .header-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.consignment-view .card {
    background: var(--white);
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
    margin-bottom: 20px;
}

.status-banner {
    padding: 15px;
    background: var(--primary);
    color: var(--white);
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 1.1rem;
}

.status-banner.status-delivered {
    background: var(--success);
}

/* History */
.history-list {
    border-left: 2px solid #ddd;
    padding-left: 20px;
    margin-left: 10px;
}

.history-list li {
    margin-bottom: 20px;
    position: relative;
}

.history-list li::before {
    content: '';
    position: absolute;
    left: -26px;
    top: 0;
    width: 10px;
    height: 10px;
    background: var(--secondary);
    border-radius: 50%;
}

.history-date {
    font-size: 0.85rem;
    color: #777;
    display: block;
}

.history-status {
    font-weight: bold;
    color: var(--primary);
    font-size: 1.1rem;
}

.history-location {
    float: right;
    font-style: italic;
    color: #555;
}

.history-desc {
    margin-top: 5px;
    color: #444;
}

/* Footer */
.footer {
    background: var(--dark);
    color: #aaa;
    text-align: center;
    padding: 20px 0;
    margin-top: 50px;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    body {
        display: flex;
        flex-direction: column;
        min-height: 100vh;
    }
    
    .main-content {
        flex: 1;
    }

    .consignment-form .row {
        flex-direction: column;
    }

    .features {
        flex-direction: column;
        gap: 20px;
    }

    .feature {
        width: 100%;
    }

    .navbar {
        min-height: auto;
        height: auto;
        padding: 0 !important;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .footer {
        min-height: 85px;
        height: auto;
        padding: 0;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .navbar .container {
        width: 100%;
        flex-direction: column;
        justify-content: center;
        gap: 0;
        padding: 0 5px !important;
    }

    .navbar .logo {
        display: inline-flex;
        justify-content: center;
        align-items: center;
        margin-top: 0 !important;
        padding-top: 0 !important;
        position: relative;
        z-index: 1;
    }

    .header-logo-img {
        height: 160px !important;
        width: auto !important;
        max-width: 100% !important;
        object-fit: contain;
        object-position: center;
        margin-top: -30px !important;
        margin-bottom: -35px !important;
    }

    .navbar .nav-links {
        margin-top: 0;
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        gap: 2px 10px;
        position: relative;
        z-index: 10;
    }

    .navbar .nav-links a {
        font-size: 0.75rem;
        margin-left: 0;
    }

    .navbar .nav-links.nav-guest {
        gap: 15px 80px;
    }



    .tracking-box input {
        width: 100%;
        margin-bottom: 10px;
    }

    .consignment-view .header-actions {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }

    .auth-container {
        height: auto;
        align-items: flex-start;
        padding-top: 40px;
    }
}

/* Enhanced Consignment Form */
.consignment-form-enhanced {
    max-width: 900px;
    margin: 0 auto;
}

.page-header {
    text-align: center;
    margin-bottom: 30px;
}
.page-header h2 {
    color: var(--primary);
    font-size: 2rem;
    margin-bottom: 5px;
}
.page-header p {
    color: #666;
}

.form-section {
    background: var(--white);
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.04);
    padding: 30px;
    margin-bottom: 30px;
    border: 1px solid rgba(0,0,0,0.03);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.form-section:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 30px rgba(0,0,0,0.08);
}

.section-header {
    display: flex;
    align-items: center;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 2px solid #f0f0f0;
}

.section-header i {
    background: var(--primary);
    color: var(--secondary);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 15px;
    font-size: 1.2rem;
}

.section-header h3 {
    margin: 0;
    color: var(--primary);
    font-size: 1.4rem;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.full-width {
    grid-column: 1 / -1;
}

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    font-size: 0.9rem;
    color: #444;
    margin-bottom: 8px;
    font-weight: 600;
}

.required {
    color: var(--danger);
}

/* Input with Icon */
.input-icon {
    position: relative;
    width: 100%;
}

.input-icon i {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: #aaa;
    pointer-events: none;
    z-index: 10;
}
.input-icon.textarea-icon i {
    top: 20px;
}

.input-icon input, 
.input-icon textarea {
    padding-left: 45px !important; /* Make space for icon */
}

.form-control, input[type="text"], input[type="email"], input[type="number"], select, textarea {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #eee;
    background: #fdfdfd;
    border-radius: 6px;
    font-size: 1rem;
    transition: all 0.3s;
    font-family: inherit;
}

.form-control:focus, input:focus, select:focus, textarea:focus {
    border-color: var(--primary);
    background: #fff;
    outline: none;
    box-shadow: 0 0 0 4px rgba(17, 42, 84, 0.1);
}

.form-actions {
    text-align: center;
    margin-top: 40px;
}

.btn-lg {
    padding: 15px 40px;
    font-size: 1.1rem;
    font-weight: 600;
    box-shadow: 0 4px 15px rgba(17, 42, 84, 0.3);
}

@media (max-width: 768px) {
    .form-grid {
        grid-template-columns: 1fr;
    }
    .form-actions {
        display: flex;
        flex-direction: column;
        gap: 15px;
    }
    .form-actions .btn {
        width: 100%;
        margin: 0;
    }
}
/* Searchable Select Custom Component */
.searchable-container {
    position: relative;
    width: 100%;
}

.search-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    max-height: 250px;
    overflow-y: auto;
    background: #fff;
    border: 2px solid var(--primary);
    border-radius: 6px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.15);
    z-index: 9999;
    display: none;
    margin-top: 5px;
}

.search-option {
    padding: 12px 15px;
    cursor: pointer;
    transition: all 0.2s;
    border-bottom: 1px solid #f0f0f0;
    color: #333;
}

.search-option:hover, .search-option.active {
    background: #f0f7ff;
    color: var(--primary);
    padding-left: 20px;
}

.no-results {
    color: #999;
    font-style: italic;
    padding: 15px;
    text-align: center;
}

/* Billing Information Block Styles */
.billing-section {
    border: 2px solid var(--primary);
    border-left: 10px solid var(--primary);
    background: #fcfcfc !important;
}

.billing-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

.billing-group {
    background: #f4f8fb;
    padding: 15px;
    border-radius: 8px;
    border: 1px solid #e1e8f0;
}

.billing-group label {
    margin-bottom: 5px;
    color: var(--primary);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.billing-group input {
    font-weight: 700;
    color: var(--primary);
}

.total-group {
    background: var(--primary);
    color: white;
}

.total-group label {
    color: rgba(255,255,255,0.7);
}

.total-group input {
    background: transparent !important;
    border-color: rgba(255,255,255,0.2) !important;
    color: var(--secondary) !important;
    font-size: 1.4rem;
    font-weight: 800;
}

/* Tablet & Intermediate Medium Devices (max-width: 1024px) */
@media (max-width: 1024px) {
    .container {
        width: 95%;
        padding: 15px;
    }

    .form-section {
        padding: 20px !important;
    }

    .page-header h2 {
        font-size: 1.7rem !important;
    }

    .section-header h3 {
        font-size: 1.25rem !important;
    }

    /* Stack Sender and Receiver columns vertically to prevent squishing */
    .row {
        flex-direction: column;
        gap: 20px !important;
    }

    .col {
        width: 100%;
        flex: none;
    }

    .navbar {
        padding: 0.5rem 0;
    }

    /* Stack Nav container naturally */
    .navbar .container {
        flex-direction: column;
        gap: 0;
    }

    .navbar .nav-links {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        gap: 15px 40px;
        margin-top: 25px;
    }

    .navbar .nav-links.nav-guest {
        gap: 15px 80px;
    }

    .navbar .nav-links a {
        margin-left: 0;
        margin-right: 0;
        font-weight: 700;
        font-size: 1.1rem;
    }

    /* Handle flex action blocks in Admin Dashboard */
    .header-actions {
        flex-direction: column;
        align-items: flex-start !important;
        gap: 15px;
    }

    .header-actions form,
    .header-actions div {
        width: 100%;
        display: flex;
        flex-wrap: wrap;
        gap: 20px;
        justify-content: flex-start;
    }

    .dashboard .header-actions form,
    .dashboard .header-actions div {
        justify-content: center;
    }

    /* Reorder dashboard buttons on mobile */
    .header-actions div > a:nth-child(1) { order: 1; } /* Agents */
    .header-actions div > a:nth-child(2) { order: 1; } /* Rate Card */
    .header-actions div > a:nth-child(4) { order: 1; } /* Users */
    
    .header-actions div::after {
        content: "";
        width: 100%;
        order: 2;
    }

    .header-actions div > a:nth-child(3) { 
        order: 3;
    }

    /* Responsive grid styles */
    .dashboard .stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
        gap: 15px;
    }

    .form-grid {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)) !important;
    }

    /* Horizontal scroll for tables on tablets to prevent horizontal page break overflow */
    .table {
        display: block;
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* Features Section */
    .features {
        flex-direction: column;
        gap: 20px;
    }

    .feature {
        width: 100%;
    }
}

/* Responsive Grid Helper */
.responsive-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

/* Responsive Header Helper */
.page-header-flex {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.page-header-flex h2 {
    color: var(--primary);
    font-size: 2rem;
    margin-bottom: 5px;
}

.page-header-flex p {
    color: #666;
}

@media (max-width: 768px) {
    .responsive-grid {
        grid-template-columns: 1fr !important;
    }
    .page-header-flex {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 10px !important;
    }
    .form-section {
        padding: 15px !important;
    }
    .card {
        padding: 15px !important;
    }
    .hero h1 {
        font-size: 1.8rem !important;
    }
    .tracking-box {
        padding: 15px !important;
    }
}

/* Responsive Logo Styles */
.header-logo-link {
    display: block;
    position: relative;
    width: 320px;
    height: 45px;
}

.header-logo-img {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    left: 0;
    z-index: 9999;
    max-height: 220px;
    max-width: none;
}

@media (min-width: 769px) {
    .navbar .nav-links {
        margin-left: auto;
        padding-left: 20px;
    }
}

@media (max-width: 768px) {
    .navbar .container {
        display: flex;
        flex-direction: column;
    }
    .header-logo-link {
        width: 100%;
        height: auto;
        position: static;
        text-align: center;
        margin-bottom: 25px;
        margin-top: 10px;
    }
    
    .header-logo-img {
        position: static;
        transform: none;
        max-height: 260px;
        max-width: 95%;
        width: auto;
    }
    /* Logged-In View: 3-row layout evenly spaced across available width */
    .navbar .nav-links {
        margin-top: 15px;
        display: flex;
        flex-wrap: wrap;
        justify-content: space-around;
        align-items: center;
        gap: 10px 4px;
        width: 100%;
        padding: 0 2px;
    }

    .navbar .nav-links a {
        padding: 4px 5px;
        font-size: 1.05rem;
        text-align: center;
    }

    .navbar .nav-links a[href*="logout"] {
        position: relative !important;
        right: 20px !important;
        margin-right: 20px !important;
    }

    /* Guest View (Before Login): Track Left, Rate Card Center, Login Right */
    .navbar .nav-links.nav-guest {
        margin-top: 28px !important;
        flex-wrap: nowrap !important;
        justify-content: space-between !important;
        gap: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        padding: 0 15px !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
    }

    .navbar .nav-links.nav-guest a {
        padding: 6px 0 !important;
        font-size: 1.1rem !important;
        white-space: nowrap !important;
    }
}

