/**
 * Sky Prayer City Search and Settings Panel Styles
 *
 * @package Sky_Prayer_Timetable
 */

/* Container */
.sky-prayer-search-container {
    position: relative;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    font-size: 14px;
    line-height: 1.5;
    box-sizing: border-box;
}

.sky-prayer-search-container *,
.sky-prayer-search-container *::before,
.sky-prayer-search-container *::after {
    box-sizing: border-box;
}

/* Search Bar */
.sky-prayer-search-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    background: transparent;
    border: none;
    border-radius: 8px;
    padding: 0;
}

/* Search Input Wrapper - the main search field with border */
.sky-prayer-search-input-wrap {
    flex: 1;
    display: flex;
    align-items: center;
    position: relative;
    background: #fff;
    border: none;
    border-radius: 8px;
    padding: 0 12px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.sky-prayer-search-input-wrap:focus-within {
    /* Focus styles controlled via Elementor */
}

/* Search Icon - inline flex item inside the bordered area */
svg.sky-prayer-search-icon {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    color: #999;
    display: block;
    margin-right: 10px;
}

/* Search Input - override theme styles with high specificity */
.sky-prayer-search-container .sky-prayer-search-input-wrap input.sky-prayer-search-input,
.sky-prayer-search-container .sky-prayer-search-input-wrap input.sky-prayer-search-input[type="text"] {
    flex: 1;
    min-width: 0;
    border: none !important;
    border-width: 0 !important;
    outline: none !important;
    padding: 12px 8px 12px 0 !important;
    font-size: 15px;
    background: transparent !important;
    background-color: transparent !important;
    color: #333;
    height: auto !important;
    max-width: none;
    width: auto;
    box-shadow: none !important;
    border-radius: 0 !important;
}

.sky-prayer-search-container .sky-prayer-search-input-wrap input.sky-prayer-search-input:focus,
.sky-prayer-search-container .sky-prayer-search-input-wrap input.sky-prayer-search-input[type="text"]:focus {
    outline: none !important;
    box-shadow: none !important;
    border: none !important;
}

/* Selected state - when input has value, show it can be cleared on click */
.sky-prayer-search-input.has-value {
    cursor: pointer;
}

.sky-prayer-search-container .sky-prayer-search-input::placeholder {
    color: #999;
}

.sky-prayer-search-spinner {
    position: absolute;
    right: 44px;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    color: #0073aa;
    animation: sky-prayer-spin 1s linear infinite;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sky-prayer-search-spinner svg {
    width: 18px;
    height: 18px;
}

/* Geolocation button - inside the bordered search field */
.sky-prayer-search-input-wrap .sky-prayer-geo-btn {
    flex-shrink: 0;
    border: none;
    background: transparent;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s, color 0.2s;
    color: #666;
    padding: 6px;
    margin: 0;
}

.sky-prayer-search-input-wrap .sky-prayer-geo-btn:hover {
    background: #f0f0f0;
    color: #0073aa;
}

.sky-prayer-search-input-wrap .sky-prayer-geo-btn:active {
    transform: scale(0.95);
}

/* Icon inside geo button - allow free sizing via width/height attributes on SVG */
.sky-prayer-search-input-wrap .sky-prayer-geo-btn svg {
    display: block;
    flex-shrink: 0;
    width: 20px;
    height: 20px;
}

.sky-prayer-search-input-wrap .sky-prayer-geo-btn.loading {
    animation: sky-prayer-pulse 1s ease-in-out infinite;
}

@keyframes sky-prayer-spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

/* Settings Button */
.sky-prayer-settings-btn {
    flex-shrink: 0;
    border: none;
    background: #f5f5f5;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s, transform 0.1s, color 0.2s;
    color: #666;
    margin-left: 8px;
    padding: 12px;
}

.sky-prayer-settings-btn:hover {
    background: #e8e8e8;
    color: #0073aa;
}

.sky-prayer-settings-btn:active {
    transform: scale(0.95);
}

/* Icon inside settings button - allow free sizing via width/height attributes on SVG */
.sky-prayer-settings-btn svg {
    display: block;
    flex-shrink: 0;
}

@keyframes sky-prayer-pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

/* Dropdown */
.sky-prayer-search-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 4px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    max-height: 320px;
    overflow-y: auto;
}

.sky-prayer-search-results {
    list-style: none;
    margin: 0;
    padding: 4px;
}

.sky-prayer-search-result {
    padding: 12px 16px;
    cursor: pointer;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    transition: background-color 0.15s;
}

.sky-prayer-search-result:hover,
.sky-prayer-search-result.active {
    background: #f0f6fc;
}

.sky-prayer-result-location {
    flex: 1;
    color: #333;
    font-weight: 500;
}

.sky-prayer-result-badge {
    font-size: 11px;
    padding: 2px 8px;
    background: #e7f3ff;
    color: #0073aa;
    border-radius: 10px;
    text-transform: uppercase;
    font-weight: 600;
}

.sky-prayer-no-results {
    padding: 16px;
    text-align: center;
    color: #666;
}

/* Settings Overlay */
.sky-prayer-settings-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 10000;
}

/* Settings Panel */
.sky-prayer-settings-panel {
    position: fixed;
    top: 0;
    right: -400px;
    width: 380px;
    max-width: 100%;
    height: 100%;
    background: #fff;
    z-index: 10001;
    display: flex;
    flex-direction: column;
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.2);
    transition: right 0.3s ease;
}

.sky-prayer-settings-panel.open {
    right: 0;
}

/* Settings Header */
.sky-prayer-settings-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid #eee;
    background: #f8f9fa;
}

.sky-prayer-settings-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #333;
}

.sky-prayer-settings-close {
    border: none;
    background: transparent;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.2s;
    color: #666;
    padding: 8px;
}

.sky-prayer-settings-close:hover {
    background: #eee;
    color: #333;
}

/* Icon inside close button - allow free sizing via width/height attributes on SVG */
.sky-prayer-settings-close svg {
    display: block;
    flex-shrink: 0;
}

/* Settings Body */
.sky-prayer-settings-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.sky-prayer-settings-group {
    margin-bottom: 20px;
}

.sky-prayer-settings-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    color: #333;
    font-size: 13px;
}

.sky-prayer-settings-row {
    display: flex;
    gap: 12px;
}

.sky-prayer-settings-half {
    flex: 1;
}

.sky-prayer-settings-select,
.sky-prayer-settings-input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    color: #333;
    background: #fff;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.sky-prayer-settings-select:focus,
.sky-prayer-settings-input:focus {
    outline: none;
    border-color: #0073aa;
    box-shadow: 0 0 0 2px rgba(0, 115, 170, 0.1);
}

.sky-prayer-settings-input::placeholder {
    color: #999;
}

/* Toggle Switch */
.sky-prayer-settings-toggle {
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid #eee;
}

.sky-prayer-toggle-label {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    position: relative;
}

.sky-prayer-toggle-label input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    pointer-events: none;
}

.sky-prayer-toggle-switch {
    display: block;
    position: relative;
    width: 44px;
    height: 24px;
    background: #ddd;
    border-radius: 12px;
    transition: background-color 0.2s;
    flex-shrink: 0;
}

.sky-prayer-toggle-switch::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 20px;
    height: 20px;
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
    transition: transform 0.2s;
}

.sky-prayer-toggle-label input:checked + .sky-prayer-toggle-switch {
    background: #0073aa;
}

.sky-prayer-toggle-label input:checked + .sky-prayer-toggle-switch::after {
    transform: translateX(20px);
}

.sky-prayer-toggle-text {
    font-weight: 500;
    color: #333;
}

/* Location Display */
.sky-prayer-location-display {
    margin-top: 16px;
}

.sky-prayer-location-info {
    padding: 12px;
    background: #f8f9fa;
    border-radius: 6px;
    border: 1px solid #eee;
}

.sky-prayer-location-name {
    color: #333;
    font-weight: 500;
}

/* Settings Footer */
.sky-prayer-settings-footer {
    display: flex;
    gap: 10px;
    padding: 16px 20px;
    border-top: 1px solid #eee;
    background: #f8f9fa;
}

.sky-prayer-settings-reset,
.sky-prayer-settings-save {
    flex: 1;
    padding: 12px 16px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.1s;
}

.sky-prayer-settings-reset {
    background: #eee;
    color: #666;
}

.sky-prayer-settings-reset:hover {
    background: #ddd;
}

.sky-prayer-settings-save {
    background: #0073aa;
    color: #fff;
}

.sky-prayer-settings-save:hover {
    background: #005a87;
}

.sky-prayer-settings-reset:active,
.sky-prayer-settings-save:active {
    transform: scale(0.98);
}

/* Toast Notification */
.sky-prayer-toast {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    z-index: 10002;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.sky-prayer-toast.success {
    background: #00a32a;
    color: #fff;
}

.sky-prayer-toast.error {
    background: #d63638;
    color: #fff;
}

/* Dark Theme */
.sky-prayer-search-dark .sky-prayer-search-bar {
    background: #2c2c2c;
}

.sky-prayer-search-dark .sky-prayer-search-input {
    color: #fff;
}

.sky-prayer-search-dark .sky-prayer-search-input::placeholder {
    color: #888;
}

.sky-prayer-search-dark .sky-prayer-search-icon {
    color: #888;
}

.sky-prayer-search-dark .sky-prayer-settings-btn {
    background: #3c3c3c;
    color: #aaa;
}

.sky-prayer-search-dark .sky-prayer-settings-btn:hover {
    background: #4c4c4c;
    color: #0073aa;
}

.sky-prayer-search-dark .sky-prayer-search-input-wrap .sky-prayer-geo-btn {
    color: #aaa;
}

.sky-prayer-search-dark .sky-prayer-search-input-wrap .sky-prayer-geo-btn:hover {
    background: #3c3c3c;
    color: #0073aa;
}

.sky-prayer-search-dark .sky-prayer-search-dropdown {
    background: #2c2c2c;
    border-color: #444;
}

.sky-prayer-search-dark .sky-prayer-search-result:hover,
.sky-prayer-search-dark .sky-prayer-search-result.active {
    background: #3c3c3c;
}

.sky-prayer-search-dark .sky-prayer-result-location {
    color: #eee;
}

.sky-prayer-search-dark .sky-prayer-no-results {
    color: #aaa;
}

/* Responsive */
@media (max-width: 480px) {
    .sky-prayer-settings-panel {
        width: 100%;
        right: -100%;
    }

    .sky-prayer-settings-panel.open {
        right: 0;
    }

    .sky-prayer-settings-row {
        flex-direction: column;
        gap: 16px;
    }

    .sky-prayer-search-bar {
        padding: 2px;
    }

    .sky-prayer-settings-btn {
        padding: 10px;
    }

    .sky-prayer-search-input-wrap {
        padding-left: 10px;
    }

    .sky-prayer-search-input {
        padding: 10px 40px 10px 0;
        font-size: 14px;
    }

    .sky-prayer-search-input-wrap .sky-prayer-geo-btn {
        padding: 6px;
    }

    .sky-prayer-search-spinner {
        right: 38px;
    }
}

/* Body scroll lock when settings open */
body.sky-prayer-settings-open {
    overflow: hidden;
}

/* Scrollbar Styling */
.sky-prayer-search-dropdown::-webkit-scrollbar,
.sky-prayer-settings-body::-webkit-scrollbar {
    width: 6px;
}

.sky-prayer-search-dropdown::-webkit-scrollbar-track,
.sky-prayer-settings-body::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.sky-prayer-search-dropdown::-webkit-scrollbar-thumb,
.sky-prayer-settings-body::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
}

.sky-prayer-search-dropdown::-webkit-scrollbar-thumb:hover,
.sky-prayer-settings-body::-webkit-scrollbar-thumb:hover {
    background: #999;
}

/* Animation for panel */
@media (prefers-reduced-motion: reduce) {
    .sky-prayer-settings-panel {
        transition: none;
    }

    .sky-prayer-search-input-wrap .sky-prayer-geo-btn.loading {
        animation: none;
    }

    .sky-prayer-search-spinner {
        animation: none;
    }
}
