@import url('https://cdn.jsdelivr.net/gh/rastikerdar/vazir-font@v30.1.0/dist/font-face.css');

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Vazir', Tahoma, Arial, sans-serif;
    background: url('https://mci-elecomp.site/assets/images/pattern-bg.png') repeat;
    background-size: cover;
    background-attachment: fixed;
    min-height: 100vh;
    color: #333;
    direction: rtl;
    overflow-x: hidden;
    position: relative;
}

/* لایه شفاف روی بکگراند - خیلی کم */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.2);
    z-index: -1;
}

/* لوگو MCI */
.logo-mci {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    text-align: center;
    animation: fadeInDown 1s ease;
}

.logo-mci img {
    height: 50px;
    filter: drop-shadow(0 3px 6px rgba(0,0,0,0.1));
}

@keyframes fadeInDown {
    from { opacity: 0; transform: translateX(-50%) translateY(-20px); }
    to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

.container {
    max-width: 400px;
    margin: 0 auto;
    padding: 80px 20px 20px;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Join Screen */
.join-screen {
    width: 100%;
    background: white;
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.1);
    border: 2px solid #e8f0fe;
}

.logo {
    text-align: center;
    margin-bottom: 30px;
}

.logo h1 {
    color: #1e4db7;
    font-size: 2rem;
    margin-bottom: 10px;
}

.logo p {
    color: #666;
    font-size: 1rem;
}

.join-form {
    width: 100%;
}

.form-group {
    margin-bottom: 20px;
}

.form-control {
    width: 100%;
    padding: 15px;
    border: 2px solid #e1e4e8;
    border-radius: 10px;
    font-size: 16px;
    transition: all 0.3s;
    color: #333;
    background: white;
}

.form-control:focus {
    outline: none;
    border-color: #1e4db7;
    box-shadow: 0 0 0 3px rgba(30, 77, 183, 0.1);
}

.form-hint {
    display: block;
    margin-top: 5px;
    font-size: 12px;
    color: #999;
}

.btn {
    padding: 15px 30px;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    text-align: center;
}

.btn-primary {
    background: linear-gradient(135deg, #1e4db7 0%, #2c5aa0 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(30, 77, 183, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(30, 77, 183, 0.4);
}

.btn-primary:active {
    transform: scale(0.98);
}

.btn-block {
    width: 100%;
}

.error-message {
    background: #fee2e2;
    color: #991b1b;
    padding: 15px;
    border-radius: 10px;
    margin-top: 20px;
    text-align: center;
    font-size: 14px;
}

/* Screens */
.screen {
    display: none;
    width: 100%;
    animation: fadeIn 0.5s ease;
}

.screen.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Waiting Screen */
.waiting-content {
    background: white;
    border-radius: 20px;
    padding: 40px 30px;
    text-align: center;
    box-shadow: 0 10px 40px rgba(0,0,0,0.1);
    border: 2px solid #e8f0fe;
}

.waiting-content h2 {
    color: #1e4db7;
    margin-bottom: 30px;
    font-size: 1.8rem;
}

.loader {
    width: 60px;
    height: 60px;
    border: 5px solid #e8f0fe;
    border-top: 5px solid #1e4db7;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.waiting-content p {
    color: #666;
    margin-bottom: 20px;
}

.participant-info {
    display: flex;
    justify-content: space-between;
    padding-top: 20px;
    border-top: 1px solid #e1e4e8;
    color: #666;
    font-size: 14px;
}

/* Question Screen */
.question-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.question-number {
    background: #1e4db7;
    color: white;
    padding: 10px 20px;
    border-radius: 25px;
    font-size: 1.1rem;
    box-shadow: 0 3px 10px rgba(30, 77, 183, 0.3);
}

.timer {
    width: 60px;
    height: 60px;
    background: white;
    color: #1e4db7;
    border: 3px solid #1e4db7;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: bold;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.timer.warning {
    background: #ef4444;
    color: white;
    border-color: #ef4444;
    animation: pulse 0.5s infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.question-content {
    background: white;
    color: #333;
    padding: 25px;
    border-radius: 15px;
    margin-bottom: 30px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.1);
    border: 2px solid #e8f0fe;
}

.question-content h3 {
    font-size: 1.3rem;
    line-height: 1.8;
    color: #1a1a1a;
}

.options-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 15px;
}

.option {
    background: white;
    color: #333;
    padding: 20px;
    border-radius: 15px;
    font-size: 1.1rem;
    box-shadow: 0 3px 10px rgba(0,0,0,0.1);
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 15px;
    border: 2px solid #e8f0fe;
}

.option:hover:not(.disabled) {
    transform: translateX(-5px);
    border-color: #1e4db7;
    box-shadow: 0 5px 15px rgba(30, 77, 183, 0.2);
}

.option:active {
    transform: scale(0.98);
}

.option.selected {
    background: linear-gradient(135deg, #1e4db7 0%, #2c5aa0 100%);
    color: white;
    transform: scale(1.02);
    border-color: #1e4db7;
}

.option.correct {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    animation: correctPulse 0.6s ease;
    border-color: #10b981;
}

@keyframes correctPulse {
    0% { transform: scale(1); }
    25% { transform: scale(1.05); }
    50% { transform: scale(0.95); }
    75% { transform: scale(1.03); }
    100% { transform: scale(1); }
}

.option.wrong {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
    animation: shake 0.5s ease;
    border-color: #ef4444;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-10px); }
    75% { transform: translateX(10px); }
}

.option.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.option-letter {
    width: 40px;
    height: 40px;
    background: #e8f0fe;
    color: #1e4db7;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

.option.selected .option-letter,
.option.correct .option-letter,
.option.wrong .option-letter {
    background: rgba(255,255,255,0.3);
    color: white;
}

/* پیام تایید ارسال پاسخ */
.answer-status {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    padding: 20px;
    border-radius: 15px;
    text-align: center;
    margin-top: 20px;
    font-size: 1.1rem;
    animation: slideUp 0.5s ease;
    box-shadow: 0 5px 20px rgba(16, 185, 129, 0.3);
}

.answer-status p {
    margin: 0;
    font-weight: 600;
}

.answer-status::after {
    content: '✓';
    display: inline-block;
    margin-right: 10px;
    font-size: 1.3rem;
    animation: checkmark 0.5s ease 0.3s backwards;
}

@keyframes checkmark {
    from { transform: scale(0) rotate(-180deg); }
    to { transform: scale(1) rotate(0); }
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Result Screen */
.result-content {
    background: white;
    color: #333;
    border-radius: 20px;
    padding: 40px 30px;
    text-align: center;
    box-shadow: 0 10px 40px rgba(0,0,0,0.1);
    border: 2px solid #e8f0fe;
    position: relative;
}

.result-content h3 {
    color: #1e4db7;
    margin-bottom: 20px;
}

.result-message {
    font-size: 1.5rem;
    margin: 20px 0;
    font-weight: bold;
}

.result-message.correct {
    color: #10b981;
    animation: zoomIn 0.5s ease;
}

.result-message.wrong {
    color: #ef4444;
}

@keyframes zoomIn {
    from { transform: scale(0.5); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

/* انیمیشن شادی برای پاسخ صحیح */
.celebration {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
}

.confetti {
    position: absolute;
    width: 10px;
    height: 10px;
    background: #fbbf24;
    animation: confettiFall 3s linear;
}

@keyframes confettiFall {
    to { 
        transform: translateY(100vh) rotate(720deg);
        opacity: 0;
    }
}

.score-info {
    background: linear-gradient(135deg, #e8f0fe 0%, #d4e3fc 100%);
    padding: 20px;
    border-radius: 15px;
    margin: 20px 0;
    font-size: 1.3rem;
    font-weight: bold;
    color: #1e4db7;
}

.score-info span:last-child {
    font-size: 1.8rem;
    display: block;
    margin-top: 10px;
    animation: scoreAppear 0.5s ease 0.3s backwards;
}

@keyframes scoreAppear {
    from { 
        transform: scale(0) rotate(180deg);
        opacity: 0;
    }
    to { 
        transform: scale(1) rotate(0);
        opacity: 1;
    }
}

.wait-message {
    color: #666;
    margin-top: 20px;
    font-size: 0.95rem;
}

/* Final Screen */
.final-content {
    background: white;
    color: #333;
    border-radius: 20px;
    padding: 40px 30px;
    text-align: center;
    box-shadow: 0 10px 40px rgba(0,0,0,0.1);
    border: 2px solid #e8f0fe;
}

.final-content h2 {
    color: #1e4db7;
    margin-bottom: 30px;
    font-size: 2rem;
    animation: bounce 1s ease infinite;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.final-rank {
    margin: 30px 0;
}

.user-rank {
    font-size: 3.5rem;
    font-weight: bold;
    color: #1e4db7;
    margin: 20px 0;
    animation: rankReveal 1s ease;
}

@keyframes rankReveal {
    from { 
        transform: scale(0) rotate(360deg);
        opacity: 0;
    }
    to { 
        transform: scale(1) rotate(0);
        opacity: 1;
    }
}

.final-score {
    background: linear-gradient(135deg, #e8f0fe 0%, #d4e3fc 100%);
    padding: 25px;
    border-radius: 15px;
    margin: 20px 0;
    font-size: 1.5rem;
    font-weight: bold;
    color: #1e4db7;
}

/* لیست رتبه‌بندی */
.ranking-list {
    margin-top: 30px;
    text-align: right;
}

.rank-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
    margin-bottom: 10px;
    background: #f8f9fa;
    border-radius: 10px;
    transition: all 0.3s;
}

.rank-item.current-user {
    background: linear-gradient(135deg, #e8f0fe 0%, #d4e3fc 100%);
    border: 2px solid #1e4db7;
    font-weight: bold;
}

.rank-position {
    font-size: 1.2rem;
    font-weight: bold;
    color: #1e4db7;
}

.rank-name {
    flex: 1;
    margin: 0 15px;
}

.rank-score {
    font-weight: bold;
    color: #1e4db7;
}

/* Responsive */
@media (max-width: 400px) {
    .container {
        padding: 70px 10px 10px;
    }
    
    .logo-mci img {
        height: 40px;
    }
    
    .join-screen, .waiting-content, .result-content, .final-content {
        padding: 20px;
    }
    
    .question-content h3 {
        font-size: 1.1rem;
    }
    
    .option {
        font-size: 1rem;
        padding: 15px;
    }
}
.success-message {
    background: #d4edda;
    color: #155724;
    padding: 15px;
    border-radius: 10px;
    margin-top: 20px;
    text-align: center;
    font-size: 14px;
    border: 1px solid #c3e6cb;
}