/**
 * Consent Entry Page Styles
 * Following Graphics Alignment Method for perfect positioning
 * Base resolution: 2048 × 1536
 */

/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 0;
    overflow: hidden;
    font-family: 'Fredoka', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

/* Main container - full viewport */
.consent-entry-container {
    width: 100%;
    height: 100vh;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Graphics container - maintains aspect ratio */
.graphics-container {
    position: relative;
    width: 100%;
    max-width: 100%;
    max-height: 100vh;
    aspect-ratio: 2048 / 1536; /* Critical for maintaining alignment */
}

/* All layers use absolute positioning */
.background-layer,
.door-layer,
.arrow-layer,
.provide-consent-layer,
.given-consent-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

/* Z-index layering */
.background-layer { z-index: 1; }
.door-layer { z-index: 2; }
.arrow-layer { z-index: 3; }
.provide-consent-layer { z-index: 4; }
.given-consent-layer { z-index: 4; }
.consent-popup-overlay { z-index: 10; }
.quick-access-overlay { z-index: 11; }
.door-clickable,
.provide-consent-clickable,
.given-consent-clickable { z-index: 5; }

/* Images fill their containers */
.background-image,
.arrow-image,
.provide-consent-image,
.given-consent-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

/* Door image base styles */
.door-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

/* Clickable areas based on coordinates from main-entry */
.door-clickable {
    position: absolute;
    /* Adjusted: split the difference - moved back right by 50% */
    left: 55.75%;   /* Halfway between 49.5% and 62.07% */
    top: 66.67%;    /* 1024.8/1536 */
    width: 12.52%;  /* 256.43/2048 */
    height: 24.82%; /* 381.25/1536 */
    cursor: pointer;
    background: transparent;
    
    /* Touch-specific properties for better mobile support */
    touch-action: manipulation; /* Prevents delay on double-tap */
    -webkit-tap-highlight-color: transparent; /* Remove tap highlight on iOS */
    -webkit-touch-callout: none; /* Disable callout on long press */
    user-select: none; /* Prevent text selection */
    
    /* Ensure it's easily tappable */
    min-width: 44px;
    min-height: 44px;
    
    /* Add subtle transition for visual feedback */
    transition: opacity 0.2s ease;
    
    /* Debug mode - uncomment to visualize */
    /* background: rgba(255, 0, 0, 0.2);
    border: 2px solid red; */
}

.provide-consent-clickable {
    position: absolute;
    /* From coordinates: x=782.64, y=905.87, width=484.57, height=240.91 */
    left: 38.22%;   /* 782.64/2048 */
    top: 58.98%;    /* 905.87/1536 */
    width: 23.66%;  /* 484.57/2048 */
    height: 15.69%; /* 240.91/1536 */
    cursor: pointer;
    background: transparent;
}

.given-consent-clickable {
    position: absolute;
    /* From coordinates: x=782.64, y=1151.86, width=484.57, height=240.91 */
    left: 38.22%;   /* 782.64/2048 */
    top: 75.00%;    /* 1151.86/1536 */
    width: 23.66%;  /* 484.57/2048 */
    height: 15.69%; /* 240.91/1536 */
    cursor: pointer;
    background: transparent;
}

/* Arrow bounce animation */
.arrow-animated {
    animation: arrow-bounce 1.5s ease-in-out infinite;
}

@keyframes arrow-bounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

/* Door shake animation */
@keyframes door-shake {
    0%, 100% { transform: translateX(0); }
    10% { transform: translateX(-10px) rotate(-1deg); }
    20% { transform: translateX(10px) rotate(1deg); }
    30% { transform: translateX(-8px) rotate(-1deg); }
    40% { transform: translateX(8px) rotate(1deg); }
    50% { transform: translateX(-6px) rotate(-0.5deg); }
    60% { transform: translateX(6px) rotate(0.5deg); }
    70% { transform: translateX(-4px) rotate(-0.5deg); }
    80% { transform: translateX(4px) rotate(0.5deg); }
    90% { transform: translateX(-2px); }
}

.door-shake {
    animation: door-shake 0.5s ease-in-out;
    transform-origin: center bottom;
}

/* Door opening animation - exactly as working example but adjusted */
.door-layer {
    /* Set transform origin to left edge */
    transform-origin: 55.75% center;  /* Origin at door's left edge position */
    /* Speed of the Door animation */
    transition: all 0.5s ease-in-out;
}

/* When opening - realistic door opening angle */
.door-layer.door-opening {
    /* 70 degree rotation for realistic door opening without disappearing */
    transform: perspective(1200px) rotateY(-70deg);
}

/* Button slide-in animation */
@keyframes button-slide-in {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.button-slide-in {
    animation: button-slide-in 0.5s ease-out forwards;
}

/* Consent popup styles (placeholder - will be replaced with graphic) */
.consent-popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.consent-popup {
    background: white;
    border-radius: 20px;
    padding: 40px;
    max-width: 600px;
    width: 90%;
    position: relative;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    text-align: center;
}

.popup-header {
    margin-bottom: 20px;
}

.popup-logo {
    max-width: 150px;
    margin-bottom: 15px;
}

.popup-header h2 {
    color: #333;
    font-size: 1.8rem;
    margin: 0;
}

.popup-content {
    margin-bottom: 20px;
}

.popup-icon {
    font-size: 3rem;
    color: #667eea;
    margin-bottom: 15px;
}

.popup-message {
    color: #333;
    font-size: 1.3rem;
    font-weight: 600;
    margin: 10px 0;
}

.popup-submessage {
    color: #555;
    font-size: 1.1rem;
    margin: 10px 0;
    line-height: 1.5;
}

.popup-instruction {
    font-weight: 600;
    color: #333;
    margin-top: 20px !important;
    margin-bottom: 25px !important;
    font-size: 1.1rem;
}

/* Consent Badge Buttons */
.consent-badges {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-top: 20px;
}

.consent-badge {
    display: flex;
    align-items: center;
    padding: 20px;
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: left;
    width: 100%;
    font-family: 'Fredoka', sans-serif;
}

.consent-badge:hover {
    border-color: #667eea;
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.2);
}

.consent-badge.new-consent {
    background: linear-gradient(135deg, #667eea10 0%, #764ba210 100%);
}

.consent-badge.new-consent:hover {
    background: linear-gradient(135deg, #667eea20 0%, #764ba220 100%);
}

.consent-badge.returning {
    background: linear-gradient(135deg, #4CAF5010 0%, #45a04910 100%);
}

.consent-badge.returning:hover {
    background: linear-gradient(135deg, #4CAF5020 0%, #45a04920 100%);
}

.badge-icon {
    font-size: 2rem;
    color: #667eea;
    margin-right: 20px;
    width: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.consent-badge.returning .badge-icon {
    color: #4CAF50;
}

.badge-content {
    flex: 1;
}

.badge-content h3 {
    margin: 0;
    color: #333;
    font-size: 1.2rem;
    font-weight: 600;
}

.badge-content p {
    margin: 5px 0 0 0;
    color: #666;
    font-size: 0.95rem;
}

.badge-arrow {
    color: #999;
    font-size: 1.2rem;
    margin-left: 15px;
}

.consent-badge:hover .badge-arrow {
    color: #667eea;
    transform: translateX(5px);
}

.popup-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #999;
    cursor: pointer;
    padding: 5px;
    width: 35px;
    height: 35px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s;
}

.popup-close:hover {
    background: #f0f0f0;
    color: #333;
}

/* Popup animations */
.popup-fade-in {
    animation: fadeIn 0.3s ease-out;
}

.popup-fade-out {
    animation: fadeOut 0.3s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes fadeOut {
    from {
        opacity: 1;
        transform: scale(1);
    }
    to {
        opacity: 0;
        transform: scale(0.95);
    }
}

/* Quick Access Overlay Styles */
.quick-access-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.quick-access-form {
    background: white;
    border-radius: 20px;
    padding: 40px;
    max-width: 450px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.quick-access-header {
    text-align: center;
    margin-bottom: 30px;
}

.quick-access-header h2 {
    color: #333;
    font-size: 1.8rem;
    margin-bottom: 10px;
}

.quick-access-header p {
    color: #666;
    font-size: 1rem;
}

.quick-access-step {
    margin-bottom: 20px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #333;
    font-weight: 600;
}

.form-control {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s;
}

.form-control:focus {
    outline: none;
    border-color: #667eea;
}

.form-text {
    display: block;
    margin-top: 5px;
    color: #666;
    font-size: 0.875rem;
}

.consent-checkbox {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.consent-checkbox label {
    display: flex;
    align-items: flex-start;
    cursor: pointer;
    font-size: 0.95rem;
    color: #333;
}

.consent-checkbox input[type="checkbox"] {
    margin-right: 10px;
    margin-top: 3px;
    cursor: pointer;
}

.btn {
    display: inline-block;
    padding: 12px 24px;
    margin: 10px 0;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    width: 100%;
    text-align: center;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(102, 126, 234, 0.3);
}

.btn-secondary {
    background: #e0e0e0;
    color: #333;
}

.btn-secondary:hover:not(:disabled) {
    background: #d0d0d0;
}

.btn-back {
    margin-top: 20px;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

.quick-access-message {
    padding: 12px 16px;
    border-radius: 8px;
    margin: 20px 0;
    display: none;
    font-size: 0.95rem;
}

.quick-access-message.info {
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

.quick-access-message.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.quick-access-message.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.quick-access-message i {
    margin-right: 8px;
}

/* Overlay animations */
.overlay-fade-in {
    animation: overlayFadeIn 0.3s ease-out;
}

.overlay-fade-out {
    animation: overlayFadeOut 0.3s ease-out;
}

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

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

/* Focus styles for accessibility */
.door-clickable:focus,
.provide-consent-clickable:focus,
.given-consent-clickable:focus {
    outline: none;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    /* Make the door clickable area larger on mobile for easier tapping */
    .door-clickable {
        /* Expand the clickable area on mobile */
        left: 50%;  /* Center it more */
        top: 60%;   /* Move up slightly */
        width: 25%; /* Double the width */
        height: 35%; /* Increase height */
        transform: translateX(-12.5%); /* Center the expanded area */
        
        /* Ensure minimum touch target size */
        min-width: 80px;
        min-height: 80px;
        
        /* Visual debugging for mobile - uncomment to see touch area */
        /* background: rgba(0, 255, 0, 0.2);
        border: 2px dashed green; */
    }
    
    /* Also improve other touch targets on mobile */
    .provide-consent-clickable,
    .given-consent-clickable {
        min-width: 60px;
        min-height: 60px;
        touch-action: manipulation;
        -webkit-tap-highlight-color: transparent;
    }
    
    .consent-popup,
    .quick-access-form {
        padding: 25px;
    }
    
    .popup-header h2,
    .quick-access-header h2 {
        font-size: 1.5rem;
    }
    
    .popup-content p {
        font-size: 1rem;
    }
}

/* Extra adjustments for very small screens */
@media (max-width: 480px) {
    .door-clickable {
        /* Even larger touch area for phones */
        left: 45%;
        top: 55%;
        width: 35%;
        height: 40%;
        transform: translateX(-17.5%);
        
        /* Bigger minimum size for small screens */
        min-width: 100px;
        min-height: 100px;
    }
    
    /* Ensure arrow doesn't block touch */
    .arrow-layer {
        pointer-events: none;
    }
}