:root {
    --primary-color: #2563eb;
    --secondary-color: #10b981;
    --danger-color: #ef4444;
    --dark-color: #1f2937;
    --light-color: #f3f4f6;
    --border-color: #e5e7eb;
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --header-height: 70px;
    /*Header balandligi */
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    /* Touch qurilmalarda tap highlight olib tashlash */
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background-color: #f9fafb;
    color: var(--dark-color);
    line-height: 1.6;
    padding-top: var(--header-height);
    /* Body uchun padding-top */
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

/* Header Styles */
header {
    background-color: white;
    box-shadow: var(--shadow);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    width: 100%;
    z-index: 1000;
    /* z-index oshirildi */
    min-height: var(--header-height);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 0;
    height: 100%;
}

h1 {
    font-size: 24px;
}

.logo {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--primary-color);
    text-decoration: none;
}

.nav-links {
    display: flex;
    gap: 2rem;
    align-items: center;
}

.nav-links a {
    color: var(--dark-color);
    text-decoration: none;
    transition: color 0.3s;
}

.nav-links a:hover {
    color: var(--primary-color);
}

/* Language Switcher */
.lang-switcher {
    display: flex;
    gap: 0.625rem;
    align-items: center;
}

.lang-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1rem;
    min-width: 70px;
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    border: 2px solid transparent;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    text-decoration: none;
    color: #475569;
    font-weight: 600;
    font-size: 0.875rem;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05),
        0 1px 2px rgba(0, 0, 0, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.8);
    transform: translateY(0);
}

.lang-flag {
    font-size: 1.125rem;
    line-height: 1;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.1));
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.lang-text {
    letter-spacing: 0.5px;
    font-weight: 700;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Active state - Premium gradient */
.lang-btn.active {
    background: linear-gradient(135deg, #2563eb 0%, #3b82f6 50%, #60a5fa 100%);
    color: white !important;
    border-color: rgba(255, 255, 255, 0.3);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.4),
        0 2px 4px rgba(37, 99, 235, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.2),
        inset 0 -1px 0 rgba(0, 0, 0, 0.1);
    transform: translateY(0);
}

.lang-btn.active .lang-flag {
    transform: scale(1.1) rotate(5deg);
}

.lang-btn.active .lang-text {
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

/* Hover effect - Glassmorphism */
.lang-btn:not(.active):hover {
    background: linear-gradient(135deg, #f1f5f9 0%, #cbd5e1 100%);
    border-color: #3b82f6;
    color: #1e40af;
    box-shadow: 0 6px 16px rgba(59, 130, 246, 0.2),
        0 3px 6px rgba(59, 130, 246, 0.15),
        inset 0 1px 0 rgba(255, 255, 255, 1);
    transform: translateY(-2px);
}

.lang-btn:not(.active):hover .lang-flag {
    transform: scale(1.15) rotate(-5deg);
    animation: shake 0.6s ease-in-out;
}

.lang-btn:not(.active):hover .lang-text {
    transform: scale(1.05);
}

/* Active effect (bosilganda) */
.lang-btn:active {
    transform: translateY(1px) scale(0.98);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1),
        inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Ripple effect */
.ripple-effect {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    pointer-events: none;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.6) 0%, transparent 70%);
    transform: scale(0);
    opacity: 0;
    border-radius: 12px;
}

.lang-btn:active .ripple-effect {
    animation: ripple 0.6s ease-out;
}

/* Ripple animation keyframes */
@keyframes ripple {
    0% {
        transform: scale(0);
        opacity: 1;
    }

    100% {
        transform: scale(2.5);
        opacity: 0;
    }
}

/* Flag shake animation */
@keyframes shake {

    0%,
    100% {
        transform: scale(1.15) rotate(-5deg);
    }

    25% {
        transform: scale(1.15) rotate(-8deg);
    }

    50% {
        transform: scale(1.15) rotate(-2deg);
    }

    75% {
        transform: scale(1.15) rotate(-6deg);
    }
}

/* Hero Section - index.php uchun */
.hero-section {
    background: linear-gradient(135deg, var(--primary-color), #3b82f6);
    color: white;
    padding: 3rem 0;
    margin-top: 0;
    /* Header ostidan boshlanadi */
}

.hero-title {
    text-align: center;
    font-size: 2rem;
    margin-bottom: 1rem;
}

.hero-subtitle {
    text-align: center;
    font-size: 1.25rem;
    opacity: 0.9;
    margin-bottom: 2rem;
}

.hero-stats {
    display: flex;
    justify-content: center;
    gap: 3rem;
    flex-wrap: wrap;
}

.stat-item {
    text-align: center;
}

.stat-number {
    font-size: 2rem;
    font-weight: bold;
}

.stat-label {
    font-size: 0.875rem;
    opacity: 0.9;
}

/* Quick Search Bar */
.quick-search-bar {
    background: linear-gradient(to bottom, #f8fafc, #f1f5f9);
    padding: 1.5rem 0;
    border-bottom: 1px solid rgba(226, 232, 240, 0.8);
    position: relative;
}

/* Search Section */
.search-section {
    background: linear-gradient(135deg, var(--primary-color), #3b82f6);
    color: white;
    padding: 3rem 0;
    margin-bottom: 2rem;
}

.search-title {
    text-align: center;
    font-size: 2rem;
    margin-bottom: 2rem;
}

.search-box {
    max-width: 600px;
    margin: 0 auto;
    position: relative;
}

.search-input {
    width: 100%;
    padding: 1rem 3rem 1rem 1rem;
    font-size: 1rem;
    border: none;
    border-radius: 0.5rem;
    box-shadow: var(--shadow-lg);
}

.search-icon {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--primary-color);
}

/* Breadcrumbs */
.breadcrumbs {
    padding: 1rem 0;
    font-size: 0.875rem;
    background-color: #f9fafb;
}

.breadcrumbs a {
    color: var(--primary-color);
    text-decoration: none;
}

.breadcrumbs span {
    color: #4b5563;
    /* Darker for accessibility */
    margin: 0 0.5rem;
}

/* Category Grid */
.categories-section {
    margin-bottom: 3rem;
    padding: 2rem 0;
}

.section-title {
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    color: var(--dark-color);
}

.category-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1rem;
}

.category-card {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    padding: 1.5rem;
    cursor: pointer;
    transition: all 0.3s;
    text-decoration: none;
    color: inherit;
}

.category-card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
    border-color: var(--primary-color);
}

.category-code {
    display: inline-block;
    background: var(--light-color);
    color: var(--primary-color);
    padding: 0.25rem 0.75rem;
    border-radius: 0.25rem;
    font-weight: bold;
    margin-bottom: 0.5rem;
}

.category-name {
    font-weight: 500;
    color: var(--dark-color);
}

/* Single Code Page */
.code-detail {
    background: white;
    border-radius: 0.5rem;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow);
}

.code-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.code-badge {
    background: var(--primary-color);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    font-size: 1.25rem;
    font-weight: bold;
}

.code-title {
    font-size: 1.5rem;
    color: var(--dark-color);
}

.code-content {
    display: grid;
    gap: 1rem;
}

.code-field {
    padding: 1rem;
    background: var(--light-color);
    border-radius: 0.25rem;
}

.code-label {
    font-weight: bold;
    color: #4b5563;
    /* Darker for accessibility */
    font-size: 0.875rem;
    text-transform: uppercase;
    margin-bottom: 0.25rem;
}

/* Results Section */
.results-section {
    margin-bottom: 3rem;
}

.result-item {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    padding: 1rem;
    margin-bottom: 1rem;
    transition: all 0.3s;
    text-decoration: none;
    color: inherit;
    display: block;
}

.result-item:hover {
    box-shadow: var(--shadow);
    border-color: var(--primary-color);
}

.result-code {
    display: inline-block;
    background: var(--primary-color);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 0.25rem;
    font-weight: bold;
    margin-right: 1rem;
}

.result-name {
    font-weight: 500;
}

.result-desc {
    color: #4b5563;
    /* Darker for accessibility */
    font-size: 0.875rem;
    margin-top: 0.5rem;
}

/* Loading Spinner */
.loader {
    border: 3px solid var(--light-color);
    border-top: 3px solid var(--primary-color);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 2rem auto;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* Mobile Navigation */
.mobile-menu-btn {
    display: none;
    flex-direction: column;
    gap: 4px;
    cursor: pointer;
    background: none;
    border: none;
    padding: 0;
}

.mobile-menu-btn span {
    width: 25px;
    height: 3px;
    background: var(--dark-color);
    transition: all 0.3s;
}

/* Footer */
footer {
    background: var(--dark-color);
    color: white;
    padding: 2rem 0;
    margin-top: 4rem;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}

.footer-section h3 {
    margin-bottom: 1rem;
}

.footer-section a {
    color: #cbd5e1;
    text-decoration: none;
    display: block;
    padding: 0.25rem 0;
}

.footer-section a:hover {
    color: white;
}

/* Responsive Design */
@media (max-width: 768px) {
    :root {
        --header-height: 64px;
        /* Mobil uchun touch-friendly balandlik */
    }

    body {
        font-size: 14px;
        /* Mobilda minimal o'qiladigan hajm */
        line-height: 1.5;
    }

    .container {
        padding: 0 1.25rem;
        /* Mobilda chetlardan yaxshi bo'shliq */
    }

    .nav-links {
        display: none;
        position: fixed;
        top: var(--header-height);
        left: 0;
        right: 0;
        background: white;
        flex-direction: column;
        padding: 1.25rem 1rem;
        box-shadow: var(--shadow-lg);
        gap: 0.5rem;
        /* Elementlar orasida bo'shliq */
        z-index: 999;
    }

    .nav-links a {
        padding: 0.875rem 1rem;
        /* Touch-friendly padding (min 44px balandlik) */
        border-radius: 0.5rem;
        transition: background 0.3s;
    }

    .nav-links a:active {
        background: #f1f5f9;
        /* Touch feedback */
    }

    .nav-links.active {
        display: flex;
    }

    .mobile-menu-btn {
        display: flex;
        padding: 0.5rem;
        /* Touch area kattalashtirish */
        margin: -0.5rem 0;
        /* Vizual pozitsiyani saqlash */
    }

    .search-title {
        font-size: 1.5rem;
        line-height: 1.3;
    }

    h1 {
        font-size: 1.5rem;
        /* Mobilda katta h1 juda katta */
        line-height: 1.3;
    }

    .section-title {
        font-size: 1.25rem;
    }

    .category-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
        /* Kartochkalar orasida yaxshi bo'shliq */
    }

    .category-card {
        padding: 1.25rem;
        /* Touch-friendly padding */
        min-height: 60px;
        /* Minimal balandlik */
    }

    .category-card:active {
        transform: scale(0.98);
        /* Touch feedback */
        background: #f8fafc;
    }

    .search-section {
        padding: 1.5rem 0;
    }

    .search-input {
        font-size: 16px;
        /* iOS zoom oldini olish uchun */
        min-height: 48px;
        /* Touch-friendly */
    }

    .code-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .code-badge {
        font-size: 1.25rem;
        padding: 0.625rem 1.25rem;
    }

    .code-title {
        font-size: 1.375rem;
        line-height: 1.3;
    }

    .footer-content {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .logo {
        font-size: 1rem;
        display: flex;
        align-items: center;
    }

    .logo svg {
        width: 20px;
        height: 20px;
        margin-right: 6px;
    }

    .search-input {
        font-size: 16px;
        /* iOS zoom oldini olish */
        padding: 0.875rem 1rem;
        min-height: 48px;
    }

    .section-title {
        font-size: 1.125rem;
        line-height: 1.3;
    }

    .category-code {
        font-size: 0.8125rem;
        padding: 0.375rem 0.625rem;
    }

    .category-name {
        font-size: 0.9375rem;
        line-height: 1.4;
    }

    /* Lang switcher touch-friendly */
    .lang-btn {
        min-width: 48px;
        min-height: 44px;
        padding: 0.5rem 1rem;
        font-size: 0.9375rem;
        font-weight: 600;
    }

    /* Result items yaxshilash */
    .result-item {
        padding: 1rem;
        min-height: 60px;
    }

    .result-code {
        display: inline-block;
        margin-bottom: 0.5rem;
    }

    .result-name {
        font-size: 0.9375rem;
        line-height: 1.4;
    }
}

/* Accessibility */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* Focus Styles - faqat keyboard navigatsiya uchun */
a:focus-visible,
button:focus-visible,
input:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* Touch qurilmalarda outline yo'q */
a:focus:not(:focus-visible),
button:focus:not(:focus-visible),
input:focus:not(:focus-visible) {
    outline: none;
}

/* Barcha bosiladigan elementlar uchun */
a,
button,
.category-card,
.result-item,
.quick-chip,
.alphabet-letter,
.lang-btn,
.nav-links a {
    -webkit-tap-highlight-color: transparent;
    -moz-tap-highlight-color: transparent;
    user-select: none;
    -webkit-user-select: none;
}

/* Print Styles */
@media print {

    header,
    footer,
    .search-section {
        display: none;
    }

    body {
        font-size: 12pt;
        padding-top: 0;
    }

    .container {
        max-width: 100%;
    }
}