/**
 * BIDA Driver Portal Styles
 * @version 1.0.0
 */

* { 
    margin: 0; 
    padding: 0; 
    box-sizing: border-box; 
}

body.bida-driver-portal { 
    font-family: Arial, sans-serif; 
    background: #f5f5f5; 
}

.bida-portal-container { 
    max-width: 1200px; 
    margin: 0 auto; 
    padding: 20px; 
}

.bida-portal-header { 
    background: white; 
    padding: 20px; 
    border-radius: 8px; 
    margin-bottom: 20px; 
    box-shadow: 0 2px 10px rgba(0,0,0,0.1); 
}

.bida-portal-header h1 { 
    color: #333; 
    font-size: 24px; 
    margin-bottom: 10px; 
}

.bida-status-badge { 
    display: inline-block; 
    padding: 8px 16px; 
    border-radius: 20px; 
    font-size: 14px; 
    font-weight: bold; 
}

.bida-status-badge.online { 
    background: #92FF57; 
    color: #000; 
}

.bida-status-badge.offline { 
    background: #ddd; 
    color: #666; 
}

.bida-status-badge.busy { 
    background: #ffa500; 
    color: #fff; 
}

.bida-msg { 
    padding: 15px; 
    margin-bottom: 20px; 
    background: #92FF57; 
    border-radius: 4px; 
    font-weight: bold; 
}

.bida-error { 
    padding: 15px; 
    margin-bottom: 20px; 
    background: #ff5757; 
    color: white; 
    border-radius: 4px; 
    font-weight: bold; 
}

.bida-card { 
    background: white; 
    padding: 25px; 
    border-radius: 8px; 
    margin-bottom: 20px; 
    box-shadow: 0 2px 10px rgba(0,0,0,0.1); 
}

.bida-card h2 { 
    color: #333; 
    font-size: 20px; 
    margin-bottom: 20px; 
    border-bottom: 2px solid #92FF57; 
    padding-bottom: 10px; 
}

.bida-location-info { 
    display: grid; 
    grid-template-columns: 1fr 1fr; 
    gap: 15px; 
    margin-bottom: 20px; 
}

.bida-location-item { 
    padding: 15px; 
    background: #f9f9f9; 
    border-radius: 4px; 
}

.bida-location-item label { 
    display: block; 
    font-size: 12px; 
    color: #666; 
    margin-bottom: 5px; 
}

.bida-location-item .value { 
    font-size: 18px; 
    font-weight: bold; 
    color: #333; 
}

.bida-btn { 
    background: #92FF57; 
    border: none; 
    padding: 15px 30px; 
    font-size: 16px; 
    font-weight: bold; 
    border-radius: 4px; 
    cursor: pointer; 
    text-decoration: none; 
    color: #000; 
    display: inline-block; 
}

.bida-btn:hover { 
    background: #7de63f; 
}

.bida-btn-secondary { 
    background: #ddd; 
    color: #333; 
}

.bida-btn-secondary:hover { 
    background: #ccc; 
}

.bida-btn-info { 
    background: #2196F3; 
    color: white; 
}

.bida-btn-info:hover { 
    background: #1976D2; 
}

.bida-btn-danger { 
    background: #ff5757; 
    color: white; 
}

.bida-btn-danger:hover { 
    background: #e64545; 
}

.bida-btn-busy {
    background: #ffa500;
    color: #fff;
}

.bida-btn-busy:hover {
    background: #e69500;
}

.bida-btn[disabled],
.bida-btn:disabled {
    cursor: not-allowed;
    opacity: 0.7;
}

.bida-delivery-card { 
    border: 1px solid #ddd; 
    padding: 20px; 
    border-radius: 8px; 
    margin-bottom: 15px; 
}

.bida-delivery-chain-item {
    position: relative;
}

.bida-delivery-chain-item.is-related-route {
    padding-left: 24px;
}

.bida-delivery-chain-item.is-related-route::before {
    content: '';
    position: absolute;
    left: 10px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: #c7d2fe;
}

.bida-delivery-chain-item.is-related-route::after {
    content: '';
    position: absolute;
    left: 6px;
    top: 28px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #4f46e5;
    border: 2px solid #ffffff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.18);
}

.bida-delivery-chain-item.is-related-route:not(.has-prev-related)::before {
    top: 28px;
}

.bida-delivery-chain-item.is-related-route:not(.has-next-related)::before {
    bottom: calc(100% - 28px);
}

.bida-related-route-hint {
    margin-top: 4px;
    font-size: 12px;
    color: #4b5563;
}

.bida-pickup-address {
    font-weight: 700;
}

.bida-delivery-card.pending { 
    border-left: 4px solid #ffa500; 
}

.bida-delivery-card.accepted { 
    border-left: 4px solid #92FF57; 
    background: #f4ffea;
    box-shadow: inset 0 0 0 1px rgba(146, 255, 87, 0.35);
}

.bida-delivery-card.in_transit {
    border-left: 4px solid #00bfff;
    background: #eaf8ff;
    box-shadow: inset 0 0 0 1px rgba(0, 191, 255, 0.25);
}

.bida-delivery-card.picked_up { 
    border-left: 4px solid #00bfff; 
    background: #eaf8ff;
    box-shadow: inset 0 0 0 1px rgba(0, 191, 255, 0.25);
}

.bida-delivery-card.cancelled {
    border-left: 4px solid #e0695b;
    opacity: 0.75;
    background: #fff7f5;
}

.bida-delivery-card.completed { 
    border-left: 4px solid #28a745; 
}

.bida-delivery-header { 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    margin-bottom: 15px; 
}

.bida-delivery-id { 
    font-size: 14px; 
    color: #666; 
}

.bida-delivery-status { 
    padding: 5px 12px; 
    border-radius: 12px; 
    font-size: 12px; 
    font-weight: bold; 
}

.bida-delivery-details { 
    display: grid; 
    grid-template-columns: 1fr 1fr; 
    gap: 10px; 
    margin: 15px 0; 
}

.bida-delivery-detail { 
    font-size: 14px; 
}

.bida-delivery-detail strong { 
    display: block; 
    color: #666; 
    font-size: 12px; 
    margin-bottom: 3px; 
}

.bida-delivery-actions { 
    display: flex; 
    gap: 10px; 
    margin-top: 15px; 
}

.bida-delivery-actions button,
.bida-delivery-actions .bida-btn { 
    padding: 10px 20px; 
    font-size: 14px; 
}

/* Temporary hotfix: hide route button until route viewer is stabilized */
.bida-view-delivery-route {
    display: none !important;
}

.bida-empty-state { 
    text-align: center; 
    padding: 40px; 
    color: #999; 
}

.bida-location-btn-group { 
    display: flex; 
    gap: 10px; 
    margin-top: 20px; 
}

.bida-location-btn-group form {
    flex: 1;
    margin: 0;
}

.bida-location-btn-group > button,
.bida-location-btn-group form > button {
    flex: 1;
    width: 100%;
}

/* Loading spinner */
.bida-location-spinner {
    position: fixed;
    top: 40px;
    left: 10px;
    right: 10px;
    background: #ffa500;
    color: white;
    padding: 15px 20px;
    border-radius: 8px;
    font-weight: bold;
    z-index: 10000;
    text-align: center;
}

.bida-location-spinner.success {
    background: #92FF57;
    color: #000;
}

/* Route Map Modal */
.bida-modal {
    display: none;
    position: fixed !important;
    z-index: 10000 !important;
    left: 0 !important;
    top: 0 !important;
    width: 100% !important;
    height: 100% !important;
    overflow: auto;
    background-color: rgba(0,0,0,0.6);
}

.bida-modal-content {
    background-color: #fefefe;
    margin: 5% auto;
    padding: 30px;
    border: 1px solid #888;
    border-radius: 8px;
    max-width: 90%;
    width: 800px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}

.bida-modal-content h2 {
    color: #333;
    margin-bottom: 15px;
    font-size: 24px;
    border-bottom: 2px solid #92FF57;
    padding-bottom: 10px;
}

.bida-modal-close {
    color: #aaa;
    float: right;
    font-size: 32px;
    font-weight: bold;
    line-height: 24px;
    cursor: pointer;
    transition: color 0.3s;
}

.bida-modal-close:hover,
.bida-modal-close:focus {
    color: #000;
}

#bida-route-map {
    border: 2px solid #ddd;
    border-radius: 4px;
}

#bida-route-info p {
    font-size: 14px;
    line-height: 1.8;
}

#bida-route-info strong {
    color: #333;
}

/* Responsive */
@media (max-width: 768px) {
    .bida-location-info, 
    .bida-delivery-details { 
        grid-template-columns: 1fr; 
    }
    
    .bida-delivery-header { 
        flex-direction: column; 
        align-items: flex-start; 
        gap: 10px; 
    }
    
    .bida-delivery-actions { 
        flex-direction: column; 
    }
    
    .bida-location-btn-group { 
        flex-direction: column; 
    }
    
    .bida-modal-content {
        margin: 10% auto;
        padding: 20px;
        width: 95%;
    }
    
    #bida-route-map {
        height: 400px !important;
    }
}

/* Collapsible Cards */
.bida-collapsible-card {
    position: relative;
}

.bida-card-toggle {
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

#qr-reader {
    overflow: hidden;
}

#qr-reader video {
    width: 100% !important;
    height: auto !important;
    object-fit: cover !important;
    display: block !important;
}

#qr-reader canvas {
    display: none !important;
}

.bida-card-toggle:hover {
    opacity: 0.8;
}

.bida-toggle-icon {
    font-size: 18px;
    transition: transform 0.2s ease;
    color: #666;
}

.bida-card-content {
    transition: all 0.3s ease;
    overflow: hidden;
}
