* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #f5f5f5;
    min-height: 100vh;
    padding: 0;
}

.container {
    max-width: 100%;
    margin: 0 auto;
    background: white;
    min-height: 100vh;
}

header {
    background: #436BA1;
    color: white;
    padding: 20px 40px 30px 40px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.header-top {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 20px;
    justify-content: space-between;
}

/* Login Required Message */
.login-required-message {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 400px;
    padding: 40px 20px;
}

.message-box {
    background: white;
    border-radius: 12px;
    padding: 40px 60px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    text-align: center;
    max-width: 600px;
}

.message-box h2 {
    color: #d32f2f;
    font-size: 28px;
    margin-bottom: 20px;
}

.message-box p {
    color: #555;
    font-size: 16px;
    line-height: 1.6;
    margin: 10px 0;
}

.auth-section {
    display: flex;
    align-items: center;
    gap: 10px;
}

.login-options {
    display: flex;
    align-items: center;
    gap: 10px;
}

.btn-login {
    padding: 8px 16px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.9em;
    transition: all 0.3s ease;
    color: white;
}

.btn-admin {
    background: #e74c3c;
}

.btn-admin:hover {
    background: #c0392b;
    transform: translateY(-2px);
}

.btn-kitchen {
    background: #27ae60;
}

.btn-kitchen:hover {
    background: #229954;
    transform: translateY(-2px);
}

.btn-driver {
    background: #f39c12;
}

.btn-driver:hover {
    background: #d68910;
    transform: translateY(-2px);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 15px;
    background: rgba(255, 255, 255, 0.2);
    padding: 10px 20px;
    border-radius: 5px;
}

.user-info span {
    color: white;
    font-weight: 600;
}

.btn-logout {
    padding: 6px 16px;
    background: #e74c3c;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
    transition: background 0.3s ease;
}

.btn-logout:hover {
    background: #c0392b;
}

.btn-admin-dashboard {
    padding: 6px 16px;
    background: #436BA1;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
    transition: background 0.3s ease;
    margin-right: 10px;
}

.btn-admin-dashboard:hover {
    background: #355382;
}

.btn-admin-dashboard .icon {
    margin-right: 4px;
}

.logo {
    height: 60px;
    width: auto;
    background: white;
    padding: 8px 15px;
    border-radius: 5px;
}

header h1 {
    font-size: 1.8em;
    margin: 0;
    text-align: left;
    font-weight: 700;
    color: white;
}

.header-info {
    display: flex;
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 40px;
    background: rgba(255, 255, 255, 0.15);
    padding: 15px 20px;
    border-radius: 5px;
}

.info-item {
    font-size: 1em;
}

.info-item strong {
    margin-right: 10px;
    font-weight: 600;
}

.info-item input[type="date"],
.info-item input[type="text"],
.info-item select {
    background: white;
    color: #333;
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 1em;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 300px;
}

.info-item input[type="date"]:hover,
.info-item input[type="text"]:hover,
.info-item select:hover {
    border-color: rgba(255, 255, 255, 0.6);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.info-item input[type="date"]:focus,
.info-item input[type="text"]:focus,
.info-item select:focus {
    outline: none;
    border-color: #2c3e50;
    box-shadow: 0 0 0 3px rgba(67, 107, 161, 0.3);
    cursor: text;
}

main {
    padding: 40px;
    background: #f9f9f9;
}

.action-buttons {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 5px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-primary {
    background: #436BA1;
    color: white;
}

.btn-primary:hover {
    background: #365680;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.btn-secondary {
    background: #5a6c7d;
    color: white;
}

.btn-secondary:hover {
    background: #4a5866;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.btn-info {
    background: #4A7BA7;
    color: white;
}

.btn-info:hover {
    background: #3d6689;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.btn-success {
    background: #5B89C8;
    color: white;
}

.btn-success:hover {
    background: #4a72a8;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.btn-map {
    background: #6B7C93;
    color: white;
}

.btn-map:hover {
    background: #5a6a7d;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.btn-cancel {
    background: #dc3545;
    color: white;
}

.btn-cancel:hover {
    background: #c82333;
}

.route-controls {
    display: inline-flex;
    align-items: center;
    background: white;
    padding: 8px 16px;
    border-radius: 5px;
    border: 2px solid #436BA1;
}

.route-select {
    padding: 8px 12px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 1em;
    background: white;
    cursor: pointer;
    min-width: 150px;
}

.route-select:focus {
    outline: none;
    border-color: #436BA1;
    box-shadow: 0 0 0 2px rgba(67, 107, 161, 0.2);
}

.icon {
    font-size: 1.2em;
}

.table-container {
    overflow-x: auto;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    border-radius: 5px;
    background: white;
}

table {
    width: 100%;
    border-collapse: collapse;
    background: white;
}

thead {
    background: #436BA1;
    color: white;
}

th {
    padding: 8px 12px;
    text-align: left;
    font-weight: 600;
    font-size: 0.9em;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

td {
    padding: 8px 12px;
    border-bottom: 1px solid #e8e8e8;
    color: #333;
}

tbody tr {
    transition: background-color 0.2s ease;
}

tbody tr:hover {
    background-color: #f8f9fa;
}

tbody tr:last-child td {
    border-bottom: none;
}

tfoot {
    background: #f0f4f8;
    border-top: 2px solid #436BA1;
}

tfoot tr.totals-row td {
    padding: 12px;
    font-size: 1em;
    border-bottom: none;
}

.status {
    display: 6px 16px;
    border-radius: 3px;
    font-size: 0.85em;
    font-weight: 600;
}

.status.completed {
    background-color: #28a745;
    color: white;
}

.status.pending {
    background-color: #ffc107;
    color: #333;
}

.status.cancelled {
    background-color: #dc3545;
    color: white;
}

/* Status Select Dropdown */
.status-select {
    padding: 6px 12px;
    border: 2px solid #ddd;
    border-radius: 5px;
    font-size: 0.9em;
    font-weight: 600;
    cursor: pointer;
    background-color: white;
    transition: all 0.3s ease;
    min-width: 120px;
}

.status-select:focus {
    outline: none;
    border-color: #436BA1;
    box-shadow: 0 0 0 2px rgba(67, 107, 161, 0.2);
}

.status-select:hover {
    border-color: #436BA1;
}

/* Status-based coloring for select */
.status-select option[value="Pending"] {
    background-color: #ffc107;
    color: #333;
}

.status-select option[value="In Progress"] {
    background-color: #17a2b8;
    color: white;
}

.status-select option[value="Completed"] {
    background-color: #28a745;
    color: white;
}

/* Apply background color to select when option is selected */
.status-select.status-pending {
    background-color: #ffc107;
    color: #333;
    border-color: #e0a800;
}

.status-select.status-in-progress {
    background-color: #17a2b8;
    color: white;
    border-color: #117a8b;
}

.status-select.status-completed {
    background-color: #28a745;
    color: white;
    border-color: #1e7e34;
}

/* Editable inline fields */
.editable-field {
    width: 100%;
    padding: 6px 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    font-family: inherit;
    background-color: #fff;
    transition: all 0.2s ease;
    box-sizing: border-box;
}

.editable-field:hover {
    border-color: #007bff;
    background-color: #f8f9fa;
}

.editable-field:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
    background-color: #fff;
}

/* Collect and Collected field specific styling */
.collect-field,
.collected-field {
    max-width: 100px;
    text-align: right;
    font-weight: 500;
}

/* Balance cell - always read-only (calculated field) */
.balance-cell {
    text-align: right;
    font-weight: 600;
    color: #28a745;
    padding: 8px;
}

/* Completed Time cell - shows HH:MM when delivery marked Completed */
.completed-time-cell {
    text-align: center;
    font-weight: 600;
    color: #28a745;
    font-family: 'Courier New', monospace;
    padding: 8px;
}

/* Address validation styling */
.address-cell.invalid-address {
    background-color: #ffebee !important;
    color: #c62828 !important;
    font-weight: 600;
    border-left: 4px solid #ef5350 !important;
    padding-left: 8px;
}

.address-cell.invalid-address::before {
    content: '⚠️ ';
    margin-right: 4px;
}

.address-cell.valid-address {
    border-left: 4px solid #4caf50 !important;
    padding-left: 8px;
}

/* Driver comments field specific styling */
.comments-field {
    min-width: 150px;
}

.action-buttons-cell {
    display: flex;
    gap: 4px;
    justify-content: center;
    align-items: center;
}

/* Driver view label */
.driver-label {
    font-size: 0.75em;
    color: #6c757d;
    font-style: italic;
    padding: 2px 6px;
    background-color: #f8f9fa;
    border-radius: 3px;
    border: 1px solid #dee2e6;
}

.btn-icon {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.2em;
    padding: 3px 5px;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.btn-icon:hover {
    background: #f0f0f0;
    transform: scale(1.1);
}

.btn-edit:hover {
    background: #e3f2fd;
}

.btn-delete:hover {
    background: #ffebee;
}

footer {
    background: #2c3e50;
    padding: 20px 40px;
    text-align: center;
    color: #ecf0f1;
    font-size: 0.9em;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    animation: fadeIn 0.3s ease;
}

.modal.show {
    display: block;
}

.modal-content {
    background: white;
    margin: 5% auto;
    padding: 0;
    border-radius: 8px;
    width: 90%;
    max-width: 600px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    animation: slideDown 0.3s ease;
}

.modal-header {
    background: #436BA1;
    color: white;
    padding: 20px 30px;
    border-radius: 8px 8px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    margin: 0;
    font-size: 1.5em;
}

.close {
    font-size: 2em;
    font-weight: bold;
    cursor: pointer;
    line-height: 1;
    transition: color 0.3s ease;
}

.close:hover {
    color: #ffc107;
}

.modal-body {
    padding: 30px;
}

.modal-footer {
    padding: 15px 30px;
    background: #f8f9fa;
    border-top: 1px solid #ddd;
    border-radius: 0 0 8px 8px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #333;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1em;
    font-family: inherit;
    transition: border-color 0.3s ease;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #436BA1;
    box-shadow: 0 0 0 3px rgba(67, 107, 161, 0.1);
}

.form-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 30px;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideDown {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    header {
        padding: 15px 20px;
    }

    .header-top {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }

    .logo {
        height: 50px;
    }

    header h1 {
        font-size: 1.4em;
        text-align: left;
        width: 100%;
    }

    .auth-section {
        width: 100%;
    }

    .login-options {
        flex-wrap: wrap;
        width: 100%;
        gap: 8px;
    }

    .login-options span {
        width: 100%;
        font-size: 0.9em;
        margin-bottom: 5px;
    }

    .btn-login {
        flex: 1;
        min-width: calc(33% - 6px);
        padding: 10px 8px;
        font-size: 0.85em;
    }

    .user-info {
        flex-direction: column;
        align-items: flex-start;
        width: 100%;
        padding: 10px 15px;
        gap: 10px;
    }

    .btn-admin-dashboard {
        width: 100%;
        margin-right: 0;
        margin-bottom: 5px;
    }

    .btn-logout {
        width: 100%;
    }

    .header-info {
        flex-direction: column;
        gap: 15px;
        padding: 15px;
    }

    .info-item {
        width: 100%;
    }

    .info-item input[type="date"],
    .info-item input[type="text"],
    .info-item select {
        width: 100%;
        min-width: 100%;
        box-sizing: border-box;
    }

    .message-box {
        padding: 30px 20px;
    }

    .message-box h2 {
        font-size: 22px;
    }

    table {
        font-size: 0.9em;
    }

    th, td {
        padding: 10px 5px;
    }

    main {
        padding: 20px 15px;
    }

    .action-buttons {
        flex-direction: column;
    }

    .btn {
        width: 100%;
    }
}

@media (max-width: 480px) {
    header {
        padding: 10px 15px;
    }

    .logo {
        height: 40px;
    }

    header h1 {
        font-size: 1.2em;
    }

    .btn-login {
        font-size: 0.8em;
        padding: 8px 6px;
    }

    .header-info {
        padding: 10px;
    }

    .info-item strong {
        display: block;
        margin-bottom: 5px;
    }

    main {
        padding: 15px 10px;
    }

    table {
        font-size: 0.75em;
    }

    th, td {
        padding: 8px 3px;
        font-size: 0.85em;
    }

    .message-box {
        padding: 20px 15px;
    }

    .message-box h2 {
        font-size: 18px;
    }

    .message-box p {
        font-size: 14px;
    }
}

/* ============= Address Validation Styles ============= */

/* Google Maps autocomplete styling */
.pac-container {
    z-index: 10000 !important;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    margin-top: 5px;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.pac-item {
    padding: 10px;
    cursor: pointer;
    border-bottom: 1px solid #e0e0e0;
}

.pac-item:hover {
    background-color: #f5f5f5;
}

.pac-item-query {
    font-weight: 600;
    color: #333;
}

/* Address input validation states */
#customerAddress.address-validated {
    border-color: #4caf50 !important;
    background-color: #f1f8f4 !important;
}

#customerAddress.address-invalid {
    border-color: #f44336 !important;
    background-color: #ffebee !important;
}

#customerAddress.address-warning {
    border-color: #ff9800 !important;
    background-color: #fff8e1 !important;
}

/* Validation hint text */
.address-hint {
    display: block;
    margin-top: 5px;
    font-size: 0.85em;
    color: #666;
}

#customerAddress.address-validated + .address-hint {
    color: #4caf50;
}

#customerAddress.address-invalid + .address-hint {
    color: #f44336;
}

#customerAddress.address-warning + .address-hint {
    color: #ff9800;
}


/* ===== Driver Time Tracker ===== */
.driver-time-tracker {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 6px 12px;
    margin-left: 8px;
    background: #f0f7ff;
    border: 1px solid #b8d4ff;
    border-radius: 8px;
    flex-wrap: wrap;
}

.btn-start {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.1s, box-shadow 0.2s;
}

.btn-start:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(16, 185, 129, 0.35);
}

.btn-start:disabled {
    background: #9ca3af;
    cursor: not-allowed;
    opacity: 0.7;
}

.time-chip {
    display: inline-block;
    padding: 4px 10px;
    background: white;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 500;
    color: #374151;
    white-space: nowrap;
}

.time-chip span {
    font-weight: 700;
    color: #1f2937;
    font-family: 'Consolas', 'Monaco', monospace;
}

.duration-chip {
    background: #fef3c7;
    border-color: #fcd34d;
}

.duration-chip span {
    color: #b45309;
}
