/**
 * App-wide responsive base – include first so page CSS can override.
 * Ensures no horizontal overflow and safe areas on notched phones (iOS/Android).
 */

html {
    overflow-x: hidden;
    max-width: 100vw;
    -webkit-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

body {
    overflow-x: hidden;
    max-width: 100vw;
    margin: 0;
    width: 100%;
    position: relative;
}

/* Safe area padding for notched devices (iOS/Android) */
:root {
    --safe-area-inset-left: env(safe-area-inset-left, 0px);
    --safe-area-inset-right: env(safe-area-inset-right, 0px);
    --safe-area-inset-top: env(safe-area-inset-top, 0px);
    --safe-area-inset-bottom: env(safe-area-inset-bottom, 0px);
}

/* Apply to main page containers for notch-safe padding */
.safe-area-padding {
    padding-left: max(12px, var(--safe-area-inset-left));
    padding-right: max(12px, var(--safe-area-inset-right));
    padding-top: max(0px, var(--safe-area-inset-top));
    padding-bottom: max(0px, var(--safe-area-inset-bottom));
}

/* Prevent flex/grid children from overflowing */
.responsive-container,
[class$="-container"] {
    max-width: 100vw;
    min-width: 0;
}

@media (max-width: 360px) {
    html {
        font-size: 15px;
    }
}

@media (max-width: 320px) {
    html {
        font-size: 14px;
    }
}

/* App-wide popup – same style as Login Successful */
.app-popup {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}
.app-popup.is-visible {
    opacity: 1;
    visibility: visible;
}
.app-popup-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}
.app-popup-card {
    position: relative;
    background: #fff;
    border-radius: 20px;
    padding: 32px 40px;
    text-align: center;
    max-width: 320px;
    width: 100%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    transform: scale(0.9);
    transition: transform 0.3s ease;
}
.app-popup.is-visible .app-popup-card {
    transform: scale(1);
}
.app-popup-icon-wrap {
    width: 64px;
    height: 64px;
    margin: 0 auto 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    color: #fff;
}
.app-popup-icon-wrap i {
    font-size: 36px;
}
.app-popup-icon-wrap.success {
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
}
.app-popup-icon-wrap.error {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
}
.app-popup-icon-wrap.info {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
}
.app-popup-title {
    font-size: 22px;
    font-weight: 700;
    color: #333;
    margin: 0 0 8px;
}
.app-popup-message {
    font-size: 14px;
    color: #666;
    margin: 0 0 24px;
    line-height: 1.4;
}
.app-popup-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}
.app-popup-btn {
    min-width: 100px;
    padding: 12px 24px;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s, transform 0.1s;
    -webkit-tap-highlight-color: transparent;
}
.app-popup-btn:active {
    transform: scale(0.98);
}
.app-popup-btn-primary {
    background: linear-gradient(135deg, #DC143C 0%, #8B0000 100%);
    color: #fff;
}
.app-popup-btn-primary:hover {
    opacity: 0.95;
}
.app-popup-btn-secondary {
    background: #e5e7eb;
    color: #374151;
}
.app-popup-btn-secondary:hover {
    background: #d1d5db;
}
