/* style.css - Yardımcı Stil Dosyası */

/* Spinner (yükleniyor) animasyonu */
.spinner {
    border: 4px solid #f3f4f6; /* Açık gri */
    border-top: 4px solid #3b82f6; /* Mavi */
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 0 auto;
}

/* Spinner animasyonu */
@keyframes spin {
    0% { 
        transform: rotate(0deg); 
    }
    100% { 
        transform: rotate(360deg); 
    }
}

/* Ek stiller */

/* Form elemanları için hover efektleri */
input[type="text"]:hover,
input[type="date"]:hover,
input[type="time"]:hover {
    border-color: #93c5fd;
    box-shadow: 0 0 0 1px #93c5fd;
}

/* Buton hover efektleri için ek stil */
button[type="submit"]:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
    transition: all 0.2s ease-in-out;
}

/* Sonuç kartları için güzel geçiş efektleri */
#results-content {
    animation: fadeIn 0.5s ease-in-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Hata mesajları için dikkat çekici stil */
#error-message {
    animation: shake 0.5s ease-in-out;
}

@keyframes shake {
    0%, 100% {
        transform: translateX(0);
    }
    25% {
        transform: translateX(-5px);
    }
    75% {
        transform: translateX(5px);
    }
}

/* Harita container'ı için stil */
#map {
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

/* Chart container'ı için stil */
#resultsChart {
    max-height: 400px;
}

/* Responsive tasarım için medya sorguları */
@media (max-width: 768px) {
    .spinner {
        width: 30px;
        height: 30px;
        border-width: 3px;
    }
    
    #map {
        height: 300px !important;
    }
    
    .container {
        padding: 1rem;
    }
    
    .grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
}

/* Autocomplete dropdown'ları için özel stil */
.pac-container {
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    border: 1px solid #e5e7eb;
}

.pac-item {
    border-bottom: 1px solid #f3f4f6;
    padding: 8px 12px;
}

.pac-item:hover {
    background-color: #f8fafc;
}

/* En iyi zaman vurgusu için özel stil */
#best-time {
    color: #059669;
    font-weight: 700;
}

#best-duration {
    color: #0d9488;
    font-weight: 600;
}

/* Takvim butonu için özel hover efekti */
#calendar-button-container a:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(34, 197, 94, 0.3);
    transition: all 0.3s ease;
}

/* Form validasyon stilleri */
input:invalid {
    border-color: #ef4444;
    box-shadow: 0 0 0 1px #ef4444;
}

input:valid {
    border-color: #10b981;
}

/* Loading durumunda form elemanlarını devre dışı bırak */
.form-disabled {
    opacity: 0.6;
    pointer-events: none;
    cursor: not-allowed;
}

.form-disabled input,
.form-disabled select,
.form-disabled button,
.form-disabled textarea {
    background-color: #f3f4f6 !important;
    color: #6b7280 !important;
    cursor: not-allowed !important;
    border-color: #d1d5db !important;
}

.form-disabled button {
    background-color: #9ca3af !important;
}

/* Başarı mesajı animasyonu */
.success-highlight {
    animation: pulse 2s ease-in-out;
}

@keyframes pulse {
    0%, 100% {
        background-color: #d1fae5;
    }
    50% {
        background-color: #a7f3d0;
    }
}

/* Session Autocomplete Styles */
.autocomplete-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #d1d5db;
    border-top: none;
    border-radius: 0 0 8px 8px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    max-height: 200px;
    overflow-y: auto;
}

.autocomplete-item {
    padding: 12px 16px;
    cursor: pointer;
    border-bottom: 1px solid #f3f4f6;
    transition: background-color 0.2s ease;
    font-size: 14px;
    line-height: 1.4;
}

.autocomplete-item:hover,
.autocomplete-item.highlighted {
    background-color: #f8fafc;
    color: #1f2937;
}

.autocomplete-item:last-child {
    border-bottom: none;
}

/* Input container için relative positioning */
.input-container {
    position: relative;
}

/* Input'lar için autocomplete ile uyumlu stil */
#origin, #destination {
    border-radius: 8px 8px 0 0;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

#origin:focus, #destination:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
    outline: none;
}

/* Autocomplete aktif olduğunda input köşelerini düzelt */
#origin:focus + .autocomplete-suggestions,
#destination:focus + .autocomplete-suggestions {
    border-color: #3b82f6;
}

/* Responsive design for autocomplete */
@media (max-width: 768px) {
    .autocomplete-suggestions {
        font-size: 16px; /* Prevent zoom on iOS */
    }
    
    .autocomplete-item {
        padding: 14px 16px;
    }
}

/* Loading state for autocomplete */
.autocomplete-loading {
    padding: 12px 16px;
    text-align: center;
    color: #6b7280;
    font-size: 14px;
}

.autocomplete-loading::after {
    content: "...";
    animation: dots 1.5s steps(4, end) infinite;
}

@keyframes dots {
    0%, 20% {
        color: rgba(0,0,0,0);
        text-shadow: .25em 0 0 rgba(0,0,0,0),
                     .5em 0 0 rgba(0,0,0,0);
    }
    40% {
        color: #6b7280;
        text-shadow: .25em 0 0 rgba(0,0,0,0),
                     .5em 0 0 rgba(0,0,0,0);
    }
    60% {
        text-shadow: .25em 0 0 #6b7280,
                     .5em 0 0 rgba(0,0,0,0);
    }
    80%, 100% {
        text-shadow: .25em 0 0 #6b7280,
                     .5em 0 0 #6b7280;
    }
}
