/* Reset */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html, body {
    font-family: 'Inter', sans-serif;
    color: white;
    width: 100vw;
    height: 100%;
    min-height: 100vh;
    min-height: -webkit-fill-available; /* For iOS */
    overscroll-behavior: none;
    overflow: hidden;
    position: fixed;
    touch-action: none;
}

/* Background Image */
.background-image {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-image: url('https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjMYFz2ijD5KLoSGypDPEWIa9xp4_U3sqyszzqM1l1l4xzcQVkArXAYK6tl1kRXczBE2y0Haq8ublfdcJeXd9mMWplnGw9dpXcgzYFW30bSF9VzJ2kWfaXkQKp-7_5vbfhc-SW-7UhvVf66Zgwn0z490XoKCdWKknqReXx_Q1ES4pyM4vn6nfWQH4s-QzA/s928/Screenshot_20251222-203904%20(1).png');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    z-index: 1;
}

/* Content Overlay */
.content-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: linear-gradient(
        to bottom,
        rgba(0, 0, 0, 0.85) 0%,
        rgba(0, 0, 0, 0.65) 30%,
        rgba(0, 0, 0, 0.6) 70%,
        rgba(0, 0, 0, 0.85) 100%
    );
    z-index: 2;
}

/* App Container - FIXED SAFE AREA */
.app-container {
    position: relative;
    z-index: 3;
    width: 100vw;
    height: 100vh;
    height: 100dvh; /* Dynamic viewport height */
    display: flex;
    flex-direction: column;
    /* Safe area handling */
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
    /* Ensure content doesn't overflow */
    overflow: hidden;
}

/* App Header - ADJUSTED FOR SAFE AREA */
.app-header {
    padding: 20px 20px 15px 20px;
    text-align: center;
    /* Use safe-area-inset-top for iOS notch */
    padding-top: calc(20px + env(safe-area-inset-top, 0px));
}

.app-title {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 8px;
    color: white;
    text-shadow: 
        0 2px 4px rgba(0, 0, 0, 0.8),
        0 4px 8px rgba(0, 0, 0, 0.6),
        0 6px 12px rgba(0, 0, 0, 0.4);
    letter-spacing: 0.5px;
}

.app-subtitle {
    font-size: 1.2rem;
    font-family: 'Noto Sans Bengali', sans-serif;
    color: rgba(255, 255, 255, 0.95);
    text-shadow: 
        0 1px 3px rgba(0, 0, 0, 0.8),
        0 2px 6px rgba(0, 0, 0, 0.6);
    font-weight: 500;
}

/* Main Content - FIXED SCROLLING */
.main-content {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    padding-bottom: calc(20px + env(safe-area-inset-bottom, 0px));
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

/* Buttons Container */
.buttons-container {
    width: 100%;
    max-width: 500px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-bottom: env(safe-area-inset-bottom, 0px);
}

/* Site Button */
.site-button {
    background: rgba(255, 255, 255, 0.12);
    backdrop-filter: blur(15px);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 20px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    width: 100%;
    text-align: left;
    position: relative;
    overflow: hidden;
    min-height: 85px;
}

.site-button:active {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
    box-shadow: 
        0 10px 30px rgba(0, 0, 0, 0.4),
        0 15px 40px rgba(0, 0, 0, 0.3);
}

.site-button::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(255,255,255,0.15) 0%, rgba(255,255,255,0) 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.site-button:active::before {
    opacity: 1;
}

.button-icon {
    font-size: 2.8rem;
    width: 70px;
    height: 70px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 16px;
    flex-shrink: 0;
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.button-text {
    flex: 1;
}

.button-title {
    font-size: 1.6rem;
    font-weight: 600;
    margin-bottom: 6px;
    color: white;
    text-shadow: 
        0 2px 4px rgba(0, 0, 0, 0.8),
        0 3px 6px rgba(0, 0, 0, 0.6);
    letter-spacing: 0.3px;
}

.button-subtitle {
    font-size: 1rem;
    color: rgba(255, 255, 255, 0.9);
    text-shadow: 
        0 1px 3px rgba(0, 0, 0, 0.8),
        0 2px 4px rgba(0, 0, 0, 0.6);
    font-weight: 400;
}

/* Bangla Font */
.bangla-font {
    font-family: 'Noto Sans Bengali', sans-serif;
    font-weight: 600;
}

/* Footer - ADJUSTED FOR SAFE AREA */
.app-footer {
    padding: 20px;
    text-align: center;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(0, 0, 0, 0.25);
    backdrop-filter: blur(15px);
    padding-bottom: calc(25px + env(safe-area-inset-bottom, 0px));
}

.footer-text {
    font-size: 1rem;
    color: rgba(255, 255, 255, 0.9);
    text-shadow: 
        0 1px 3px rgba(0, 0, 0, 0.8),
        0 2px 4px rgba(0, 0, 0, 0.6);
}

.highlight {
    color: #4FC3F7;
    font-weight: 600;
    text-shadow: 
        0 1px 3px rgba(0, 0, 0, 0.8),
        0 2px 4px rgba(0, 0, 0, 0.6);
}

/* WebView Modal - FIXED FULLSCREEN */
.webview-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    background: white;
    z-index: 1000;
    display: none;
    overflow: hidden;
    /* Safe area for modal */
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
    box-sizing: border-box;
}

.webview-modal.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

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

/* Site Frame - FIXED FOR SAFE AREAS */
.site-frame {
    position: absolute;
    top: env(safe-area-inset-top, 0px);
    left: env(safe-area-inset-left, 0px);
    right: env(safe-area-inset-right, 0px);
    bottom: env(safe-area-inset-bottom, 0px);
    width: calc(100vw - env(safe-area-inset-left, 0px) - env(safe-area-inset-right, 0px));
    height: calc(100vh - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
    height: calc(100dvh - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
    border: none;
    display: block;
    background: white;
    overflow: auto !important;
    -webkit-overflow-scrolling: touch;
}

/* Hide scrollbars but keep functionality */
.site-frame::-webkit-scrollbar {
    display: none;
}

.site-frame {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

/* Responsive */
@media (max-width: 600px) {
    .app-title {
        font-size: 2rem;
    }
    
    .app-subtitle {
        font-size: 1rem;
    }
    
    .site-button {
        padding: 20px;
        gap: 16px;
        min-height: 75px;
    }
    
    .button-icon {
        width: 60px;
        height: 60px;
        font-size: 2.2rem;
    }
    
    .button-title {
        font-size: 1.4rem;
    }
    
    .button-subtitle {
        font-size: 0.9rem;
    }
}

/* iOS specific fixes */
@supports (-webkit-touch-callout: none) {
    html, body {
        height: -webkit-fill-available;
    }
    
    .app-container {
        height: -webkit-fill-available;
        min-height: -webkit-fill-available;
    }
    
    .webview-modal {
        height: -webkit-fill-available;
    }
    
    .site-frame {
        height: calc(-webkit-fill-available - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
    }
}

/* Prevent text selection */
button, .app-title, .app-subtitle, .button-title, .button-subtitle {
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

/* Improve font rendering */
.app-title, .app-subtitle, .button-title, .button-subtitle, .footer-text {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

/* Handle notch and punch-hole displays */
@supports (padding: max(0px)) {
    .app-header {
        padding-top: max(20px, env(safe-area-inset-top, 20px));
    }
    
    .main-content {
        padding-bottom: max(20px, env(safe-area-inset-bottom, 20px));
    }
    
    .app-footer {
        padding-bottom: max(25px, env(safe-area-inset-bottom, 25px));
    }
}

/* Force portrait orientation */
@media (orientation: landscape) and (max-width: 768px) {
    html, body, .app-container, .webview-modal {
        height: 100vh !important;
        width: 100vw !important;
        overflow: hidden !important;
    }
    
    .site-frame {
        height: calc(100vh - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px)) !important;
        width: calc(100vw - env(safe-area-inset-left, 0px) - env(safe-area-inset-right, 0px)) !important;
    }
}