* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
    color: #333;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    background: white;
    border-radius: 15px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    overflow: hidden;
}

@media (max-width: 768px) {
    .container {
        margin: 0;
        border-radius: 15px;
        box-shadow: 0 10px 40px rgba(0,0,0,0.2);
        max-width: 100%;
    }
}
.header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 30px;
    text-align: center;
    position: relative;
}

.header h1 {
    font-size: 2.5em;
    margin-bottom: 10px;
}

.header p {
    font-size: 1.1em;
    opacity: 0.9;
}

.main-content {
    padding: 40px;
}

.welcome-box {
    background: #f8f9fa;
    border-left: 5px solid #667eea;
    padding: 20px;
    margin-bottom: 30px;
    border-radius: 8px;
}

.welcome-box h2 {
    color: #667eea;
    margin-bottom: 10px;
}

.test-form {
    max-width: 600px;
    margin: 0 auto;
}

.form-group {
    margin-bottom: 25px;
}

.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    color: #555;
    font-size: 1.1em;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 1em;
    transition: all 0.3s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-group textarea {
    resize: vertical;
    min-height: 100px;
}

.btn {
    padding: 12px 30px;
    border: none;
    border-radius: 8px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    text-decoration: none;
    display: inline-block;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #5a6268;
}

.btn-success {
    background: #28a745;
    color: white;
}

.btn-success:hover {
    background: #218838;
}

.btn-danger {
    background: #dc3545;
    color: white;
}

.btn-danger:hover {
    background: #c82333;
}

/* 🔹 Pastdagi admin-link paneli */
.admin-linkk {
    text-align: center;
    margin-top: 40px;
    padding: 18px 14px;
    border-top: 2px solid transparent;
    background: linear-gradient(90deg, #4facfe, #00f2fe);
    background-clip: padding-box;
    position: relative;
    font-weight: 600;
    font-size: 1.05rem;
    letter-spacing: 0.4px;
    color: #333;
    transition: all 0.3s ease;
    user-select: none; /* Matnni tasodifan belgilab bo‘lmasin */
}

/* 🔹 Gradient chiziq animatsiyasi */
.admin-linkk::before {
    content: "";
    position: absolute;
    top: 0;
    left: -50%;
    width: 200%;
    height: 2px;
    background: linear-gradient(90deg, #ff7eb3, #ff758c, #43e97b, #38f9d7, #4facfe, #00f2fe);
    background-size: 300% 100%;
    animation: moveGradient 3s linear infinite;
}

@keyframes moveGradient {
    0% { background-position: 0% 50%; }
    100% { background-position: 100% 50%; }
}

/* 🔹 Havolalar (touch-friendly) */
.admin-linkk a {
    display: inline-block;
    padding: 10px 14px;
    margin: 4px;
    border-radius: 10px;
    background: rgba(255,255,255,0.4);
    color: #4facfe;
    font-weight: 700;
    text-decoration: none;
    transition: all 0.2s ease-in-out;
    -webkit-tap-highlight-color: transparent; /* Mobilda highlight yo‘qolsin */
    touch-action: manipulation;
}

/* 🔹 Hover effekti */
.admin-linkk a:hover {
    background: rgba(255,255,255,0.6);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(79, 172, 254, 0.25);
}

/* 🔹 Bosilganda (active holat) — haqiqiy “press” effekti */
.admin-linkk a:active {
    transform: scale(0.96);
    background: rgba(255,255,255,0.85);
    box-shadow: inset 0 2px 5px rgba(0,0,0,0.2);
}




/* Gradient harakati */
@keyframes moveGradient {
    0% { background-position: 0% 50%; }
    100% { background-position: 100% 50%; }
}

.admin-link {
    text-align: center;
    margin-top: 30px;
    padding-top: 30px;
    border-top: 1px solid #ddd;
}

.top-results {
    background: #f8f9fa;
    padding: 30px;
    border-radius: 15px;
    margin-top: 40px;
}

.top-results h3 {
    text-align: center;
    color: #667eea;
    margin-bottom: 20px;
    font-size: 1.5em;
}

.top-list {
    max-width: 800px;
    margin: 0 auto;
}

.top-item {
    display: flex;
    align-items: center;
    padding: 15px;
    background: white;
    border-radius: 10px;
    margin-bottom: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    transition: all 0.3s;
}

.top-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.footer {
    background: #f8f9fa;
    text-align: center;
    padding: 20px;
    color: #666;
    border-top: 1px solid #ddd;
}

/* Test sahifasi */
.test-container {
    padding: 30px;
}

.user-info {
    background: white;
    padding: 15px 20px;
    border-radius: 8px;
    margin-top: 15px;
    font-size: 1.1em;
}

.test-progress {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 30px;
}

.progress-bar {
    background: #e9ecef;
    height: 30px;
    border-radius: 15px;
    overflow: hidden;
    margin-bottom: 15px;
}

.progress-fill {
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    height: 100%;
    transition: width 0.3s ease;
    border-radius: 15px;
}

.progress-text {
    text-align: center;
    font-weight: 600;
    font-size: 1.2em;
    color: #333;
}

.timer {
    text-align: center;
    font-size: 1.3em;
    font-weight: bold;
    color: #667eea;
    margin-top: 10px;
}

.question-box {
    background: white;
    border: 2px solid #e9ecef;
    border-radius: 10px;
    padding: 30px;
    margin-bottom: 30px;
}

.question-text {
    font-size: 1.3em;
    font-weight: 600;
    margin-bottom: 25px;
    color: #333;
    line-height: 1.6;
}

.options {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.option {
    background: #f8f9fa;
    padding: 15px 20px;
    border: 2px solid #e9ecef;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 1.1em;
}

.option:hover {
    background: #e9ecef;
    border-color: #667eea;
}

.option.selected {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

.test-navigation {
    display: flex;
    justify-content: space-between;
    gap: 15px;
}

.test-navigation button {
    flex: 1;
}

/* Natijalar */
.result-container {
    padding: 40px;
}

.result-box {
    max-width: 700px;
    margin: 0 auto;
    text-align: center;
}

.result-box h2 {
    font-size: 2em;
    margin-bottom: 20px;
    color: #667eea;
}

.result-score {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 40px;
    border-radius: 15px;
    margin-bottom: 30px;
    font-size: 3em;
    font-weight: bold;
}

.result-details {
    background: #f8f9fa;
    padding: 30px;
    border-radius: 10px;
    margin-bottom: 30px;
    text-align: left;
}

.result-details p {
    font-size: 1.2em;
    margin-bottom: 15px;
    padding: 10px;
    border-left: 4px solid #667eea;
    padding-left: 20px;
}

.result-actions {
    display: flex;
    flex-wrap: wrap;          /* ðŸ”¥ Sig'masa pastga tushsin */
    gap: 15px;                /* Tugmalar orasidagi masofa */
    justify-content: center;  /* Markazga joylashsin */
    align-items: center;      /* Vertikal markazlash */
    margin-top: 20px;
}

/* ðŸ“± Kichik ekranlar uchun */
@media (max-width: 600px) {
    .result-actions {
        flex-direction: column;  /* Tugmalar ustma-ust chiqadi */
        gap: 10px;
    }

    .result-actions button {
        width: 100%;             /* Toâ€˜liq eni bilan */
        max-width: 300px;        /* Juda katta boâ€˜lmasin */
    }
}


/* Admin panel */
.login-box {
    max-width: 400px;
    margin: 50px auto;
    padding: 40px;
    background: white;
    border-radius: 15px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.1);
}

.login-box h2 {
    text-align: center;
    margin-bottom: 30px;
    color: #667eea;
}

.admin-tabs {
    display: flex;
    background: #f8f9fa;
    padding: 10px;
    gap: 10px;
}

.tab-btn {
    flex: 1;
    padding: 15px;
    background: white;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s;
}

.tab-btn:hover {
    background: #e9ecef;
}

.tab-btn.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-color: #667eea;
}

.tab-content {
    display: none;
    padding: 30px;
}

.tab-content.active {
    display: block;
}

.tab-content h2 {
    margin-bottom: 20px;
    color: #667eea;
}

.form-box {
    background: #f8f9fa;
    padding: 25px;
    border-radius: 10px;
    margin: 20px 0;
    border: 2px solid #e9ecef;
}

.form-box h3 {
    margin-bottom: 20px;
    color: #333;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
    background: white;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.data-table thead {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.data-table th,
.data-table td {
    padding: 15px;
    text-align: left;
    border-bottom: 1px solid #e9ecef;
}

.data-table tbody tr:hover {
    background: #f8f9fa;
}

.data-table button {
    padding: 8px 15px;
    margin: 0 5px;
    font-size: 0.9em;
}

.filter-box {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    margin: 20px 0;
    display: flex;
    align-items: center;
    gap: 15px;
}

.filter-box label {
    font-weight: 600;
}

.filter-box select {
    padding: 10px 15px;
    border: 2px solid #ddd;
    border-radius: 8px;
    flex: 1;
    max-width: 300px;
}

.alert {
    padding: 15px 20px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.alert-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.alert-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

/* Print style */
@media print {
    /* --- 1) Sahifani A4 va ixcham koâ€˜rinishga keltirish --- */
    @page {
        size: A4;
        margin: 10mm; /* ixchamroq margin -> ko'proq kontent sig'adi */
    }

    html, body {
        width: 210mm;
        height: 297mm;
        margin: 0 !important;
        padding: 0 !important;
        background: #fff !important;
        overflow: hidden !important; /* 2-sahifaga o'tmasin */
    }

    /* Faqat chop bo'ladigan blok (pastda .single-page qo'llaysiz) */
    .single-page {
        /* --- 2) Sig'maganda avtomatik kichraytirish (scale) --- */
        --print-scale: 0.88; /* kerak bo'lsa 0.80 ~ 0.95 oralig'ida sozlang */
        transform: scale(var(--print-scale));
        transform-origin: top left;
        width: calc(210mm - 20mm / var(--print-scale));
        /* (20mm â€“ @page marginlari yig'indisi; ko'proq aniqlik uchun margin bilan moslang) */

        /* 1 sahifadan oshib ketmasligi uchun "qirqish" */
        max-height: calc(297mm - 20mm);
        overflow: clip; /* yoki hidden */
    }

    /* Barcha bo'linishlarni o'chirish (2-sahifa bo'lmasin) */
    * {
        break-inside: avoid !important;
        page-break-inside: avoid !important;
        page-break-before: avoid !important;
        page-break-after: avoid !important;
    }

    /* Sizning mavjud yashirishlaringiz */
    .test-navigation,
    .result-actions,
    .header a,
    .footer a,
    #shareLink,
    #shareBtn {
        display: none !important;
    }

    .header {
        background: white !important;
        color: #667eea !important;
        border-bottom: 3px solid #667eea !important;
    }

    .result-container {
        padding: 12mm; /* A4 ichida proporsional */
    }

    .result-box,
    .result-score,
    .result-details,
    .analysis-question {
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .result-details { font-size: 11pt; line-height: 1.45; }
    .result-details p {
        margin-bottom: 6px;
        border-left: 3px solid #667eea;
    }

    .analysis-header button { display: none !important; }
}


/* Tahlil (Analysis) Styles */
.analysis-container {
    padding: 30px;
}

.analysis-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 3px solid #667eea;
}

.analysis-header h2 {
    color: #667eea;
    font-size: 2em;
    margin: 0;
}

.analysis-content {
    max-width: 1000px;
    margin: 0 auto;
}

.analysis-question {
    background: white;
    border: 2px solid #e9ecef;
    border-radius: 12px;
    padding: 25px;
    margin-bottom: 20px;
    transition: all 0.3s;
}

.analysis-question.correct {
    border-left: 5px solid #28a745;
    background: #f0fff4;
}

.analysis-question.incorrect {
    border-left: 5px solid #dc3545;
    background: #fff5f5;
}

.analysis-question:hover {
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.question-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.question-number {
    font-weight: bold;
    font-size: 1.1em;
    color: #667eea;
}

.question-status {
    padding: 5px 15px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 0.9em;
}

.status-correct {
    background: #28a745;
    color: white;
}

.status-incorrect {
    background: #dc3545;
    color: white;
}

.question-text {
    font-size: 1.15em;
    font-weight: 600;
    margin-bottom: 20px;
    color: #333;
    line-height: 1.6;
}

.answer-option {
    padding: 12px 15px;
    margin: 8px 0;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.answer-option.user-answer {
    background: #e3f2fd;
    border: 2px solid #2196f3;
}

.answer-option.correct-answer {
    background: #e8f5e9;
    border: 2px solid #4caf50;
}

.answer-option.wrong-answer {
    background: #ffebee;
    border: 2px solid #f44336;
}

.answer-label {
    font-weight: bold;
    min-width: 25px;
}

.answer-text {
    flex: 1;
}

.answer-badge {
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.85em;
    font-weight: 600;
}

.badge-correct {
    background: #28a745;
    color: white;
}

.badge-wrong {
    background: #dc3545;
    color: white;
}

.badge-your-answer {
    background: #2196f3;
    color: white;
}

.analysis-summary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 30px;
    border-radius: 15px;
    margin-bottom: 30px;
    text-align: center;
}

.summary-stats {
    display: flex;
    justify-content: space-around;
    margin-top: 20px;
    flex-wrap: wrap;
    gap: 20px;
}

.stat-item {
    flex: 1;
    min-width: 150px;
}

.stat-value {
    font-size: 2.5em;
    font-weight: bold;
    margin-bottom: 5px;
}

.stat-label {
    font-size: 1em;
    opacity: 0.9;
}
/* 🔹 Select konteyner (asosiy dizayn) */
.smart-select {
  appearance: none; /* Brauzer ikonkasini o'chiramiz */
  -webkit-appearance: none;
  -moz-appearance: none;
  width: 100%;
  padding: 10px 40px 10px 15px;
  border-radius: 12px;
  border: 2px solid #d1d5db;
  background: linear-gradient(135deg, #ffffff, #f8fafc);
  font-size: 16px;
  font-weight: 500;
  color: #1e293b;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
  cursor: pointer;
  transition: all 0.25s ease;
  position: relative;
}

/* 🔹 Hoverda 3D effekt */
.smart-select:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(79, 70, 229, 0.25);
  border-color: #6366f1;
}

/* 🔹 Fokuslangan payt */
.smart-select:focus {
  outline: none;
  border-color: #4f46e5;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.3);
}

/* 🔹 Pastga tushuvchi ikonka (dropdown belgi) */
.smart-select::after {
  content: "▼";
  font-size: 12px;
  color: #4b5563;
  position: absolute;
  right: 15px;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
}

/* 🔹 Option dizayni */
option.smart-option {
  padding: 10px;
  font-size: 15px;
  background: #fff;
  color: #1e293b;
  transition: background 0.2s;
}

option.smart-option:hover {
  background: #e0e7ff;
  color: #1d4ed8;
}

option.smart-option:checked {
  background: #4f46e5;
  color: #fff;
}

/* 🔹 Kichik ekranlar uchun adaptiv */
@media (max-width: 600px) {
  .smart-select {
    font-size: 14px;
    padding: 8px 36px 8px 12px;
  }
}

/* Responsive */
@media (max-width: 768px) {
    .analysis-header {
        flex-direction: column;
        gap: 15px;
    }
    
    .analysis-header h2 {
        font-size: 1.5em;
    }
    
    .question-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .summary-stats {
        flex-direction: column;
    }
}

/* 🔧 MOBILE FULL-SCREEN OVERRIDES (paste at the end of style.css) */
@media (max-width: 768px) {
  html, body {
    height: 100dvh;           /* iOS/Android dynamic viewport */
    min-height: 100dvh;
    background: #fff;         /* gradient o‘rniga oq fon */
    padding: 0;               /* tashqi paddingsiz */
    overflow: hidden;         /* ichki konteyner skroll qiladi */
  }


  .container {
    width: 100vw;
    height: 100dvh;           /* butun ekran */
    max-width: 100%;
    margin: 0;
    border-radius: 0;         /* burchaklarni tekis */
    box-shadow: none;         /* soyalarni olib tashlash */
    display: flex;
    flex-direction: column;   /* header + content + footer */
    overflow: hidden;         /* ichkarida skroll */
    background: #fff;
    display: flex;

  }

  /* Tepada joylashsin, ekranni yemasin */
  .header {
    padding: 14px 16px;
    text-align: left;
    position: static !important;
    top: 0;
    z-index: 10;
    border-radius: 0;
  }
  .header h1 {
    font-size: 1.35rem;
    margin-bottom: 4px;
  }
  .header p {
    font-size: 0.95rem;
    opacity: 0.95;
  }

  /* Asosiy zona butun qolgan joyni egallasin va skroll qilinsin */
  .main-content,
  .test-container,
  .analysis-container,
  .result-container {
    position: relative;
    padding: 16px;
    /* pastdagi bar yopib qo‘ymasligi uchun joy */
    padding-bottom: calc(88px + env(safe-area-inset-bottom));
    overflow: auto;
    background: #fff;
  }

  /* Ichki bloklarni ixchamroq qiling */
  .welcome-box,
  .test-progress,
  .question-box,
  .result-box,
  .analysis-content,
  .form-box,
  .top-results {
    border-radius: 10px;
    margin-bottom: 14px;
    padding: 14px;
  }

  /* Formlar va tugmalar to‘liq eni bilan */
  .test-form,
  .form-group,
  .result-actions {
    width: 100%;
  }
  .form-group label {
    font-size: 0.98rem;
    margin-bottom: 6px;
  }
  .form-group input,
  .form-group select,
  .form-group textarea,
  .btn {
    width: 100%;
  }
  
  /* Ekran ichidagi asosiy konteyner */
  .test-container {
    flex: 1 1 auto;
    min-height: 0;                   /* ⚠️ flex ichida scroll uchun zarur */
    overflow: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* Pastda tugmalar paneli ekranda, lekin footer ustini yopmaydi */
  .test-navigation {
    position: fixed;
    left: 0; right: 0;
    bottom: 70px;                    /* footer balandligiga mos */
    z-index: 20;
    display: flex;
    gap: 10px;
    background: rgba(255,255,255,0.95);
    backdrop-filter: blur(6px);
    padding: 10px 14px calc(10px + env(safe-area-inset-bottom));
    border-top: 1px solid #e5e7eb;
  }
  .test-navigation .btn {
    flex: 1 1 auto;
    min-height: 50px;
    border-radius: 12px;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
  }

  /* Progres bar ixcham */
  .progress-bar {
    height: 18px;
    border-radius: 9px;
  }
  .progress-text,
  .timer {
    font-size: 1rem;
  }

  /* Savol matni va variantlar */
  .question-text {
    font-size: 1.05rem;
    line-height: 1.45;
    margin-bottom: 14px;
  }
  .option {
    font-size: 1rem;
    padding-bottom: calc(var(12px) + 24px + env(safe-area-inset-bottom));

  }

.options::after {
    content: "";
    display: block;
    height: calc(var(12px) + 16px + env(safe-area-inset-bottom));
  }
  
  /* Pastdagi footer ekran ichida, ammo katta joy egallamasin */
  .footer {
    padding: 10px 12px;
    position: relative;
    font-size: 0.9rem;
    border-top: 1px solid #eee;
    background: #fff;
  }

  /* Admin link paneli ixcham */
  .admin-linkk {
    margin-top: 14px;
    padding: 12px 14px;
    font-size: 1rem;
    box-shadow: none;
  }

  /* Top results kartalarini ixchamroq qiling */
  .top-list .top-item {
    padding: 12px;
    border-radius: 10px;
    margin-bottom: 10px;
  }

  /* Select – full width, ixcham */
  .smart-select {
    width: 100%;
    font-size: 1rem;
    padding: 10px 36px 10px 12px;
    border-radius: 10px;
  }
  option.smart-option {
    font-size: 0.98rem;
    padding: 8px 10px;
  }
}
