/* Rudaw Bold - Kurdish Font */
@font-face {
    font-family: 'Rudaw Bold';
    src: url('fonts/rudawbold.eot');
    src: url('fonts/rudawbold.eot?#iefix') format('embedded-opentype'),
         url('fonts/rudawbold.woff') format('woff'),
         url('fonts/rudawbold.ttf') format('truetype'),
         url('fonts/rudawbold.svg#RudawBold') format('svg');
    font-weight: bold;
    font-style: normal;
    font-display: swap;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
}

/* Arabic font */
html[lang="ar"] body {
    font-family: 'Tajawal', -apple-system, BlinkMacSystemFont, sans-serif;
}

/* Kurdish font */
html[lang="ku"] body {
    font-family: 'Rudaw Bold', 'Tajawal', -apple-system, BlinkMacSystemFont, sans-serif;
}

.page {
    display: none;
    min-height: 100vh;
}

.page.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.container {
    text-align: center;
    padding: 2rem;
    max-width: 400px;
    width: 100%;
}

/* Landing Page Styles */
#landing-page {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

#landing-page h1 {
    color: white;
    font-size: 2.5rem;
    margin-bottom: 1rem;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

#landing-page .subtitle {
    color: rgba(255, 255, 255, 0.9);
    font-size: 1.2rem;
    margin-bottom: 2rem;
}

#landing-page .hint {
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.85rem;
    margin-top: 1.5rem;
}

/* Buttons */
.btn-primary {
    background: white;
    color: #667eea;
    border: none;
    padding: 1rem 2.5rem;
    font-size: 1.2rem;
    font-weight: 600;
    border-radius: 50px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 2px solid white;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    border-radius: 50px;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.3);
}

.camera-icon {
    font-size: 1.5rem;
}

/* Camera Page Styles */
#camera-page {
    background: #000;
    flex-direction: column;
}

.camera-container {
    flex: 1;
    position: relative;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

#camera-feed {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.scan-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.5);
}

.scan-frame {
    width: 250px;
    height: 250px;
    border: 3px solid #fff;
    border-radius: 20px;
    position: relative;
    background: transparent;
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.5);
}

.scan-frame::before,
.scan-frame::after {
    content: '';
    position: absolute;
    width: 30px;
    height: 30px;
    border-color: #667eea;
    border-style: solid;
}

.scan-frame::before {
    top: -3px;
    left: -3px;
    border-width: 4px 0 0 4px;
    border-radius: 20px 0 0 0;
}

.scan-frame::after {
    bottom: -3px;
    right: -3px;
    border-width: 0 4px 4px 0;
    border-radius: 0 0 20px 0;
}

.camera-controls {
    padding: 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    background: linear-gradient(to top, rgba(0,0,0,0.8), transparent);
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
}

.btn-capture {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: white;
    border: 5px solid rgba(255, 255, 255, 0.5);
    cursor: pointer;
    position: relative;
    transition: transform 0.1s;
}

.btn-capture:active {
    transform: scale(0.95);
}

.btn-capture .capture-icon {
    display: block;
    width: 60px;
    height: 60px;
    background: white;
    border-radius: 50%;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

/* Processing Page */
#processing-page {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

#processing-page p {
    color: white;
    font-size: 1.2rem;
    margin-top: 1.5rem;
}

.spinner {
    width: 60px;
    height: 60px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Result Page */
#result-page {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

#result-content {
    background: white;
    border-radius: 20px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

.result-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
}

.result-title {
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.result-message {
    color: #666;
    font-size: 1rem;
}

.winner .result-title {
    color: #22c55e;
}

.not-winner .result-title {
    color: #ef4444;
}

.error .result-title {
    color: #f59e0b;
}

/* Winner Contact Form */
.winner-contact-form {
    background: white;
    border-radius: 20px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

.winner-contact-form.hidden {
    display: none;
}

.winner-contact-form .form-message {
    color: #333;
    font-size: 1rem;
    margin-bottom: 1.25rem;
    font-weight: 500;
}

.winner-contact-form .form-group {
    margin-bottom: 1rem;
}

.winner-contact-form input,
.winner-contact-form select {
    width: 100%;
    padding: 0.875rem 1rem;
    font-size: 1rem;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    background: #f8fafc;
    color: #333;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.winner-contact-form input:focus,
.winner-contact-form select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.2);
}

.winner-contact-form input::placeholder {
    color: #94a3b8;
}

.winner-contact-form select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23667eea' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
}

.btn-submit {
    width: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 1rem;
    font-size: 1.1rem;
    font-weight: 600;
    border-radius: 12px;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.btn-submit:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.btn-submit:active {
    transform: translateY(0);
}

.btn-submit:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.form-status {
    margin-top: 1rem;
    padding: 0.75rem;
    border-radius: 8px;
    font-size: 0.9rem;
    text-align: center;
}

.form-status:empty {
    display: none;
}

.form-status.success {
    background: #dcfce7;
    color: #166534;
}

.form-status.error {
    background: #fee2e2;
    color: #dc2626;
}

/* Responsive */
@media (max-width: 480px) {
    #landing-page h1 {
        font-size: 2rem;
    }
    
    .scan-frame {
        width: 200px;
        height: 200px;
    }
}
/* Tutorial Video Popup */
.tutorial-popup {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    padding: 1rem;
    animation: fadeIn 0.3s ease;
}

.tutorial-popup.hidden {
    display: none;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.tutorial-popup-content {
    position: relative;
    max-width: 100%;
    max-height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tutorial-popup video {
    /* 9:16 aspect ratio */
    width: auto;
    height: 90vh;
    max-height: 90vh;
    max-width: 100%;
    aspect-ratio: 9 / 16;
    border-radius: 16px;
    background: #000;
    object-fit: cover;
}

.tutorial-close-btn {
    position: absolute;
    top: -15px;
    right: -15px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.95);
    border: none;
    font-size: 1.5rem;
    font-weight: bold;
    color: #333;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    transition: transform 0.2s ease, background 0.2s ease;
    z-index: 10;
}

.tutorial-close-btn:hover {
    transform: scale(1.1);
    background: #fff;
}

@media (max-width: 480px) {
    .tutorial-popup video {
        height: 85vh;
        border-radius: 12px;
    }

    .tutorial-close-btn {
        top: -12px;
        right: -12px;
        width: 36px;
        height: 36px;
        font-size: 1.25rem;
    }
}

/* ========== Language Switcher ========== */
.language-switcher {
    position: fixed;
    top: 1rem;
    right: 1rem;
    display: flex;
    gap: 0.5rem;
    z-index: 1000;
}

.lang-btn {
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.4);
    color: white;
    padding: 0.4rem 0.8rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    backdrop-filter: blur(10px);
}

.lang-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.6);
}

.lang-btn.active {
    background: white;
    color: #667eea;
    border-color: white;
}

/* ========== Keep Can Popup ========== */
.keep-can-popup {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    padding: 1rem;
    animation: fadeIn 0.3s ease;
}

.keep-can-popup.hidden {
    display: none;
}

.keep-can-popup-content {
    background: linear-gradient(135deg, #ff9a56 0%, #ff6b35 100%);
    border-radius: 20px;
    padding: 2.5rem 2rem;
    max-width: 350px;
    width: 90%;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
    animation: popIn 0.4s ease;
}

@keyframes popIn {
    from {
        transform: scale(0.8);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

.keep-can-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    animation: shake 0.5s ease 0.3s;
}

@keyframes shake {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(-10deg); }
    50% { transform: rotate(10deg); }
    75% { transform: rotate(-10deg); }
}

.keep-can-popup-content h2 {
    color: white;
    font-size: 1.8rem;
    margin-bottom: 1rem;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.keep-can-popup-content p {
    color: white;
    font-size: 1.1rem;
    line-height: 1.6;
    margin-bottom: 1.5rem;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.keep-can-btn {
    background: white;
    color: #ff6b35;
    border: none;
    font-size: 1.2rem;
    font-weight: bold;
    padding: 1rem 2.5rem;
    border-radius: 50px;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.keep-can-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

.keep-can-btn:active {
    transform: scale(0.98);
}

/* ========== RTL Support ========== */
html[dir="rtl"] .language-switcher {
    right: auto;
    left: 1rem;
}

html[dir="rtl"] .scan-frame::before {
    left: auto;
    right: -3px;
    border-width: 4px 4px 0 0;
    border-radius: 0 20px 0 0;
}

html[dir="rtl"] .scan-frame::after {
    right: auto;
    left: -3px;
    border-width: 0 0 4px 4px;
    border-radius: 0 0 0 20px;
}

html[dir="rtl"] .tutorial-close-btn {
    right: auto;
    left: -15px;
}

html[dir="rtl"] .winner-contact-form select {
    background-position: left 1rem center;
}

html[dir="rtl"] .btn-primary {
    flex-direction: row-reverse;
}

@media (max-width: 480px) {
    html[dir="rtl"] .tutorial-close-btn {
        right: auto;
        left: -12px;
    }
    
    .language-switcher {
        top: 0.5rem;
        right: 0.5rem;
    }
    
    html[dir="rtl"] .language-switcher {
        right: auto;
        left: 0.5rem;
    }
    
    .lang-btn {
        padding: 0.3rem 0.6rem;
        font-size: 0.75rem;
    }
}