/**
 * Language-Specific Styles for Digital Exams System
 * Supports 15 Indian languages with proper fonts and RTL support
 */

/* Import Google Fonts for Indian languages */
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+Devanagari:wght@400;700&family=Noto+Sans+Bengali:wght@400;700&family=Noto+Sans+Tamil:wght@400;700&family=Noto+Sans+Telugu:wght@400;700&family=Noto+Sans+Gujarati:wght@400;700&family=Noto+Sans+Gurmukhi:wght@400;700&family=Noto+Sans+Malayalam:wght@400;700&family=Noto+Sans+Kannada:wght@400;700&family=Noto+Sans+Oriya:wght@400;700&family=Noto+Sans+Arabic:wght@400;700&display=swap');

/* ========================================
   LANGUAGE-SPECIFIC FONT FAMILIES
   ======================================== */

/* English - Latin Script */
.lang-en, .script-latin {
    font-family: 'Arial', 'Helvetica', sans-serif;
    direction: ltr;
    text-align: left;
}

/* Hindi, Sanskrit, Marathi, Nepali - Devanagari Script */
.lang-hi, .lang-sa, .lang-mr, .lang-ne, .script-devanagari {
    font-family: 'Noto Sans Devanagari', 'Mangal', 'Arial Unicode MS', sans-serif;
    direction: ltr;
    text-align: left;
}

/* Bengali, Assamese - Bengali Script */
.lang-bn, .lang-as, .script-bengali {
    font-family: 'Noto Sans Bengali', 'Vrinda', 'Arial Unicode MS', sans-serif;
    direction: ltr;
    text-align: left;
}

/* Tamil - Tamil Script */
.lang-ta, .script-tamil {
    font-family: 'Noto Sans Tamil', 'Latha', 'Arial Unicode MS', sans-serif;
    direction: ltr;
    text-align: left;
}

/* Telugu - Telugu Script */
.lang-te, .script-telugu {
    font-family: 'Noto Sans Telugu', 'Gautami', 'Arial Unicode MS', sans-serif;
    direction: ltr;
    text-align: left;
}

/* Gujarati - Gujarati Script */
.lang-gu, .script-gujarati {
    font-family: 'Noto Sans Gujarati', 'Shruti', 'Arial Unicode MS', sans-serif;
    direction: ltr;
    text-align: left;
}

/* Punjabi - Gurmukhi Script */
.lang-pa, .script-punjabi {
    font-family: 'Noto Sans Gurmukhi', 'Raavi', 'Arial Unicode MS', sans-serif;
    direction: ltr;
    text-align: left;
}

/* Malayalam - Malayalam Script */
.lang-ml, .script-malayalam {
    font-family: 'Noto Sans Malayalam', 'Kartika', 'Arial Unicode MS', sans-serif;
    direction: ltr;
    text-align: left;
}

/* Kannada - Kannada Script */
.lang-kn, .script-kannada {
    font-family: 'Noto Sans Kannada', 'Tunga', 'Arial Unicode MS', sans-serif;
    direction: ltr;
    text-align: left;
}

/* Odia - Odia Script */
.lang-or, .script-odia {
    font-family: 'Noto Sans Oriya', 'Kalinga', 'Arial Unicode MS', sans-serif;
    direction: ltr;
    text-align: left;
}

/* Urdu, Arabic - Arabic Script (RTL) */
.lang-ur, .lang-ar, .script-arabic {
    font-family: 'Noto Sans Arabic', 'Nafees Web Naskh', 'Arial Unicode MS', sans-serif;
    direction: rtl;
    text-align: right;
}

/* ========================================
   RTL SUPPORT
   ======================================== */

.rtl, [dir="rtl"] {
    direction: rtl;
    text-align: right;
}

.rtl input, .rtl textarea, .rtl select {
    direction: rtl;
    text-align: right;
}

.rtl .form-group {
    text-align: right;
}

.rtl .btn {
    float: right;
}

/* ========================================
   LANGUAGE SWITCHER COMPONENTS
   ======================================== */

.language-switcher {
    margin: 10px 0;
    display: inline-block;
}

.language-switcher select {
    padding: 8px 12px;
    border: 2px solid #9c27b0;
    border-radius: 6px;
    background: white;
    font-size: 14px;
    color: #333;
    cursor: pointer;
    min-width: 200px;
    transition: all 0.3s ease;
}

.language-switcher select:hover {
    border-color: #7b1fa2;
    box-shadow: 0 2px 4px rgba(156, 39, 176, 0.2);
}

.language-switcher select:focus {
    outline: none;
    border-color: #7b1fa2;
    box-shadow: 0 0 0 3px rgba(156, 39, 176, 0.1);
}

/* Language Buttons */
.language-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 15px 0;
}

.language-btn {
    padding: 10px 15px;
    border: 2px solid #e0e0e0;
    background: white;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 120px;
    text-align: center;
    position: relative;
}

.language-btn:hover {
    border-color: #9c27b0;
    background: #f3e5f5;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.language-btn.active {
    border-color: #9c27b0;
    background: #9c27b0;
    color: white;
    box-shadow: 0 4px 12px rgba(156, 39, 176, 0.3);
}

.language-btn .native-name {
    display: block;
    font-weight: bold;
    font-size: 16px;
    margin-bottom: 2px;
}

.language-btn .english-name {
    display: block;
    font-size: 12px;
    opacity: 0.8;
}

/* Language Tabs */
.language-tabs {
    margin: 15px 0;
}

.tab-list {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    border-bottom: 2px solid #e0e0e0;
    padding-bottom: 10px;
}

.tab-item {
    padding: 10px 15px;
    border: 2px solid transparent;
    border-radius: 8px 8px 0 0;
    background: #f5f5f5;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.tab-item:hover {
    background: #e8e8e8;
    border-color: #ccc;
}

.tab-item.active {
    background: #9c27b0;
    color: white;
    border-color: #7b1fa2;
}

.tab-item input[type="radio"] {
    display: none;
}

.tab-content {
    display: block;
}

.tab-content .native-name {
    display: block;
    font-weight: bold;
    font-size: 14px;
}

.tab-content .english-name {
    display: block;
    font-size: 11px;
    opacity: 0.8;
}

/* ========================================
   LANGUAGE INDICATORS AND BADGES
   ======================================== */

.language-indicator {
    display: inline-block;
    padding: 4px 10px;
    background: #e3f2fd;
    color: #1976d2;
    border-radius: 12px;
    font-size: 12px;
    margin-left: 10px;
    font-weight: 500;
}

.language-warning {
    background: #fff3cd;
    color: #856404;
    padding: 12px;
    border: 1px solid #ffeaa7;
    border-radius: 6px;
    margin: 10px 0;
    border-left: 4px solid #ffc107;
}

.language-error {
    background: #f8d7da;
    color: #721c24;
    padding: 12px;
    border: 1px solid #f5c6cb;
    border-radius: 6px;
    margin: 10px 0;
    border-left: 4px solid #dc3545;
}

.language-success {
    background: #d4edda;
    color: #155724;
    padding: 12px;
    border: 1px solid #c3e6cb;
    border-radius: 6px;
    margin: 10px 0;
    border-left: 4px solid #28a745;
}

/* ========================================
   QUESTION DISPLAY WITH LANGUAGE SUPPORT
   ======================================== */

.question-container {
    margin: 20px 0;
    padding: 20px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    background: white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.question-text {
    font-size: 18px;
    line-height: 1.6;
    margin-bottom: 15px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 6px;
    border-left: 4px solid #9c27b0;
}

.question-options {
    margin: 15px 0;
}

.question-option {
    padding: 10px 15px;
    margin: 8px 0;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    background: white;
    cursor: pointer;
    transition: all 0.3s ease;
}

.question-option:hover {
    background: #f3e5f5;
    border-color: #9c27b0;
}

.question-option.selected {
    background: #9c27b0;
    color: white;
    border-color: #7b1fa2;
}

/* ========================================
   FORM ELEMENTS WITH LANGUAGE SUPPORT
   ======================================== */

.language-form-group {
    margin: 15px 0;
}

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

.language-form-group select,
.language-form-group input,
.language-form-group textarea {
    width: 100%;
    padding: 10px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.3s ease;
}

.language-form-group select:focus,
.language-form-group input:focus,
.language-form-group textarea:focus {
    outline: none;
    border-color: #9c27b0;
    box-shadow: 0 0 0 3px rgba(156, 39, 176, 0.1);
}

.question-textarea {
    min-height: 120px;
    resize: vertical;
    font-family: inherit;
}

.language-preview {
    margin-top: 10px;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 4px;
    font-size: 12px;
    color: #666;
}

/* ========================================
   HEADER LANGUAGE SWITCHER
   ======================================== */

.header-language-switcher {
    position: absolute;
    top: 15px;
    right: 20px;
    z-index: 1000;
}

.header-language-switcher .language-switcher select {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    border-color: rgba(156, 39, 176, 0.3);
}

/* ========================================
   RESPONSIVE DESIGN
   ======================================== */

@media (max-width: 768px) {
    .language-buttons {
        flex-direction: column;
    }
    
    .language-btn {
        width: 100%;
        min-width: auto;
    }
    
    .language-switcher select {
        width: 100%;
        min-width: auto;
        font-size: 16px; /* Prevent zoom on iOS */
    }
    
    .tab-list {
        flex-direction: column;
    }
    
    .tab-item {
        width: 100%;
        text-align: center;
    }
    
    .header-language-switcher {
        position: static;
        margin: 10px 0;
        text-align: center;
    }
    
    .question-text {
        font-size: 16px;
    }
}

@media (max-width: 480px) {
    .language-btn .native-name {
        font-size: 14px;
    }
    
    .language-btn .english-name {
        font-size: 10px;
    }
    
    .question-container {
        padding: 15px;
    }
    
    .question-text {
        font-size: 15px;
        padding: 12px;
    }
}

/* ========================================
   ANIMATIONS AND TRANSITIONS
   ======================================== */

@keyframes languageChange {
    0% { opacity: 0; transform: translateY(10px); }
    100% { opacity: 1; transform: translateY(0); }
}

.language-change-animation {
    animation: languageChange 0.3s ease-out;
}

/* Smooth transitions for language switching */
.question-container,
.question-text,
.language-btn {
    transition: all 0.3s ease;
}

/* ========================================
   ACCESSIBILITY
   ======================================== */

.language-btn:focus,
.language-switcher select:focus,
.tab-item:focus {
    outline: 2px solid #9c27b0;
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .language-btn {
        border-width: 3px;
    }
    
    .language-btn.active {
        background: #000;
        color: #fff;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .language-btn,
    .question-container,
    .question-text {
        transition: none;
    }
    
    .language-change-animation {
        animation: none;
    }
}

/* ========================================
   PRINT STYLES
   ======================================== */

@media print {
    .language-switcher,
    .language-buttons,
    .language-tabs,
    .header-language-switcher {
        display: none;
    }
    
    .question-container {
        border: 1px solid #000;
        box-shadow: none;
        page-break-inside: avoid;
    }
    
    .question-text {
        background: white;
        border-left: 2px solid #000;
    }
}
