:root {
    --color-primary: #129e54;
    --color-primary-dark: #0d763f;
    --color-text: #ffffff;
    --color-background: rgba(255, 255, 255, 0.08);
    --color-border: rgba(255, 255, 255, 0.2);
    --color-text-dark: #333;
}

.pw-scope {
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color: var(--color-text-dark);
}

.pw-scope .pw-root {
    width: 100%;
    box-sizing: border-box;
    margin: 0 auto;
    max-width: 800px;
}

.pw-card {
    position: relative;
    background: linear-gradient(135deg, var(--color-primary), var(--color-primary-dark));
    color: var(--color-text);
    padding: 18px;
    border-radius: 8px;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25);
}

.pw-scope .pw-header {
    text-align: center;
    margin-bottom: 1rem;
}
.pw-scope .pw-header h1 {
    font-size: 24px;
    margin: 0 0 5px;
    font-weight: 700;
}
.pw-scope .pw-header h2 {
    font-size: 18px;
    margin: 0;
    font-weight: 500;
}

.pw-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    margin: 1rem 0;
    flex-wrap: wrap;
}
.pw-city-selection, .pw-nav {
    display: flex;
    gap: 8px;
    align-items: center;
}
.pw-controls select, .pw-controls button {
    padding: 8px 12px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--color-border);
    color: var(--color-text);
    font-size: 14px;
    cursor: pointer;
    transition: background-color 0.2s;
}
.pw-controls button:hover {
    background: rgba(255, 255, 255, 0.2);
}
.pw-controls select {
    max-width: 200px;
}

.pw-daily-schedule {
    background-color: rgba(0, 0, 0, 0.2);
    padding: 1rem;
    margin-bottom: 1rem;
    border-radius: 6px;
    text-align: center;
}
.pw-countdown {
    margin-top: 0.5rem;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.5rem;
    font-weight: bold;
}
#pw-countdown-time {
    font-variant-numeric: tabular-nums;
}

.pw-table {
    width: 100%;
    border-collapse: separate;
    margin-top: 1rem;
    background-color: var(--color-background);
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}
.pw-table th, .pw-table td {
    padding: 10px 4px;
    text-align: center;
    font-size: 13px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}
.pw-table thead {
    position: -webkit-sticky;
    position: sticky;
    top: 0;
    z-index: 10;

    font-weight: bold;
    font-size: 14px;
}
.pw-table th {
    background-color: rgba(0, 0, 0, 0.75);
}
.pw-table thead th:first-child {
    border-top-left-radius: 8px;
}
.pw-table thead th:last-child {
    border-top-right-radius: 8px;
}
.pw-table tbody tr:nth-child(even) {
    background-color: rgba(0, 0, 0, 0.08);
}
.pw-table tbody tr:hover {
    background-color: rgba(0, 0, 0, 0.15);
}
.pw-table tr.active {
    background-color: #20b05d !important;
    color: #fff !important;
    font-weight: bold;
}

.pw-features {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 1rem;
    align-items: center;
}
.pw-features button {
    background-color: var(--color-background);
    color: var(--color-text);
    border: 1px solid var(--color-border);
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: background-color 0.2s;
}
.pw-features button:hover {
    background-color: rgba(255, 255, 255, 0.2);
}
.pw-features button svg {
    width: 16px;
    height: 16px;
    fill: currentColor;
}

.pw-main-footer {
    margin-top: 1rem;
    padding: 1rem 1rem 0 1rem;
    border-top: 1px solid var(--color-border);
    text-align: center;
    font-size: 12px;
    opacity: 0.7;
}
.pw-main-footer p {
    margin: 0;
    padding: 0;
}
.pw-print-footer {
    display: none;
}


.pw-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    padding: 8px;
}
.pw-toggle-label {
    font-size: 14px;
    user-select: none;
}
.pw-toggle-checkbox {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}
.pw-toggle-switch {
    position: relative;
    width: 44px;
    height: 24px;
    background-color: rgba(0, 0, 0, 0.3);
    border-radius: 9999px;
    transition: background-color 0.2s ease-in-out;
}
.pw-toggle-switch::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 20px;
    height: 20px;
    background-color: white;
    border-radius: 50%;
    transition: transform 0.2s ease-in-out;
}
.pw-toggle-checkbox:checked + .pw-toggle-switch {
    background-color: #f7b731;
}
.pw-toggle-checkbox:checked + .pw-toggle-switch::after {
    transform: translateX(20px);
}

.theme-switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 26px;
}
.theme-switch-checkbox {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}
.theme-switch-slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: #4d525b;
    transition: .4s;
    border-radius: 34px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 4px;
}
.theme-switch-slider:before {
    position: absolute;
    content: "";
    height: 20px; width: 20px;
    left: 3px; bottom: 3px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}
.theme-switch-checkbox:checked + .theme-switch-slider {
    background-color: #87CEEB;
}
.theme-switch-checkbox:checked + .theme-switch-slider:before {
    transform: translateX(24px);
}
.theme-switch-slider svg {
    width: 16px;
    height: 16px;
}

.pw-embed-btn {
    position: absolute;
    top: 10px; right: 10px; z-index: 10;
    width: 28px; height: 28px;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    font-family: serif;
    font-weight: bold;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
}
.pw-embed-btn:hover {
    background-color: rgba(255, 255, 255, 0.25);
}
.pw-embed-backdrop {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 20;
    border-radius: 8px;
}
.pw-embed-backdrop.hidden { display: none; }
.pw-embed-popup {
    background: linear-gradient(135deg, #18a85d, #0f8043);
    color: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.4);
    width: 90%;
    max-width: 400px;
    position: relative;
    box-sizing: border-box;
}
.pw-embed-popup p, .pw-embed-popup h3 {
    margin-top: 0; margin-bottom: 10px;
}
.pw-embed-popup textarea {
    width: 100%; min-height: 120px;
    background-color: rgba(0,0,0,0.2);
    border: 1px solid rgba(255,255,255,0.3);
    color: white;
    border-radius: 4px; padding: 10px;
    font-family: 'Courier New', Courier, monospace; font-size: 13px;
    box-sizing: border-box; resize: vertical;
}
.pw-embed-popup-close {
    position: absolute;
    top: 8px; right: 12px;
    font-size: 24px; color: white;
    cursor: pointer; line-height: 1;
}
.pw-embed-popup .pw-suggestion-link a {
    color: white; text-decoration: underline;
}

body.light-theme .pw-card {
    background: #ffffff;
    color: var(--color-text-dark);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}
body.light-theme .pw-controls select,
body.light-theme .pw-controls button,
body.light-theme .pw-features button,
body.light-theme .pw-embed-btn {
    background-color: #f0f2f5;
    color: var(--color-text-dark);
    border-color: #ddd;
}
body.light-theme .pw-controls button:hover,
body.light-theme .pw-features button:hover {
    background-color: #e9ecef;
}
body.light-theme .pw-table { background-color: #ffffff; }
body.light-theme .pw-table thead { background-color: #f8f9fa; }
body.light-theme .pw-table tbody tr:nth-child(even) { background-color: #f8f9fa; }
body.light-theme .pw-table tbody tr:hover { background-color: #e9ecef; }
body.light-theme .pw-table tr.active { background-color: var(--color-primary) !important; }
body.light-theme .pw-table tr.active td { color: white; }
body.light-theme .pw-daily-schedule { background-color: #f0f2f5; }
body.light-theme .pw-main-footer { border-top-color: #ddd; opacity: 0.6; }
body.light-theme .pw-toggle-switch { background-color: #ccc; }
body.light-theme .pw-toggle-checkbox:checked + .pw-toggle-switch { background-color: var(--color-primary); }
body.light-theme .pw-embed-popup { background: #ffffff; color: var(--color-text-dark); }
body.light-theme .pw-embed-popup textarea { background-color: #f0f2f5; border-color: #ddd; color: var(--color-text-dark); }
body.light-theme .pw-embed-popup-close { color: var(--color-text-dark); }
body.light-theme .pw-embed-popup .pw-suggestion-link a { color: #0d763f; }


body.exporting-image .pw-controls,
body.exporting-image .pw-features,
body.exporting-image .pw-daily-schedule,
body.exporting-image .pw-embed-btn {
    display: none !important;
}

body.exporting-image .pw-card {
    padding-bottom: 5rem !important;
    background: linear-gradient(135deg, var(--color-primary), var(--color-primary-dark)) !important;
    color: var(--color-text) !important;
}

body.exporting-image .pw-table thead {
    position: static !important;
}

body.exporting-image .pw-table tr.active {
    background-color: inherit !important;
    font-weight: normal !important;
}

body.exporting-image .pw-main-footer {
    display: block !important;
    position: absolute !important;
    bottom: 1.5rem !important;
    left: 1.5rem !important;
    right: 1.5rem !important;
    color: var(--color-text) !important;
    opacity: 0.8 !important;
    font-size: 11px !important;
    text-align: center !important;
    border: none;
    padding: 0;
}

body.exporting-image .pw-print-footer {
    display: flex !important;
    position: absolute !important;
    bottom: 3.5rem !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    color: var(--color-text) !important;
    opacity: 0.8 !important;
    font-size: 11px !important;
    gap: 8px;
    align-items: center;
    justify-content: center;
}

body.exporting-image .pw-print-footer p, 
body.exporting-image .pw-main-footer p {
    margin: 0;
}
body.exporting-image .pw-print-footer img {
    height: 1em;
    width: auto;
}



@page {
    size: A4 portrait;
    margin: 0;
}
@media print {
    .pw-table thead {
    position: static !important;
    }
    .pw-controls, .pw-features, .pw-daily-schedule, .pw-embed-btn { display: none !important; }

    html, body { background: transparent !important; }
    .pw-card {
        box-shadow: none !important;
        border-radius: 0 !important;
        padding: 1.5rem !important;
        height: auto !important;
        box-sizing: border-box;
        background: linear-gradient(135deg, var(--color-primary), var(--color-primary-dark)) !important;
        color: var(--color-text) !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    .pw-header h1 { font-size: 1.2em !important; }
    .pw-header h2 { font-size: 1em !important; margin-bottom: 0.5em !important; }
    .pw-table { font-size: 0.7em !important; }
    .pw-table th, .pw-table td { padding: 3px 4px !important; }

    .pw-table, .pw-table thead, .pw-table tbody tr { background-color: transparent !important; }
    .pw-table tbody tr:nth-child(even) { background-color: rgba(0, 0, 0, 0.08) !important; }
    .pw-table th, .pw-table td { color: var(--color-text) !important; }
    
    .pw-table tr.active {
        background-color: inherit !important;
        font-weight: normal !important;
    }
    
    .pw-print-footer, .pw-main-footer {
        position: static !important;
        display: flex !important;
        justify-content: center !important;
        width: 100% !important;
        color: var(--color-text) !important;
        opacity: 0.9 !important;
        font-size: 8px !important;
        align-items: center;
        gap: 5px;
        margin: 0; padding: 0;
    }
    .pw-main-footer {
        display: block !important;
        text-align: center !important;
        margin-top: 15px !important;
        padding-top: 10px !important;
        border-top: 1px solid rgba(255, 255, 255, 0.3) !important;
    }
    .pw-print-footer p, .pw-main-footer p { margin: 0; }
    .pw-print-footer img { height: 1em; width: auto; }

    body.light-theme .pw-table tr.active {
        background-color: inherit !important;
        font-weight: normal !important;
    }

    .pw-table thead {
        background-color: rgba(0, 0, 0, 0.25) !important;
    }
}

@media (max-width: 640px) {
    .pw-table th, .pw-table td { padding: 8px 2px; font-size: 11px; }
    .pw-header h1 { font-size: 20px; }
    .pw-header h2 { font-size: 16px; }
    .pw-controls { flex-direction: column; align-items: stretch; }
}


.pw-hijri-controls {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 14px;
}
.hijri-correction-btn {
    padding: 2px 8px !important;
    font-weight: bold;
}
.hijri-correction-display {
    min-width: 60px;
    text-align: center;
    background-color: rgba(0,0,0,0.2);
    padding: 4px 6px;
    border-radius: 4px;
}
body.light-theme .hijri-correction-display {
    background-color: #f0f2f5;
}

.hijri-date-header {
    margin: 5px 0 0 0;
    font-size: 1rem;
    font-weight: normal;
    opacity: 0.8;
}

.pw-date-col .date-cell {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}
.pw-date-col .masehi-date {
    font-size: 1.1em;
    font-weight: bold;
}
.pw-date-col .hijri-date {
    font-size: 0.8em;
    opacity: 0.7;
}

.pw-notes-popup {
    position: absolute;
    bottom: 85px;
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    max-width: 320px;
    background-color: #333;
    color: #f0f0f0;
    padding: 15px;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.4);
    z-index: 30;
    transition: opacity 0.2s, visibility 0.2s;
}

.pw-notes-popup .notes-separator {
    margin-top: 1em;
}

.pw-notes-popup.hidden {
    display: none;
}

.pw-notes-popup::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    border-width: 10px;
    border-style: solid;
    border-color: #333 transparent transparent transparent;
}

.pw-notes-popup-close {
    position: absolute;
    top: 5px;
    right: 10px;
    font-size: 24px;
    cursor: pointer;
    color: #aaa;
}
.pw-notes-popup-close:hover {
    color: white;
}

.pw-notes-popup h5 {
    margin: 0 0 8px 0;
    font-size: 14px;
    color: white;
    border-bottom: 1px solid #555;
    padding-bottom: 5px;
}

.pw-notes-popup p {
    margin: 0;
    font-size: 12px;
    line-height: 1.5;
}

body.light-theme .pw-notes-popup {
    background-color: #f8f9fa;
    color: var(--color-text-dark);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}
body.light-theme .pw-notes-popup::after {
    border-top-color: #f8f9fa;
}
body.light-theme .pw-notes-popup-close {
    color: #888;
}
body.light-theme .pw-notes-popup-close:hover {
    color: #333;
}
body.light-theme .pw-notes-popup h5 {
    color: var(--color-text-dark);
    border-bottom-color: #ddd;
}


.pw-main-footer .pw-method-text {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.4em;
    line-height: 1.6;
}

.pw-main-footer select {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    
    background-color: rgba(0,0,0,0.2);
    color: var(--color-text);
    border: 1px solid var(--color-border);
    border-radius: 4px;
    padding: 2px 20px 2px 8px;
    font-family: inherit;
    font-size: 0.95em;
    font-weight: bold;
    cursor: pointer;

    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='white'%3e%3cpath d='M7 10l5 5 5-5H7z'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 4px center;
    background-size: 16px;
}

.pw-main-footer select option {
    background-color: #333;
    color: #fff;
}

body.light-theme .pw-main-footer select {
    background-color: #e9ecef;
    color: var(--color-text-dark);
    border-color: #ccc;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='black'%3e%3cpath d='M7 10l5 5 5-5H7z'/%3e%3c/svg%3e");
}

body.light-theme .pw-main-footer select option {
    background-color: #fff;
    color: #333;
}

body > .pw-alert-popup {
    position: fixed !important;
    top: 20px;
    right: 20px;
    z-index: 99999 !important;
    width: auto;
    background: linear-gradient(135deg, var(--color-primary), var(--color-primary-dark));
    color: var(--color-text);
    padding: 20px;
    padding-bottom: 25px;
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    font-family: 'Plus Jakarta Sans', sans-serif;
    animation: fadeIn 0.5s ease-out;
}

.pw-alert-popup.fade-out {
    animation: fadeOut 0.5s ease-in forwards;
}

.pw-alert-prayer {
    font-size: 28px;
    font-weight: 700;
}

.pw-alert-info {
    font-size: 14px;
    opacity: 0.8;
    margin-top: 4px;
}

.pw-alert-close {
    position: absolute;
    top: 5px;
    right: 10px;
    font-size: 24px;
    color: rgba(255,255,255,0.7);
    cursor: pointer;
    line-height: 1;
}
.pw-alert-close:hover {
    color: white;
}

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

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


.pw-alert-popup {
    padding-bottom: 25px; 
}

.pw-alert-progress-container {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 5px;
    background-color: rgba(0, 0, 0, 0.2);
}

.pw-alert-progress-bar {
    height: 100%;
    width: 100%;
    background-color: var(--color-text);
    animation: countdownBar 30s linear forwards;
}

@keyframes countdownBar {
    from {
        width: 100%;
    }
    to {
        width: 0%;
    }
}

.pw-alert-change-city {
    background-color: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.4);
    color: white;
    padding: 6px 12px;
    border-radius: 20px;
    margin-top: 15px;
    cursor: pointer;
    font-size: 12px;
    transition: background-color 0.2s;
}
.pw-alert-change-city:hover {
    background-color: rgba(255, 255, 255, 0.25);
}

.pw-city-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.85);
    z-index: 10000;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px;
    box-sizing: border-box;
    color: white;
    font-family: 'Plus Jakarta Sans', sans-serif;
    animation: fadeInOverlay 0.3s ease;
}
.pw-city-overlay.hidden {
    display: none;
}
.pw-city-overlay h4 {
    margin: 0 0 20px 0;
    font-weight: 500;
}

.pw-city-list {
    width: 100%;
    max-width: 400px;
    overflow-y: auto;
    background-color: rgba(255,255,255,0.1);
    border-radius: 8px;
    padding: 10px;
}
.pw-city-list button {
    display: block;
    width: 100%;
    background: none;
    border: none;
    color: white;
    padding: 12px 15px;
    text-align: left;
    font-size: 16px;
    cursor: pointer;
    border-radius: 4px;
    transition: background-color 0.2s;
}
.pw-city-list button:hover {
    background-color: rgba(255,255,255,0.15);
}

.pw-city-overlay-close {
    margin-top: 20px;
    cursor: pointer;
    opacity: 0.7;
    font-size: 14px;
}
.pw-city-overlay-close:hover {
    opacity: 1;
}

@keyframes fadeInOverlay {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* --- POPUP DAFTAR ID KOTA --- */
.pw-id-list-popup {
    position: absolute;
    bottom: 85px;
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    max-width: 400px;
    height: 60%;
    max-height: 400px;
    background-color: #333;
    color: #f0f0f0;
    padding: 15px;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.4);
    z-index: 30;
    display: flex;
    flex-direction: column;
}

.pw-id-list-popup.hidden {
    display: none;
}

.pw-id-list-popup-close {
    position: absolute;
    top: 5px;
    right: 10px;
    font-size: 24px;
    cursor: pointer;
    color: #aaa;
}
.pw-id-list-popup-close:hover {
    color: white;
}

.pw-id-list-popup h5 {
    margin: 0 0 10px 0;
    font-size: 14px;
    color: white;
    border-bottom: 1px solid #555;
    padding-bottom: 8px;
    text-align: center;
}

.pw-id-list-container {
    flex-grow: 1;
    overflow-y: auto;
    padding-right: 10px;
}

.pw-id-list-item {
    display: flex;
    justify-content: space-between;
    padding: 8px 5px;
    border-bottom: 1px solid #444;
    font-size: 14px;
}
.pw-id-list-item:last-child {
    border-bottom: none;
}

.pw-id-list-name {
    color: white;
}

.pw-id-list-code {
    font-weight: bold;
    color: #f7b731;
}

body.light-theme .pw-id-list-popup {
    background-color: #f8f9fa;
    color: var(--color-text-dark);
}
body.light-theme .pw-id-list-popup-close {
    color: #888;
}
body.light-theme .pw-id-list-popup-close:hover {
    color: #333;
}
body.light-theme .pw-id-list-popup h5 {
    color: var(--color-text-dark);
    border-bottom-color: #ddd;
}
body.light-theme .pw-id-list-container {
    padding-right: 0;
}
body.light-theme .pw-id-list-item {
    border-bottom-color: #eee;
}
body.light-theme .pw-id-list-name {
    color: var(--color-text-dark);
}
body.light-theme .pw-id-list-code {
    color: var(--color-primary);
}