/**
 * Prayer Times Widget - Styles
 * Modern, clean design with Dark/Light Mode
 */

/* ============================================
   CSS VARIABLES - LIGHT MODE (DEFAULT)
   ============================================ */
.prayertimes-container {
    /* Colors */
    --pt-bg: #ffffff;
    --pt-bg-alt: #f8f9fa;
    --pt-text: #1b1b1b;
    --pt-text-light: #6c757d;
    --pt-primary: #2d6a4f;
    --pt-primary-light: #40916c;
    --pt-primary-dark: #1b4332;
    --pt-secondary: #d8f3dc;
    --pt-border: #e9ecef;

    /* Other */
    --pt-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    --pt-shadow-lg: 0 4px 20px rgba(0, 0, 0, 0.12);
    --pt-radius: 12px;
    --pt-radius-sm: 8px;
    --pt-font: 'Segoe UI', system-ui, -apple-system, sans-serif;

    /* Base */
    font-family: var(--pt-font);
    background: var(--pt-bg);
    border-radius: var(--pt-radius);
    box-shadow: var(--pt-shadow-lg);
    overflow: hidden;
    max-width: 480px;
    margin: 0 auto;
    border: 1px solid var(--pt-border);
    color: var(--pt-text);
}

/* ============================================
   DARK MODE - OVERRIDES
   ============================================ */
.prayertimes-container[data-theme="dark"] {
    --pt-bg: #1a1a2e;
    --pt-bg-alt: #16213e;
    --pt-text: #eaeaea;
    --pt-text-light: #a0a0a0;
    --pt-primary: #4ade80;
    --pt-primary-light: #22c55e;
    --pt-primary-dark: #16a34a;
    --pt-secondary: #1e3a5f;
    --pt-border: #2d3748;
    --pt-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
    --pt-shadow-lg: 0 4px 20px rgba(0, 0, 0, 0.5);
}

/* ============================================
   HEADER
   ============================================ */
.prayertimes-header {
    background: linear-gradient(135deg, var(--pt-primary) 0%, var(--pt-primary-light) 100%);
    padding: 20px 24px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 12px;
}

.prayertimes-header-left {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.prayertimes-title {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
    color: #ffffff;
}

.prayertimes-icon {
    width: 28px;
    height: 28px;
    color: #ffffff;
}

.prayertimes-location {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    opacity: 0.9;
    color: #ffffff;
}

.prayertimes-location .location-icon {
    width: 16px;
    height: 16px;
}

/* Theme Toggle Switch */
.theme-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
}

.theme-toggle-label {
    font-size: 0.8rem;
    opacity: 0.9;
    color: #fff;
}

.theme-switch {
    position: relative;
    width: 52px;
    height: 26px;
}

.theme-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.theme-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.3);
    transition: 0.3s;
    border-radius: 26px;
}

.theme-slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background-color: #fff;
    transition: 0.3s;
    border-radius: 50%;
}

.theme-switch input:checked+.theme-slider {
    background-color: rgba(0, 0, 0, 0.4);
}

.theme-switch input:checked+.theme-slider:before {
    transform: translateX(26px);
}

.theme-slider svg {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 14px;
    height: 14px;
    color: #fff;
}

.theme-slider .sun-icon {
    left: 6px;
}

.theme-slider .moon-icon {
    right: 6px;
}

/* ============================================
   CONTENT AREA
   ============================================ */
.prayertimes-content {
    padding: 24px;
    background: var(--pt-bg);
    color: var(--pt-text);
}

/* ============================================
   BUTTONS
   ============================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 20px;
    border: none;
    border-radius: var(--pt-radius-sm);
    font-family: var(--pt-font);
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
}

.btn svg {
    width: 18px;
    height: 18px;
}

.btn-primary {
    background: var(--pt-primary);
    color: #ffffff;
}

.btn-primary:hover {
    background: var(--pt-primary-dark);
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--pt-bg-alt);
    color: var(--pt-text);
    border: 1px solid var(--pt-border);
}

.btn-secondary:hover {
    background: var(--pt-border);
}

.btn-link {
    background: transparent;
    color: var(--pt-primary);
    padding: 8px 12px;
}

.btn-link:hover {
    background: var(--pt-secondary);
    color: var(--pt-primary);
}

.btn-link svg {
    color: var(--pt-primary);
}

/* ============================================
   LOCATION REQUEST
   ============================================ */
.prayertimes-location-request {
    text-align: center;
    padding: 20px 0;
    color: var(--pt-text);
}

.location-request-content {
    max-width: 320px;
    margin: 0 auto;
}

.location-icon-large {
    width: 64px;
    height: 64px;
    color: var(--pt-primary);
    margin-bottom: 16px;
}

.location-request-text {
    color: var(--pt-text-light);
    margin-bottom: 20px;
    line-height: 1.6;
}

.location-request-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* ============================================
   MANUAL SEARCH
   ============================================ */
.prayertimes-manual-search {
    padding: 10px 0;
    color: var(--pt-text);
}

.search-form {
    display: flex;
    gap: 10px;
    margin-bottom: 16px;
}

.country-select {
    padding: 12px 16px;
    border: 1px solid var(--pt-border);
    border-radius: var(--pt-radius-sm);
    font-family: var(--pt-font);
    font-size: 0.95rem;
    background: var(--pt-bg);
    color: var(--pt-text);
    min-width: 130px;
    cursor: pointer;
}

.city-input {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid var(--pt-border);
    border-radius: var(--pt-radius-sm);
    font-family: var(--pt-font);
    font-size: 0.95rem;
    background: var(--pt-bg);
    color: var(--pt-text);
}

.city-input:focus {
    outline: none;
    border-color: var(--pt-primary);
    box-shadow: 0 0 0 3px rgba(45, 106, 79, 0.15);
}

.city-input::placeholder {
    color: var(--pt-text-light);
}

.btn-search {
    padding: 12px 16px;
}

.city-suggestions {
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid var(--pt-border);
    border-radius: var(--pt-radius-sm);
    background: var(--pt-bg);
    display: none;
}

.city-suggestions.active {
    display: block;
}

.city-suggestion {
    padding: 12px 16px;
    cursor: pointer;
    transition: background 0.15s;
    border-bottom: 1px solid var(--pt-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--pt-text);
    background: var(--pt-bg);
}

.city-suggestion:last-child {
    border-bottom: none;
}

.city-suggestion:hover {
    background: var(--pt-secondary);
}

.city-suggestion-name {
    font-weight: 500;
    color: var(--pt-text);
}

.city-suggestion-info {
    font-size: 0.85rem;
    color: var(--pt-text-light);
}

.btn-back-location {
    margin-top: 16px;
    font-size: 0.9rem;
}

/* ============================================
   LOADING
   ============================================ */
.prayertimes-loading {
    text-align: center;
    padding: 40px 20px;
    color: var(--pt-text);
}

.loading-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid var(--pt-border);
    border-top-color: var(--pt-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 16px;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.prayertimes-loading p {
    color: var(--pt-text-light);
}

/* ============================================
   ERROR
   ============================================ */
.prayertimes-error {
    text-align: center;
    padding: 30px 20px;
    color: var(--pt-text);
}

.error-icon {
    width: 48px;
    height: 48px;
    color: #dc3545;
    margin-bottom: 16px;
}

.error-message {
    color: var(--pt-text-light);
    margin-bottom: 16px;
}

/* ============================================
   PRAYER TIMES DISPLAY
   ============================================ */
.prayertimes-display {
    animation: fadeIn 0.3s ease;
    color: var(--pt-text);
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.prayertimes-date-info {
    display: flex;
    justify-content: center;
    gap: 12px;
    padding: 12px;
    background: var(--pt-bg-alt);
    border-radius: var(--pt-radius-sm);
    margin-bottom: 16px;
    font-size: 0.95rem;
    flex-wrap: wrap;
    color: var(--pt-text);
}

.separator {
    color: var(--pt-text-light);
}

/* ============================================
   MAP
   ============================================ */
.prayertimes-map {
    border-radius: var(--pt-radius-sm);
    overflow: hidden;
    margin-bottom: 16px;
    border: 1px solid var(--pt-border);
    background: var(--pt-bg-alt);
}

.leaflet-container {
    font-family: var(--pt-font);
    background: var(--pt-bg-alt);
}

.leaflet-attribution-flag {
    display: none !important;
}

/* Dark mode map fix */
.prayertimes-container[data-theme="dark"] .leaflet-tile {
    filter: brightness(0.7) invert(1) hue-rotate(180deg);
}

.prayertimes-container[data-theme="dark"] .leaflet-popup-content-wrapper {
    background: var(--pt-bg);
    color: var(--pt-text);
}

.prayertimes-container[data-theme="dark"] .leaflet-popup-tip {
    background: var(--pt-bg);
}

.prayertimes-container[data-theme="dark"] .leaflet-control-zoom a {
    background: var(--pt-bg);
    color: var(--pt-text);
    border-color: var(--pt-border);
}

/* Custom marker */
.custom-marker {
    background: var(--pt-primary);
    border: 3px solid #ffffff;
    border-radius: 50%;
    width: 16px !important;
    height: 16px !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

/* ============================================
   TABLE
   ============================================ */
.prayertimes-table-wrapper {
    overflow-x: auto;
    background: var(--pt-bg);
    border-radius: var(--pt-radius-sm);
    border: 1px solid var(--pt-border);
}

.prayertimes-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 0;
    background: var(--pt-bg);
    color: var(--pt-text);
}

.prayertimes-table th,
.prayertimes-table td {
    padding: 14px 16px;
    text-align: left;
    background: var(--pt-bg);
    color: var(--pt-text);
}

.prayertimes-table th {
    background: var(--pt-bg-alt);
    font-weight: 600;
    color: var(--pt-text);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.prayertimes-table tbody tr {
    border-bottom: 1px solid var(--pt-border);
    transition: background 0.15s;
    background: var(--pt-bg);
    color: var(--pt-text);
}

.prayertimes-table tbody tr:last-child {
    border-bottom: none;
}

.prayertimes-table tbody tr:hover {
    background: var(--pt-secondary);
}

.prayertimes-table tbody tr.current-prayer {
    background: var(--pt-secondary);
    font-weight: 600;
}

.prayertimes-table tbody tr.current-prayer td:first-child {
    position: relative;
}

.prayertimes-table tbody tr.current-prayer td:first-child::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: var(--pt-primary);
    border-radius: 0 2px 2px 0;
}

.prayer-name {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--pt-text);
}

.prayer-icon {
    width: 20px;
    height: 20px;
    color: var(--pt-primary);
}

.prayer-time {
    font-variant-numeric: tabular-nums;
    color: var(--pt-text);
    font-weight: 500;
}

/* ============================================
   ACTIONS
   ============================================ */
.prayertimes-actions {
    text-align: center;
    padding-top: 8px;
}

/* ============================================
   HIJRI DATE
   ============================================ */
.hijri-date {
    color: var(--pt-primary);
    font-weight: 500;
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 480px) {
    .prayertimes-header {
        padding: 16px;
        align-items: center;
        flex-wrap: nowrap;
    }

    .prayertimes-content {
        padding: 16px;
    }

    .search-form {
        flex-direction: column;
    }

    .country-select {
        min-width: 100%;
    }

    .prayertimes-table {
        font-size: calc(0.8rem);
    }

    .prayertimes-table th,
    .prayertimes-table td {
        padding: 10px 12px;
    }

    .theme-toggle-label {
        display: none;
    }
}