/**
 * Chauffeur Availability Indicator Styles
 * Floating button and popup modal for displaying chauffeur availability status
 */

/* ===========================
   Floating Button Base Styles
   =========================== */

.csp-button-wrapper {
    position: fixed !important;
    top: 50% !important;
    right: 20px !important;
    transform: translateY(-50%) !important;
    z-index: 380;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.csp-availability-button {
    border-radius: 8px !important;
    padding: 5px !important;
    position: relative;
    width: 50px;
    height: 50px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3) !important;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    text-decoration: none;
}

/* Phone button specific styles */
.csp-phone-button {
    background-color: #ff9800 !important;
}

.csp-phone-button:hover {
    background-color: #fb8c00 !important;
}

/* Account button specific styles */
.csp-account-button {
    background-color: #2196f3 !important;
}

.csp-account-button:hover {
    background-color: #1976d2 !important;
}

/* Icon PNG styling */
.csp-indicator-icon {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* ===========================
   Intro Tooltip Styles - WhatsApp Style
   =========================== */

.csp-intro-tooltip {
    position: absolute;
    top: 0;
    right: 65px;
    background: #2C3E50;
    color: #ffffff;
    padding: 12px 16px;
    border-radius: 10px;
    font-size: 14px;
    line-height: 1.5;
    text-align: left;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    max-width: 220px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    font-weight: 500;
}

.csp-intro-tooltip.csp-show {
    animation: tooltipSlideIn 0.4s ease 0.5s forwards, tooltipBounce 1.5s ease 1s infinite;
    visibility: visible;
}

.csp-intro-tooltip::after {
    content: '';
    position: absolute;
    top: var(--arrow-top, 15px);
    right: -8px;
    width: 0;
    height: 0;
    border-left: 10px solid #2C3E50;
    border-top: 8px solid transparent;
    border-bottom: 8px solid transparent;
    transform: translateY(-50%);
    transition: top 0.3s ease;
}

.csp-intro-tooltip.csp-hidden {
    animation: tooltipFadeOut 0.25s ease forwards;
}

/* Tooltip animations */
@keyframes tooltipSlideIn {
    from {
        opacity: 0;
        transform: translateY(-50%) translateX(-15px) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translateY(-50%) translateX(0) scale(1);
    }
}

@keyframes tooltipBounce {
    0%, 100% {
        transform: translateY(-50%) translateX(0) scale(1);
    }
    50% {
        transform: translateY(-50%) translateX(0) scale(1.03);
    }
}

@keyframes tooltipFadeOut {
    0% {
        opacity: 1;
        transform: translateY(-50%) translateX(0) scale(1);
    }
    100% {
        opacity: 0;
        transform: translateY(-50%) translateX(-10px) scale(0.95);
    }
}

/* ===========================
   Status Color Classes
   =========================== */

.csp-availability-button.csp-status-available {
    background-color: #28a745; /* Green */
}

.csp-availability-button.csp-status-unavailable {
    background-color: #dc3545; /* Red */
}

/* ===========================
   Button Hover and Interaction States
   =========================== */

.csp-availability-button:hover {
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
    transform: scale(1.1);
}

.csp-availability-button:active {
    transform: scale(0.95);
}

/* ===========================
   Popup Modal Overlay
   =========================== */

.csp-popup-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

/* ===========================
   Popup Content Box
   =========================== */

.csp-popup-content {
    background: white;
    border-radius: 8px;
    padding: 24px;
    max-width: 400px;
    width: 100%;
    position: relative;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
    animation: slideIn 0.3s ease;
    overflow: visible !important;
}

/* Slide-in animation */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ===========================
   Close Button
   =========================== */

#csp-availability-popup .csp-popup-content .csp-popup-close {
    position: absolute !important;
    top: -14px !important;
    right: -14px !important;
    left: auto !important;
    bottom: auto !important;
    background: #ffffff !important;
    border: 2px solid #e0e0e0 !important;
    border-radius: 50% !important;
    font-size: 22px !important;
    font-weight: 300 !important;
    font-family: Arial, sans-serif !important;
    cursor: pointer !important;
    color: #666 !important;
    line-height: 1 !important;
    padding: 0 !important;
    margin: 0 !important;
    width: 32px !important;
    height: 32px !important;
    min-width: 32px !important;
    min-height: 32px !important;
    max-width: 32px !important;
    max-height: 32px !important;
    transition: all 0.2s ease !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    z-index: 10001 !important;
    outline: none !important;
    overflow: hidden !important;
    text-align: center !important;
}

#csp-availability-popup .csp-popup-content .csp-popup-close:hover {
    background: #f5f5f5 !important;
    border-color: #999 !important;
    color: #333 !important;
    transform: scale(1.15) !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25) !important;
}

#csp-availability-popup .csp-popup-content .csp-popup-close:active {
    transform: scale(1.05) !important;
}

/* ===========================
   Popup Body Typography
   =========================== */

.csp-popup-body h3 {
    margin-top: 0;
    margin-bottom: 16px;
    color: #333;
    font-size: 20px;
    font-weight: 600;
}

.csp-popup-body p {
    margin: 8px 0;
    color: #666;
    line-height: 1.6;
    font-size: 16px;
}

.csp-popup-body p:last-child {
    margin-bottom: 0;
}

.csp-popup-body strong {
    color: #333;
    font-weight: 600;
}

/* ===========================
   Popup Title
   =========================== */

.csp-popup-title {
    margin: 0 0 20px 0;
    padding-bottom: 12px;
    border-bottom: 2px solid #e9ecef;
    color: #333;
    font-size: 20px;
    font-weight: 600;
    text-align: center;
}

/* ===========================
   Status Cards Layout
   =========================== */

.csp-status-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}

.csp-status-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px 20px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
    text-align: center;
}

.csp-status-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

.csp-card-content {
    width: 100%;
}

.csp-card-number {
    font-size: 36px;
    font-weight: 700;
    line-height: 1;
    margin-bottom: 8px;
}

.csp-card-label {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    opacity: 0.95;
}

/* Card color variants */
.csp-card-available {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: white;
}

.csp-card-on-trip {
    background: linear-gradient(135deg, #ffc107 0%, #ff9800 100%);
    color: #2c3e50;
}

.csp-card-off-duty {
    background: linear-gradient(135deg, #6c757d 0%, #495057 100%);
    color: white;
}

/* ===========================
   Footer Text
   =========================== */

.csp-footer-text {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid #e9ecef;
    color: #6c757d;
    font-size: 13px;
    line-height: 1.6;
    text-align: center;
}

/* ===========================
   Info Boxes
   =========================== */

.csp-info-box {
    padding: 18px 20px;
    border-radius: 10px;
    border-left: 4px solid;
    background: #f8f9fa;
}

.csp-info-text {
    font-size: 14px;
    line-height: 1.6;
    color: #495057;
}

.csp-info-text strong {
    display: block;
    font-size: 16px;
    margin-bottom: 8px;
    font-weight: 600;
    color: #2c3e50;
}

.csp-info-text p {
    margin: 0;
    color: #6c757d;
}

.csp-info-text small {
    font-size: 13px;
    font-weight: normal;
    opacity: 0.85;
    display: block;
    margin-top: 8px;
    line-height: 1.5;
    color: #6c757d;
}

/* Success - Available */
.csp-info-success {
    border-left-color: #28a745;
    background: #f1f9f3;
}

.csp-info-success strong {
    color: #28a745;
}

/* Warning - On Trip */
.csp-info-warning {
    border-left-color: #ffc107;
    background: #fffbf0;
}

.csp-info-warning strong {
    color: #f39c12;
}

/* Closed - Off Duty */
.csp-info-closed {
    border-left-color: #dc3545;
    background: #fef5f6;
}

.csp-info-closed strong {
    color: #dc3545;
}

/* Unknown */
.csp-info-unknown {
    border-left-color: #6c757d;
    background: #f8f9fa;
}

.csp-info-unknown strong {
    color: #6c757d;
}

/* ===========================
   Responsive Popup Styles
   =========================== */

/* Tablet and mobile button positioning */
@media (max-width: 768px) {
    .csp-button-wrapper {
        top: 135px !important;
        right: 10px !important;
        gap: 10px;
    }
    
    .csp-availability-button {
        padding: 5px !important;
        width: 40px;
        height: 40px;
    }
    
    .csp-intro-tooltip {
        right: 55px;
        font-size: 12px;
        padding: 10px 12px;
        max-width: 160px;
    }
    
    .csp-intro-tooltip::after {
        right: -6px;
        border-left: 8px solid #2C3E50;
        border-top: 6px solid transparent;
        border-bottom: 6px solid transparent;
    }
}

/* Mobile-specific styles for screens under 480px */
@media (max-width: 480px) {
    .csp-popup-content {
        padding: 20px;
        max-width: 100%;
        margin: 0 10px;
    }
    
    .csp-popup-body h3 {
        font-size: 18px;
        margin-bottom: 12px;
    }
    
    .csp-popup-body p {
        font-size: 14px;
        line-height: 1.5;
    }
    
    .csp-popup-close {
        width: 36px;
        height: 36px;
        font-size: 24px;
    }
    
    .csp-status-cards {
        grid-template-columns: 1fr;
    }
    
    .csp-status-card {
        padding: 16px;
    }
    
    .csp-card-number {
        font-size: 28px;
    }
    
    .csp-card-icon {
        font-size: 36px;
    }
    
    .csp-info-box {
        padding: 16px;
        gap: 12px;
    }
    
    .csp-info-icon {
        font-size: 32px;
    }
    
    .csp-popup-title {
        font-size: 18px;
    }
}

/* Extra small screens */
@media (max-width: 360px) {
    .csp-popup-modal {
        padding: 15px;
    }
    
    .csp-popup-content {
        padding: 16px;
    }
    
    .csp-popup-body h3 {
        font-size: 16px;
    }
}

/* ===========================
   Accessibility Enhancements
   =========================== */

/* Focus states for keyboard navigation */
.csp-availability-button:focus {
    outline: 3px solid rgba(255, 255, 255, 0.5);
    outline-offset: 2px;
}

.csp-popup-close:focus {
    outline: 2px solid #007bff;
    outline-offset: 2px;
}

/* Ensure proper touch target size */
@media (pointer: coarse) {
    .csp-popup-close {
        min-width: 44px;
        min-height: 44px;
    }
}
