/**
 * Kerala Auto Taxi - Frontend Styles
 * Modern, clean, Kerala-inspired design (greens + yellows)
 */

:root {
    --kat-primary: #0f766e;      /* Deep Teal - Kerala backwaters vibe */
    --kat-accent: #f59e0b;       /* Amber / Gold */
    --kat-success: #10b981;
    --kat-danger: #ef4444;
    --kat-bg: #f8fafc;
}

.kat-container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 1rem;
}

.kat-header {
    background: linear-gradient(135deg, var(--kat-primary), #134e4b);
    color: white;
    padding: 1.5rem 0;
    box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1);
}

.kat-header h1 {
    font-size: 2rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.kat-header .subtitle {
    opacity: 0.9;
    font-size: 1rem;
}

.kat-card {
    background: white;
    border-radius: 16px;
    box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.kat-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
}

.kat-map-container {
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1);
    border: 1px solid #e2e8f0;
}

#kat-passenger-map {
    height: 520px;
    width: 100%;
    z-index: 10;
}

.kat-driver-marker {
    background: #10b981;
    border: 3px solid white;
    box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.3);
}

.kat-toggle {
    position: relative;
    display: inline-block;
    width: 280px;
    height: 64px;
}

.kat-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.kat-toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ef4444;
    transition: .4s;
    border-radius: 9999px;
    display: flex;
    align-items: center;
    padding: 4px;
    font-weight: 700;
    color: white;
    font-size: 1.1rem;
    box-shadow: inset 0 2px 4px 0 rgb(0 0 0 / 0.1);
    pointer-events: none; /* Ensures clicks reach the hidden checkbox for reliable toggle */
}

.kat-toggle-slider:before {
    position: absolute;
    content: "";
    height: 52px;
    width: 52px;
    left: 6px;
    bottom: 6px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
    box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1);
}

input:checked + .kat-toggle-slider {
    background-color: #10b981;
}

input:checked + .kat-toggle-slider:before {
    transform: translateX(216px);
}

.kat-toggle-label {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    font-weight: 700;
    transition: all 0.3s;
    z-index: 2;
    pointer-events: none; /* Ensures clicks reach the hidden checkbox */
}

.kat-toggle-label.on {
    left: 20px;
    color: white;
}

.kat-toggle-label.off {
    right: 20px;
    color: white;
}

input:checked + .kat-toggle-slider .kat-toggle-label.off {
    opacity: 0.6;
}

input:not(:checked) + .kat-toggle-slider .kat-toggle-label.on {
    opacity: 0.6;
}

.kat-driver-card {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.kat-driver-card:hover {
    border-color: var(--kat-primary);
    box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.1);
}

.kat-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    font-weight: 600;
    border-radius: 9999px;
    transition: all 0.2s ease;
    text-decoration: none;
    cursor: pointer;
    border: none;
    font-size: 1rem;
}

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

.kat-btn-primary:hover {
    background-color: #134e4b;
    transform: translateY(-1px);
}

.kat-btn-success {
    background-color: #10b981;
    color: white;
}

.kat-btn-success:hover {
    background-color: #059669;
}

.kat-btn-amber {
    background-color: #f59e0b;
    color: white;
}

.kat-btn-amber:hover {
    background-color: #d97706;
}

.kat-btn-danger {
    background-color: #ef4444;
    color: white;
}

.kat-status-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.875rem;
    font-weight: 600;
}

.kat-status-available {
    background-color: #d1fae5;
    color: #065f46;
}

.kat-status-offline {
    background-color: #fee2e2;
    color: #991b1b;
}

.kat-alert {
    padding: 1rem 1.25rem;
    border-radius: 12px;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.kat-alert-success {
    background-color: #d1fae5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}

.kat-alert-error {
    background-color: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.kat-alert-info {
    background-color: #dbeafe;
    color: #1e40af;
    border: 1px solid #bfdbfe;
}

.kat-stand-select {
    padding: 0.75rem 1rem;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    font-size: 1rem;
    width: 100%;
    transition: border-color 0.2s;
}

.kat-stand-select:focus {
    border-color: var(--kat-primary);
    outline: none;
    box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.1);
}

.kat-driver-list {
    max-height: 520px;
    overflow-y: auto;
    scrollbar-width: thin;
}

.kat-modal {
    animation: katModalPop 0.2s ease-out forwards;
}

@keyframes katModalPop {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(10px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* Leaflet custom popup styling */
.leaflet-popup-content-wrapper {
    border-radius: 12px;
    box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.2);
    padding: 0;
}

.leaflet-popup-content {
    margin: 0;
    padding: 1rem;
    min-width: 220px;
}

.leaflet-popup-tip {
    background: white;
}

/* Responsive tweaks */
@media (max-width: 768px) {
    #kat-passenger-map {
        height: 380px;
    }
    
    .kat-toggle {
        width: 240px;
        height: 56px;
    }
    
    .kat-toggle-slider:before {
        height: 46px;
        width: 46px;
    }
    
    input:checked + .kat-toggle-slider:before {
        transform: translateX(180px);
    }
}
