@import url("https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700;800;900&display=swap");
@import url("https://fonts.googleapis.com/css2?family=Lato:wght@400;700&family=Montserrat:wght@400;700&family=Nunito+Sans:wght@400;700&display=swap");
@import url("https://fonts.googleapis.com/css2?family=Amiri:wght@400;700&display=swap");

/* Overlay Layers System for Unified Main.php */

.overlay-layer {
    position: fixed;
    top: -2px;
    left: -2px;
    width: calc(100vw + 4px);
    height: calc(100vh + 4px);
    background: #000;
    z-index: 99999;
    /* Anti-bleeding properties */
    transform: scale(1.01);
    transform-origin: center;
    box-sizing: border-box;
    border: none;
    outline: none;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.5s ease-in-out, visibility 0.5s ease-in-out;

    /* Browser-specific viewport fixes */
    min-width: 100vw;
    min-height: 100vh;
    min-width: 100dvw; /* Dynamic viewport width for modern browsers */
    min-height: 100dvh; /* Dynamic viewport height for modern browsers */
    
    /* Additional anti-bleeding techniques */
    margin: 0;
    padding: 0;
    border-radius: 0;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    will-change: transform;
}

.overlay-layer.active {
    opacity: 1;
    visibility: visible;
}

/* Adzan Overlay Styles */
#adzanOverlay {
    background: linear-gradient(135deg, #065f46 0%, #047857 50%, #059669 100%);
    font-family: "Lato", "Nunito Sans", "Montserrat";
    overflow: hidden;
    color: white;
}

#adzanOverlay .bg-decoration {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    z-index: 1;
}

#adzanOverlay .adzan-container {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    color: white;
}

#adzanOverlay .adzan-title {
    font-size: 4cqw;
    font-weight: 300;
    margin-top: 3cqh;
    margin-bottom: -5cqh;
    opacity: 0.9;
    letter-spacing: 0.3cqh;
    text-transform: uppercase;
    animation: titleGlow 3s ease-in-out infinite;
    font-family: "Nunito Sans", "Montserrat";
}

#adzanOverlay .prayer-name {
    font-size: 15cqw;
    font-weight: 1000;
    height: auto;
    color: #fbbf24;
    text-shadow: 0 0 3cqh rgba(251, 191, 36, 0.6);
    margin: 0px 0;
    text-transform: uppercase;
    letter-spacing: 1cqw;
    font-family: "Poppins", "Lato", "Nunito Sans", "Montserrat";
}

#adzanOverlay .arabic-message {
    font-size: 3.0cqw;
    font-weight: 400;
    margin: 20px 0 20px 0;
    color: #fbbf24;
    font-family: "Amiri", serif;
    direction: rtl;
    text-shadow: 0 0 15px rgba(209, 250, 229, 0.3);
}

#adzanOverlay .indonesian-message {
    font-size: 1.0rem;
    font-weight: 300;
    color: #d1fae5;
    opacity: 0.9;
    margin-top: -30px;
    margin-bottom: 40px;
}

#adzanOverlay .progress-container {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 10cqh;
    background: rgba(0, 0, 0, 0.3);
    z-index: 20;
}

#adzanOverlay .progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #fbbf24 0%, #f59e0b 50%, #d97706 100%);
    width: 0%;
    transition: width 1s linear;
    position: relative;
    overflow: hidden;
}

#adzanOverlay .progress-bar::before {
    content: "";
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    animation: shimmer 2s infinite;
}

#adzanOverlay .progress-text {
    position: fixed;
    bottom: 0.2cqh;
    left: 50%;
    transform: translateX(-50%);
    font-size: 8cqh;
    font-weight: 900;
    font-family: "Liberation Mono", "Ubuntu Sans Mono", "Courier New", "Roboto Mono", monospace;
    color: #d1fae5;
    z-index: 21;
}

/* Iqomah Overlay Styles */
#iqomahOverlay {
    background: #9a3412;
    font-family: 'Poppins', sans-serif;
}

#iqomahOverlay .bg-decoration {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    z-index: 1;
}

#iqomahOverlay .iqomah-container {
    text-align: center;
    z-index: 10;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 2cqh;
}

#iqomahOverlay .iqomah-title {
    font-size: 3cqw;
    font-weight: 900;
    margin-top: -23cqh;
    margin-bottom: 0px;
    opacity: 0.9;
    letter-spacing: 0.3cqw;
    text-transform: uppercase;
    font-family: "Montserrat";
}

#iqomahOverlay .prayer-info {
    font-family: 'Lato', 'Poppins', Roboto, Helvetica, sans-serif;
    font-size: 10cqw;
    font-weight: 500;
    color: #fed7aa;
    margin-top: -4.0cqh;
    margin-bottom: 0.0cqh;
    opacity: 1;
    letter-spacing: 0.1em;
    text-transform: uppercase;

}

#iqomahOverlay .countdown-capsule {
    background: #fdba74;
    border-radius: 2cqw;
    padding: 0.5cqw 0.8cqw;
    margin: 1cqh 0;
    box-shadow: 
        0 0 2cqw rgba(251, 146, 60, 0.3),
        inset 0 0 10px rgba(255, 255, 255, 0.05);
    position: relative;
    overflow: hidden;
    min-width: 40cqw;
    height: auto;
}

#iqomahOverlay .countdown-time {
    font-size: 18cqw;
    font-weight: 700;
    color: #7c2d12;
    margin-top: -0px;
    font-family: 'Roboto Mono', 'Courier New', monospace;
    letter-spacing: 2px;
    position: relative;
    z-index: 2;
}

#iqomahOverlay .nasihat-container {
    width: auto;
    position: absolute;
    max-width: 90%;
    bottom: 10cqh;
    background: rgba(0, 0, 0, 0.4);
    border-radius: 5cqh;
    padding: 2cqh;
    backdrop-filter: blur(10px);
    border: 2px solid rgba(254, 215, 170, 0.3);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

#iqomahOverlay .nasihat-item {
    font-size: 2.8cqw;
    font-family: 'Poppins', 'Noto Sans Regular', 'Roboto Regular', 'open sans', arial, helvetica, geneva, sans-serif;
    font-weight: 600;
    color: #fecaca;
    line-height: 1.1;
    text-align: center;
    padding: 1cqh 4cqw;
    opacity: 0;
    transform: translateY(30px);
    animation: slideInUp 0.5s ease-out forwards;
}

#iqomahOverlay .nasihat-item.active {
    opacity: 1;
    transform: translateY(0);
}

/* Urgent mode for last 30 seconds */
#iqomahOverlay.urgent-mode .countdown-capsule {
    background: #ef4444;
}

#iqomahOverlay.urgent-mode .countdown-time {
    color: #7c2d12;
}

#iqomahOverlay.beep-mode .countdown-capsule {
    animation: urgentPulse 1s ease-in-out infinite;
}

@keyframes urgentPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.02); }
}

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

/* Blank/Sholat Overlay Styles */
#blankOverlay {
    background: #000;
    color: white;
}

#blankOverlay.dawn-mode {
    background: linear-gradient(to bottom, #1a202c, #2d3748, #1a202c);
}

#blankOverlay.midnight-mode {
    background: linear-gradient(to bottom, #0f0f0f, #1a1a1a, #0f0f0f);
}

#blankOverlay.transition-mode {
    background: linear-gradient(45deg, #7c2d12, #dc2626, #7c2d12);
    background-size: 400% 400%;
    animation: gradientShift 3s ease-in-out infinite;
}




#blankOverlay .clock-container {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
}

#blankOverlay .clock-time {
    font-family: 'Courier New', 'Roboto Mono', monospace;
    font-size: 20cqw;
    font-weight: 500;
    color: #666666;
    letter-spacing: 0px;
    text-shadow: 0 0 20px rgba(255, 255, 255, 0.3);
}

#blankOverlay .clock-date {
    font-size: 2cqw;
    font-family: 'Montserrat', 'Poppins', 'Open Sans', 'Helvetica', 'Roboto Sans';
    font-weight: 900;
    color: #4c434f;
    opacity: 0.8;
    letter-spacing: 2px;
    margin-top: 2cqh;
    margin-bottom: 0px;
}

#blankOverlay .prayer-status {
    position: absolute;
    top: 15cqh;
    left: 48%;
    transform: translateX(-50%);
    font-size: 4cqw;
    font-family: 'Poppins', 'Open Sans', 'Helvetica', 'Roboto Sans';
    font-weight: 500;
    color: #4b5563;
    opacity: 0.7;
    z-index: 20;
    text-align: center;
}

#blankOverlay .prayer-status .prayer-name {
    color: #666666;
    font-weight: 900;
    font-family: 'Montserrat', 'Poppins', 'Open Sans', 'Helvetica', 'Roboto Sans';
    letter-spacing: 3cqw;
    text-transform: capitalize;
    font-size: 4cqw;
}

#blankOverlay .progress-indicator {
    position: fixed;
    bottom: 3cqh;
    left: 50%;
    transform: translateX(-50%);
    z-index: 20;
    text-align: center;
}

#blankOverlay .progress-dots {
    display: flex;
    gap: 1cqw;
    align-items: center;
    justify-content: center;
    margin-bottom: 1cqh;
}

#blankOverlay .progress-dot {
    width: 1.5cqw;
    height: 1.5cqw;
    border-radius: 50%;
    background: #374151;
    transition: all 0.3s ease;
}

#blankOverlay .progress-dot.active {
    background: #6b7280;
    transform: scale(1.2);
}

#blankOverlay .progress-text {
    font-size: 2cqw;
    color: #4b5563;
    text-align: center;
    opacity: 0.6;
    font-family: 'Roboto Mono', monospace;
    font-weight: bold;
}

/* Animations */
@keyframes gradientShift {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

@keyframes float {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-20px); }
}

/* Responsive Design */
@media (max-width: 768px) {
    #adzanOverlay .prayer-name { font-size: 12cqw; }
    #adzanOverlay .adzan-title { font-size: 3cqw; }
    #iqomahOverlay .prayer-info { font-size: 8cqw; }
    #iqomahOverlay .countdown-time { font-size: 15cqw; }
    #blankOverlay .clock-time { font-size: 20cqw; }
}

@keyframes shimmer {
    0% { left: -100%; }
    100% { left: 100%; }
}

@keyframes titleGlow {
    0%, 100% { 
        text-shadow: 2px 2px 4px rgba(0,0,0,0.5); 
    }
    50% { 
        text-shadow: 2px 2px 4px rgba(0,0,0,0.5), 0 0 20px rgba(255,255,255,0.3); 
    }
}

/* Body modifications when overlay is active */
body.overlay-active {
    overflow: hidden;
    position: fixed;
    width: 100%;
    height: 100%;
}

/* Additional safeguards for specific browser quirks */
@supports (width: 100dvw) {
    .overlay-layer {
        width: 100dvw !important;
        height: 100dvh !important;
    }
}

/* Fallback for older browsers */
@media screen and (-webkit-min-device-pixel-ratio: 0) {
    .overlay-layer {
        width: calc(100vw + 5px) !important;
        height: calc(100vh + 5px) !important;
    }
}

/* Firefox-specific fix */
@-moz-document url-prefix() {
    .overlay-layer {
        width: calc(100vw + 3px) !important;
        height: calc(100vh + 3px) !important;
    }
}

