/**
 * Age Verification Modal Styling
 * Professional and responsive design for age verification popup
 */

/* =====================================================
   AGE VERIFICATION MODAL STYLES
   ===================================================== */

/* Overlay Container */
#ageVerificationOverlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.7);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    z-index: 9998;
    display: flex;
    align-items: center;
    justify-content: center;
    /* Blur effect for modern browsers */
    -webkit-backdrop-filter: blur(5px);
    backdrop-filter: blur(5px);
}

#ageVerificationOverlay.active {
    opacity: 1;
    visibility: visible;
}

/* Modal Container - CRITICAL iOS Fix */
#ageVerificationModal {
    position: fixed !important;
    top: 50% !important;
    left: 50% !important;
    -webkit-transform: translate(-50%, -50%) scale(0.8);
    transform: translate(-50%, -50%) scale(0.8);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 9999;
    width: 90vw !important;
    max-width: 500px !important;
    max-height: 90vh !important;
    -webkit-box-sizing: border-box;
    box-sizing: border-box !important;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

#ageVerificationModal.active {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, -50%) scale(1);
}

/* Modal Box Styling */
.age-verification-box {
    background: linear-gradient(135deg, #2c2c2c 0%, #1a1a1a 100%);
    border-radius: 12px;
    padding: 40px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    border: 2px solid #ff6b35;
    position: relative;
    overflow: hidden;
}

/* Background pattern effect */
.age-verification-box::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(255, 107, 53, 0.1) 0%, transparent 70%);
    border-radius: 50%;
    pointer-events: none;
}

.age-verification-box > * {
    position: relative;
    z-index: 1;
}

/* Heading "18+" */
.age-verification-heading {
    text-align: center;
    margin-bottom: 25px;
}

.age-badge {
    display: inline-block;
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, #ff6b35 0%, #ff8a50 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 48px;
    font-weight: bold;
    color: #fff;
    box-shadow: 0 10px 30px rgba(255, 107, 53, 0.4);
    margin: 0 auto 20px;
    position: relative;
}

.age-badge::after {
    content: '';
    position: absolute;
    top: -5px;
    right: -5px;
    width: 20px;
    height: 20px;
    background: #ffc107;
    border-radius: 50%;
    box-shadow: 0 0 15px rgba(255, 193, 7, 0.5);
}

.age-verification-title {
    font-size: 24px;
    color: #fff;
    margin-bottom: 15px;
    font-weight: bold;
    text-align: center;
}

/* Warning Text */
.age-verification-warning {
    background-color: rgba(255, 107, 53, 0.1);
    border-left: 4px solid #ff6b35;
    padding: 15px;
    margin: 20px 0;
    border-radius: 4px;
}

.age-verification-warning p {
    color: #e5e5e5;
    margin: 0;
    font-size: 14px;
    line-height: 1.5;
}

.age-verification-warning strong {
    color: #ff6b35;
}

/* Confirmation Text */
.age-verification-text {
    color: #ccc;
    text-align: center;
    font-size: 14px;
    line-height: 1.6;
    margin: 20px 0;
}

.age-verification-text strong {
    color: #ff6b35;
    display: block;
    margin-bottom: 10px;
}

/* Button Container */
.age-verification-buttons {
    display: flex;
    gap: 12px;
    margin-top: 30px;
}

.age-verification-buttons button {
    flex: 1;
    padding: 12px 20px;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Confirm Button (Green) */
#confirmAgeBtn {
    background: linear-gradient(135deg, #4caf50 0%, #45a049 100%);
    color: white;
    box-shadow: 0 5px 15px rgba(76, 175, 80, 0.3);
}

#confirmAgeBtn:hover {
    background: linear-gradient(135deg, #45a049 0%, #3d8b40 100%);
    box-shadow: 0 8px 20px rgba(76, 175, 80, 0.5);
    transform: translateY(-2px);
}

#confirmAgeBtn:active {
    transform: translateY(0);
}

/* Decline Button (Red) */
#declineAgeBtn {
    background: linear-gradient(135deg, #f44336 0%, #da190b 100%);
    color: white;
    box-shadow: 0 5px 15px rgba(244, 67, 54, 0.3);
}

#declineAgeBtn:hover {
    background: linear-gradient(135deg, #da190b 0%, #c4190b 100%);
    box-shadow: 0 8px 20px rgba(244, 67, 54, 0.5);
    transform: translateY(-2px);
}

#declineAgeBtn:active {
    transform: translateY(0);
}

/* =====================================================
   RESPONSIVE DESIGN - MOBILE OPTIMIZATION
   ===================================================== */

/* iOS & Mobile-First Fixes - Use viewport-relative units */
@media (max-width: 767px) {
    html {
        -webkit-text-size-adjust: 100%;
        -ms-text-size-adjust: 100%;
    }

    body {
        -webkit-text-size-adjust: 100%;
    }

    #ageVerificationModal {
        width: 90vw !important;
        max-width: 90vw !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch !important;
    }

    .age-verification-box {
        -webkit-box-sizing: border-box;
        box-sizing: border-box !important;
    }
}

/* Ultra-small devices (320px - 375px) */
@media (max-width: 375px) {
    #ageVerificationModal {
        width: 94vw !important;
        max-width: 94vw !important;
        max-height: 90vh !important;
    }

    .age-verification-box {
        padding: 25px 20px;
        border-radius: 10px;
        margin: 10px;
    }

    .age-verification-box::before {
        width: 300px;
        height: 300px;
        top: -30%;
        right: -30%;
    }

    /* 18+ Badge - Scaled up for better visibility */
    .age-badge {
        width: 70px;
        height: 70px;
        font-size: 42px;
        margin: 0 auto 18px;
        box-shadow: 0 7px 22px rgba(255, 107, 53, 0.35);
    }

    .age-badge::after {
        width: 18px;
        height: 18px;
        top: -4px;
        right: -4px;
    }

    /* Title */
    .age-verification-heading {
        margin-bottom: 18px;
    }

    .age-verification-title {
        font-size: 19px;
        margin-bottom: 12px;
        word-wrap: break-word;
    }

    /* Warning box */
    .age-verification-warning {
        padding: 13px;
        margin: 16px 0;
        border-left-width: 3px;
        border-radius: 3px;
    }

    .age-verification-warning p {
        font-size: 13px;
        line-height: 1.5;
    }

    /* Main text */
    .age-verification-text {
        font-size: 13px;
        line-height: 1.6;
        margin: 16px 0;
    }

    .age-verification-text strong {
        margin-bottom: 9px;
        font-size: 14px;
    }

    /* Buttons - Vertical stack with better touch targets */
    .age-verification-buttons {
        flex-direction: column;
        gap: 10px;
        margin-top: 22px;
    }

    .age-verification-buttons button {
        padding: 15px 18px;
        font-size: 14px;
        min-height: 46px;
        border-radius: 5px;
        letter-spacing: 0.3px;
        font-weight: 600;
    }
}

/* Small devices (375px - 480px) */
@media (min-width: 376px) and (max-width: 480px) {
    #ageVerificationModal {
        width: 92vw !important;
        max-width: 92vw !important;
        max-height: 90vh !important;
    }

    .age-verification-box {
        padding: 28px 22px;
        border-radius: 10px;
        margin: 10px;
    }

    .age-verification-box::before {
        width: 350px;
        height: 350px;
        top: -40%;
        right: -40%;
    }

    /* 18+ Badge */
    .age-badge {
        width: 75px;
        height: 75px;
        font-size: 45px;
        margin: 0 auto 18px;
        box-shadow: 0 8px 25px rgba(255, 107, 53, 0.4);
    }

    .age-badge::after {
        width: 19px;
        height: 19px;
        top: -4px;
        right: -4px;
    }

    /* Heading */
    .age-verification-heading {
        margin-bottom: 20px;
    }

    .age-verification-title {
        font-size: 21px;
        margin-bottom: 13px;
    }

    /* Warning box */
    .age-verification-warning {
        padding: 14px;
        margin: 18px 0;
        border-left-width: 3px;
    }

    .age-verification-warning p {
        font-size: 14px;
        line-height: 1.6;
    }

    /* Main text */
    .age-verification-text {
        font-size: 14px;
        line-height: 1.7;
        margin: 18px 0;
    }

    .age-verification-text strong {
        font-size: 15px;
        margin-bottom: 9px;
    }

    /* Buttons */
    .age-verification-buttons {
        flex-direction: column;
        gap: 11px;
        margin-top: 24px;
    }

    .age-verification-buttons button {
        padding: 16px 20px;
        font-size: 15px;
        min-height: 47px;
        border-radius: 5px;
    }
}

/* Medium devices (481px - 768px) */
@media (min-width: 481px) and (max-width: 768px) {
    #ageVerificationModal {
        width: 90vw !important;
        max-width: 90vw !important;
        max-height: 90vh !important;
    }

    .age-verification-box {
        padding: 38px 32px;
        border-radius: 11px;
    }

    .age-verification-box::before {
        width: 450px;
        height: 450px;
        top: -45%;
        right: -45%;
    }

    /* 18+ Badge */
    .age-badge {
        width: 80px;
        height: 80px;
        font-size: 48px;
        margin: 0 auto 20px;
        box-shadow: 0 10px 30px rgba(255, 107, 53, 0.4);
    }

    .age-badge::after {
        width: 20px;
        height: 20px;
        top: -4px;
        right: -4px;
    }

    /* Heading */
    .age-verification-heading {
        margin-bottom: 22px;
    }

    .age-verification-title {
        font-size: 23px;
        margin-bottom: 14px;
    }

    /* Warning box */
    .age-verification-warning {
        padding: 16px;
        margin: 21px 0;
        border-left-width: 4px;
    }

    .age-verification-warning p {
        font-size: 15px;
        line-height: 1.7;
    }

    /* Main text */
    .age-verification-text {
        font-size: 15px;
        line-height: 1.8;
        margin: 21px 0;
    }

    /* Buttons - Horizontal or vertical depending on space */
    .age-verification-buttons {
        flex-direction: column;
        gap: 13px;
        margin-top: 27px;
    }

    @media (orientation: landscape) {
        .age-verification-buttons {
            flex-direction: row;
            gap: 13px;
        }

        .age-verification-buttons button {
            flex: 1;
        }
    }

    .age-verification-buttons button {
        padding: 14px 22px;
        font-size: 16px;
        min-height: 46px;
        border-radius: 6px;
    }
}

/* Tablets and above (769px+) */
@media (min-width: 769px) {
    #ageVerificationModal {
        width: 90vw !important;
        max-width: 500px !important;
    }

    .age-verification-box {
        padding: 40px;
    }

    .age-verification-buttons {
        flex-direction: row;
        gap: 12px;
    }

    .age-verification-buttons button {
        flex: 1;
        min-height: 44px;
    }
}

/* =====================================================
   TOUCH DEVICE OPTIMIZATIONS
   ===================================================== */

/* Remove hover effects on touch devices and replace with active states */
@media (hover: none) {
    #confirmAgeBtn:hover {
        background: linear-gradient(135deg, #4caf50 0%, #45a049 100%);
        box-shadow: 0 5px 15px rgba(76, 175, 80, 0.3);
        transform: none;
    }

    #declineAgeBtn:hover {
        background: linear-gradient(135deg, #f44336 0%, #da190b 100%);
        box-shadow: 0 5px 15px rgba(244, 67, 54, 0.3);
        transform: none;
    }

    /* Active state for touch */
    #confirmAgeBtn:active {
        background: linear-gradient(135deg, #45a049 0%, #3d8b40 100%);
        box-shadow: 0 3px 10px rgba(76, 175, 80, 0.3);
        transform: scale(0.98);
    }

    #declineAgeBtn:active {
        background: linear-gradient(135deg, #da190b 0%, #c4190b 100%);
        box-shadow: 0 3px 10px rgba(244, 67, 54, 0.3);
        transform: scale(0.98);
    }
}

/* =====================================================
   LANDSCAPE ORIENTATION OPTIMIZATION
   ===================================================== */

@media (orientation: landscape) and (max-height: 600px) {
    #ageVerificationModal {
        top: 50%;
        transform: translate(-50%, -50%) scale(1);
    }

    .age-verification-box {
        padding: 20px 25px;
        max-height: 90vh;
        overflow-y: auto;
    }

    .age-badge {
        width: 50px;
        height: 50px;
        font-size: 30px;
        margin: 0 auto 10px;
    }

    .age-verification-heading {
        margin-bottom: 12px;
    }

    .age-verification-title {
        font-size: 18px;
        margin-bottom: 8px;
    }

    .age-verification-warning {
        padding: 10px;
        margin: 12px 0;
    }

    .age-verification-warning p {
        font-size: 12px;
        line-height: 1.4;
    }

    .age-verification-text {
        font-size: 12px;
        line-height: 1.5;
        margin: 12px 0;
    }

    .age-verification-buttons {
        flex-direction: row;
        gap: 10px;
        margin-top: 15px;
    }

    .age-verification-buttons button {
        padding: 10px 15px;
        font-size: 13px;
        min-height: 40px;
    }
}

/* Dark mode animations */
@keyframes pulseGlow {
    0% {
        box-shadow: 0 0 20px rgba(255, 107, 53, 0.4);
    }
    50% {
        box-shadow: 0 0 30px rgba(255, 107, 53, 0.6);
    }
    100% {
        box-shadow: 0 0 20px rgba(255, 107, 53, 0.4);
    }
}

.age-badge {
    animation: pulseGlow 2s ease-in-out infinite;
}

/* Focus states for accessibility */
.age-verification-buttons button:focus {
    outline: 2px solid #ffc107;
    outline-offset: 2px;
}

/* Fade in animation for content */
@keyframes fadeInContent {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* =====================================================
   ACCESS DENIED SCREEN STYLES
   ===================================================== */

/* Access Denied Overlay - Full Screen */
#accessDeniedOverlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: linear-gradient(135deg, #1a0000 0%, #330000 100%);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

#accessDeniedOverlay.active {
    opacity: 1;
    visibility: visible;
}

/* Access Denied Container */
.access-denied-container {
    position: relative;
    z-index: 10001;
    width: 90vw !important;
    max-width: 600px;
    text-align: center;
    -webkit-box-sizing: border-box;
    box-sizing: border-box;
    padding: 10px;
}

/* Access Denied Box */
.access-denied-box {
    background: linear-gradient(135deg, #2d2d2d 0%, #1a1a1a 100%);
    border-radius: 12px;
    padding: 50px 40px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8), 0 0 40px rgba(255, 0, 0, 0.3);
    border: 3px solid #d32f2f;
    position: relative;
    overflow: hidden;
    animation: slideInAccessDenied 0.5s ease;
    -webkit-box-sizing: border-box;
    box-sizing: border-box;
}

@media (max-width: 480px) {
    .access-denied-box {
        padding: 30px 20px;
        margin: 10px;
        border-radius: 10px;
    }

    .access-denied-header {
        margin: -30px -20px 20px -20px;
    }

    .access-denied-icon {
        font-size: 48px;
        margin-bottom: 15px;
    }

    .access-denied-title {
        font-size: 24px;
        margin: 15px 0;
    }

    .access-denied-message {
        font-size: 14px;
        margin: 20px 0;
    }
}

/* Background pattern for denied screen */
.access-denied-box::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(211, 47, 47, 0.15) 0%, transparent 70%);
    border-radius: 50%;
    pointer-events: none;
}

.access-denied-box > * {
    position: relative;
    z-index: 1;
}

/* Red Header Bar */
.access-denied-header {
    background: linear-gradient(135deg, #d32f2f 0%, #ff6b6b 100%);
    padding: 20px;
    margin: -50px -40px 30px -40px;
    border-bottom: 3px solid #880000;
    border-radius: 9px 9px 0 0;
}

/* Warning Icon */
.access-denied-icon {
    font-size: 64px;
    margin-bottom: 20px;
    display: inline-block;
    animation: iconShake 0.5s ease;
}

/* Main Title "Доступ запрещен!" */
.access-denied-title {
    font-size: 36px;
    color: #ff6b6b;
    font-weight: bold;
    margin: 20px 0;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Subtitle */
.access-denied-subtitle {
    font-size: 18px;
    color: #ccc;
    margin: 15px 0;
    font-weight: 600;
}

/* Main message text */
.access-denied-message {
    font-size: 16px;
    color: #e0e0e0;
    line-height: 1.8;
    margin: 30px 0;
    font-style: italic;
}

.access-denied-message p {
    margin: 12px 0;
}

/* Additional info box */
.access-denied-info {
    background: rgba(211, 47, 47, 0.1);
    border-left: 4px solid #d32f2f;
    padding: 15px;
    margin: 25px 0;
    border-radius: 4px;
    text-align: center;
}

.access-denied-info p {
    color: #ccc;
    margin: 0;
    font-size: 14px;
}

/* Footer Text */
.access-denied-footer {
    font-size: 12px;
    color: #999;
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid rgba(211, 47, 47, 0.3);
}

/* Animations */
@keyframes slideInAccessDenied {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

@keyframes iconShake {
    0%, 100% {
        transform: rotate(0deg);
    }
    25% {
        transform: rotate(-5deg);
    }
    75% {
        transform: rotate(5deg);
    }
}

/* Pulse animation for error state */
@keyframes errorPulse {
    0%, 100% {
        box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8), 0 0 40px rgba(255, 0, 0, 0.3);
    }
    50% {
        box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8), 0 0 60px rgba(255, 0, 0, 0.5);
    }
}

.access-denied-box {
    animation: slideInAccessDenied 0.5s ease, errorPulse 2s ease-in-out infinite;
}

/* =====================================================
   ACCESS DENIED - MOBILE RESPONSIVE DESIGN
   ===================================================== */

/* Ultra-small devices (320px - 375px) */
@media (max-width: 375px) {
    #accessDeniedOverlay {
        padding: 10px;
    }

    .access-denied-container {
        width: 100%;
        max-width: 100%;
        padding: 0 10px;
    }

    .access-denied-box {
        padding: 25px 16px;
        border-radius: 10px;
        border-width: 2px;
        box-shadow: 0 10px 40px rgba(0, 0, 0, 0.7), 0 0 20px rgba(255, 0, 0, 0.2);
    }

    .access-denied-box::before {
        width: 250px;
        height: 250px;
        top: -40%;
        left: -40%;
    }

    .access-denied-header {
        margin: -25px -16px 20px -16px;
        padding: 12px;
        border-radius: 8px 8px 0 0;
    }

    .access-denied-icon {
        font-size: 48px;
        margin-bottom: 10px;
    }

    .access-denied-title {
        font-size: 22px;
        margin: 12px 0;
        letter-spacing: 0.5px;
        word-wrap: break-word;
    }

    .access-denied-subtitle {
        font-size: 14px;
        margin: 10px 0;
    }

    .access-denied-message {
        font-size: 13px;
        line-height: 1.6;
        margin: 15px 0;
    }

    .access-denied-message p {
        margin: 8px 0;
    }

    .access-denied-info {
        padding: 10px;
        margin: 15px 0;
        border-left-width: 3px;
        border-radius: 3px;
    }

    .access-denied-info p {
        font-size: 12px;
    }

    .access-denied-footer {
        font-size: 11px;
        margin-top: 12px;
        padding-top: 10px;
    }
}

/* Small devices (375px - 480px) */
@media (min-width: 376px) and (max-width: 480px) {
    #accessDeniedOverlay {
        padding: 10px;
    }

    .access-denied-container {
        width: 95%;
        max-width: 430px;
        padding: 0;
    }

    .access-denied-box {
        padding: 30px 18px;
        border-radius: 10px;
        border-width: 2px;
        box-shadow: 0 10px 45px rgba(0, 0, 0, 0.75), 0 0 25px rgba(255, 0, 0, 0.25);
    }

    .access-denied-box::before {
        width: 300px;
        height: 300px;
        top: -40%;
        left: -40%;
    }

    .access-denied-header {
        margin: -30px -18px 22px -18px;
        padding: 14px;
        border-radius: 8px 8px 0 0;
    }

    .access-denied-icon {
        font-size: 52px;
        margin-bottom: 12px;
    }

    .access-denied-title {
        font-size: 26px;
        margin: 14px 0;
        letter-spacing: 0.5px;
    }

    .access-denied-subtitle {
        font-size: 15px;
        margin: 12px 0;
    }

    .access-denied-message {
        font-size: 14px;
        line-height: 1.7;
        margin: 18px 0;
    }

    .access-denied-message p {
        margin: 10px 0;
    }

    .access-denied-info {
        padding: 12px;
        margin: 18px 0;
        border-left-width: 3px;
        border-radius: 3px;
    }

    .access-denied-info p {
        font-size: 13px;
    }

    .access-denied-footer {
        font-size: 12px;
        margin-top: 15px;
        padding-top: 12px;
    }
}

/* Medium devices (481px - 768px) */
@media (min-width: 481px) and (max-width: 768px) {
    #accessDeniedOverlay {
        padding: 15px;
    }

    .access-denied-container {
        width: 90%;
        max-width: 550px;
        padding: 0;
    }

    .access-denied-box {
        padding: 40px 30px;
        border-radius: 11px;
        border-width: 3px;
        box-shadow: 0 15px 50px rgba(0, 0, 0, 0.8), 0 0 35px rgba(255, 0, 0, 0.3);
    }

    .access-denied-box::before {
        width: 400px;
        height: 400px;
        top: -45%;
        left: -45%;
    }

    .access-denied-header {
        margin: -40px -30px 28px -30px;
        padding: 18px;
        border-radius: 8px 8px 0 0;
        border-bottom-width: 3px;
    }

    .access-denied-icon {
        font-size: 60px;
        margin-bottom: 15px;
    }

    .access-denied-title {
        font-size: 32px;
        margin: 16px 0;
        letter-spacing: 1px;
    }

    .access-denied-subtitle {
        font-size: 17px;
        margin: 14px 0;
    }

    .access-denied-message {
        font-size: 15px;
        line-height: 1.8;
        margin: 22px 0;
    }

    .access-denied-message p {
        margin: 12px 0;
    }

    .access-denied-info {
        padding: 15px;
        margin: 20px 0;
        border-left-width: 4px;
        border-radius: 4px;
    }

    .access-denied-info p {
        font-size: 14px;
    }

    .access-denied-footer {
        font-size: 13px;
        margin-top: 18px;
        padding-top: 14px;
    }
}

/* Tablets and above (769px+) */
@media (min-width: 769px) {
    .access-denied-container {
        width: 90%;
        max-width: 600px;
    }

    .access-denied-box {
        padding: 50px 40px;
    }

    .access-denied-header {
        margin: -50px -40px 30px -40px;
    }
}

/* =====================================================
   ACCESS DENIED - LANDSCAPE ORIENTATION
   ===================================================== */

@media (orientation: landscape) and (max-height: 600px) {
    #accessDeniedOverlay {
        padding: 5px;
    }

    .access-denied-container {
        width: 95%;
        max-width: 100%;
    }

    .access-denied-box {
        padding: 20px 20px;
        max-height: 90vh;
        overflow-y: auto;
        border-radius: 8px;
    }

    .access-denied-box::before {
        width: 200px;
        height: 200px;
    }

    .access-denied-header {
        margin: -20px -20px 15px -20px;
        padding: 10px;
        border-bottom-width: 2px;
        border-radius: 6px 6px 0 0;
    }

    .access-denied-icon {
        font-size: 40px;
        margin-bottom: 8px;
    }

    .access-denied-title {
        font-size: 24px;
        margin: 10px 0;
        letter-spacing: 0.5px;
    }

    .access-denied-subtitle {
        font-size: 14px;
        margin: 8px 0;
    }

    .access-denied-message {
        font-size: 13px;
        line-height: 1.5;
        margin: 12px 0;
    }

    .access-denied-message p {
        margin: 6px 0;
    }

    .access-denied-info {
        padding: 10px;
        margin: 12px 0;
        border-left-width: 3px;
    }

    .access-denied-info p {
        font-size: 12px;
    }

    .access-denied-footer {
        font-size: 11px;
        margin-top: 10px;
        padding-top: 8px;
    }
}

/* =====================================================
   TOUCH DEVICE - ACCESS DENIED OPTIMIZATIONS
   ===================================================== */

@media (hover: none) {
    .access-denied-box {
        animation: slideInAccessDenied 0.5s ease, errorPulse 3s ease-in-out infinite;
    }
}


/* =====================================================
   TOUCH AND ANIMATION PERFORMANCE OPTIMIZATIONS
   ===================================================== */

/* Optimize animations for mobile devices */
@media (prefers-reduced-motion: reduce) {
    #ageVerificationOverlay,
    #ageVerificationModal,
    #accessDeniedOverlay,
    .access-denied-box,
    .age-verification-box,
    .age-badge,
    .age-verification-buttons button {
        animation: none !important;
        transition: none !important;
    }
}

/* Touch device specific styles */
@supports (pointer: coarse) {
    /* Improve touch keyboard appearance on iOS */
    button {
        font-size: 16px;
    }

    /* Ensure inputs don't zoom on iOS when font-size is 16px or larger */
    input {
        font-size: 16px;
    }

    /* Disable tap highlight on touch devices */
    a, button {
        -webkit-tap-highlight-color: transparent;
    }
}

/* Mobile-specific class added by JavaScript */
.mobile-optimized {
    /* Optimize for mobile rendering */
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.touch-device {
    /* Better touch feedback */
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

/* Ensure buttons don't have minimum size issues on mobile */
.age-verification-buttons button {
    /* Prevent text selection on double tap */
    user-select: none;
    -webkit-user-select: none;
    
    /* Smooth animation only on desktop */
    will-change: transform, background;
}

/* Viewport fix for modal position on mobile */
@media (max-width: 768px) {
    #ageVerificationModal {
        max-height: 90vh;
        overflow-y: auto;
    }

    .age-verification-box {
        max-height: 85vh;
        overflow-y: auto;
    }
}

/* Prevent zoom on double-tap for buttons */
button {
    touch-action: manipulation;
}

/* Safe area support for notched devices */
@supports(padding: max(0px)) {
    #ageVerificationOverlay,
    #accessDeniedOverlay {
        padding: max(0px, env(safe-area-inset-top)) 
                 max(0px, env(safe-area-inset-right)) 
                 max(0px, env(safe-area-inset-bottom)) 
                 max(0px, env(safe-area-inset-left));
    }

    @media (max-width: 480px) {
        .age-verification-box {
            padding: max(20px, env(safe-area-inset-top)) 
                     max(16px, env(safe-area-inset-right)) 
                     max(20px, env(safe-area-inset-bottom)) 
                     max(16px, env(safe-area-inset-left));
        }

        .access-denied-box {
            padding: max(25px, env(safe-area-inset-top)) 
                     max(16px, env(safe-area-inset-right)) 
                     max(25px, env(safe-area-inset-bottom)) 
                     max(16px, env(safe-area-inset-left));
        }
    }
}

/* High DPI/Retina display optimizations */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .age-badge {
        box-shadow: 0 10px 30px rgba(255, 107, 53, 0.4);
    }

    .access-denied-box {
        box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8), 0 0 40px rgba(255, 0, 0, 0.3);
    }
}

/* Fix for iOS Safari modal positioning */
@supports (-webkit-appearance: none) {
    /* iOS Safari specific fixes */
    #ageVerificationModal,
    #accessDeniedOverlay {
        position: fixed;
    }

    input[type="text"],
    input[type="email"],
    input[type="password"],
    textarea,
    select {
        font-size: 16px;
    }
}