/**
 * Medical Tourism Survey - Frontend Styles (Multilingual)
 * Supports both RTL (Persian, Arabic) and LTR (English, Chinese) layouts.
 *
 * The .mts-survey-wrapper element gets a dynamic `dir` attribute set in PHP
 * based on the active language. Per-language font families are applied via
 * the `.mts-lang-<code>` modifier class.
 */

/* Reset & Base */
.mts-survey-wrapper {
    font-family: 'Vazirmatn', 'Vazir', 'Tahoma', 'Arial', sans-serif;
    direction: rtl;
    min-height: 100vh;
    background: linear-gradient(135deg, #f0fdfa 0%, #ecfeff 50%, #f0f9ff 100%);
    padding: 1rem;
    box-sizing: border-box;
}

/* Per-language font overrides */
.mts-survey-wrapper.mts-lang-fa {
    font-family: 'Vazirmatn', 'Vazir', 'Tahoma', sans-serif;
}
.mts-survey-wrapper.mts-lang-ar {
    font-family: 'Vazirmatn', 'Tahoma', 'Amiri', sans-serif;
}
.mts-survey-wrapper.mts-lang-en {
    font-family: 'Inter', 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
}
.mts-survey-wrapper.mts-lang-zh {
    font-family: 'Noto Sans SC', 'PingFang SC', 'Microsoft YaHei', 'Hiragino Sans GB', sans-serif;
}

/* Language Switcher */
.mts-language-switcher {
    max-width: 900px;
    margin: 1rem auto 0;
    padding: 1rem 1.5rem;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(10px);
    border-radius: 16px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.mts-language-label {
    font-weight: 600;
    color: #374151;
    font-size: 0.9rem;
    white-space: nowrap;
}

.mts-language-buttons {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.mts-language-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 0.95rem;
    border-radius: 9999px;
    text-decoration: none;
    background: #f3f4f6;
    color: #4b5563;
    font-size: 0.85rem;
    font-weight: 600;
    border: 2px solid transparent;
    transition: all 0.25s;
}

.mts-language-btn:hover {
    background: #e5e7eb;
    transform: translateY(-1px);
}

.mts-language-btn.mts-language-active {
    background: linear-gradient(135deg, #14b8a6, #06b6d4);
    color: white;
    border-color: #0d9488;
    box-shadow: 0 4px 12px rgba(20, 184, 166, 0.3);
}

.mts-language-flag {
    font-size: 1.05rem;
    line-height: 1;
}

.mts-language-name {
    line-height: 1;
}

/* LTR adjustments for English / Chinese */
.mts-survey-wrapper[dir="ltr"] .mts-question-number {
    float: left;
    margin-left: 0;
    margin-right: 0.75rem;
}

.mts-survey-wrapper[dir="ltr"] .mts-card-header h2,
.mts-survey-wrapper[dir="ltr"] .mts-data-table th,
.mts-survey-wrapper[dir="ltr"] .mts-field input[type="text"],
.mts-survey-wrapper[dir="ltr"] .mts-field input[type="date"],
.mts-survey-wrapper[dir="ltr"] .mts-field input[type="password"] {
    text-align: left;
    direction: ltr;
}

.mts-survey-wrapper[dir="ltr"] .mts-likert-labels {
    direction: ltr;
}

/* Screens */
.mts-screen {
    display: none;
    max-width: 900px;
    margin: 0 auto;
}

.mts-screen.mts-active {
    display: block;
}

.mts-section {
    padding-bottom: 80px; /* Space for fixed nav */
}

/* Welcome Header */
.mts-welcome-header {
    text-align: center;
    padding: 2rem 0;
}

.mts-icons {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.mts-icon {
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 16px;
    font-size: 28px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.mts-icon-heart { background: linear-gradient(135deg, #14b8a6, #06b6d4); }
.mts-icon-plane { background: linear-gradient(135deg, #3b82f6, #6366f1); }
.mts-icon-building { background: linear-gradient(135deg, #10b981, #22c55e); }

.mts-title {
    font-size: 2.5rem;
    font-weight: 900;
    background: linear-gradient(135deg, #0d9488, #0891b2, #3b82f6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin: 1rem 0 0.5rem;
}

.mts-badge {
    display: inline-block;
    padding: 0.5rem 1.5rem;
    background: linear-gradient(135deg, #ccfbf1, #a5f3fc);
    color: #0e7490;
    border-radius: 9999px;
    font-weight: 600;
    font-size: 0.9rem;
    border: 2px solid #99f6e4;
}

/* Card */
.mts-card {
    background: white;
    border-radius: 24px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.1);
    overflow: hidden;
    margin-bottom: 2rem;
}

/* Cover */
.mts-cover {
    height: 200px;
    background: linear-gradient(135deg, #14b8a6, #06b6d4, #3b82f6);
    position: relative;
    overflow: hidden;
}

.mts-cover-content {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    color: white;
}

.mts-cover-heart {
    font-size: 4rem;
    filter: drop-shadow(0 4px 10px rgba(0,0,0,0.2));
}

.mts-cover-text {
    font-size: 1.25rem;
    font-weight: bold;
    margin-top: 0.5rem;
}

.mts-cover-sub {
    opacity: 0.9;
    font-size: 0.9rem;
}

.mts-cover::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: linear-gradient(to top, white, transparent);
}

/* Info Section */
.mts-info-section {
    padding: 2rem;
}

.mts-info-section h2 {
    color: #134e4a;
    font-size: 1.5rem;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.mts-info-section p {
    color: #374151;
    line-height: 1.8;
    font-size: 1rem;
}

.highlight-teal { color: #0d9488; font-weight: 600; }
.highlight-blue { color: #2563eb; font-weight: 600; }
.highlight-green { color: #059669; font-weight: 600; }
.highlight-purple { color: #7c3aed; font-weight: 600; }
.highlight-pink { color: #db2777; font-weight: 600; }

.mts-notice {
    margin-top: 1.5rem;
    padding: 1rem;
    background: linear-gradient(135deg, #fefce8, #fef9c3);
    border: 2px solid #fde047;
    border-radius: 12px;
    display: flex;
    gap: 0.75rem;
    align-items: start;
}

.mts-notice span {
    font-size: 1.25rem;
}

.mts-notice p {
    color: #854d0e;
    font-size: 0.9rem !important;
    margin: 0;
}

/* Stats Grid */
.mts-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 1rem;
    padding: 0 2rem 2rem;
}

.mts-stat-item {
    background: white;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    padding: 1rem;
    text-align: center;
    transition: all 0.3s;
}

.mts-stat-item:hover {
    border-color: #14b8a6;
    transform: translateY(-2px);
}

.mts-stat-icon {
    font-size: 2rem;
    display: block;
    margin-bottom: 0.5rem;
}

.mts-stat-label {
    display: block;
    color: #6b7280;
    font-size: 0.75rem;
    margin-bottom: 0.25rem;
}

.mts-stat-value {
    display: block;
    color: #111827;
    font-weight: 700;
    font-size: 1rem;
}

/* Buttons */
.mts-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    border-radius: 12px;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    border: none;
    transition: all 0.3s;
    font-family: inherit;
}

.mts-btn-primary {
    background: linear-gradient(135deg, #14b8a6, #06b6d4);
    color: white;
    width: 100%;
    padding: 1rem 2rem;
    font-size: 1.125rem;
}

.mts-btn-primary:hover {
    background: linear-gradient(135deg, #0d9488, #0891b2);
    transform: scale(1.02);
    box-shadow: 0 10px 30px rgba(20, 184, 166, 0.3);
}

.mts-btn-outline {
    background: white;
    color: #374151;
    border: 2px solid #e5e7eb;
}

.mts-btn-outline:hover {
    border-color: #14b8a6;
    color: #14b8a6;
}

.mts-btn-success {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
}

.mts-btn-success:hover {
    background: linear-gradient(135deg, #059669, #047857);
}

.mts-btn-large {
    padding: 1.25rem 3rem;
    font-size: 1.25rem;
}

/* Footer */
.mts-footer {
    text-align: center;
    padding: 1.5rem;
    color: #6b7280;
    font-size: 0.875rem;
}

/* Admin Link in Footer */
.mts-admin-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.75rem;
    padding: 0.5rem 1rem;
    background: linear-gradient(135deg, #f3f4f6, #e5e7eb);
    border: 1px solid #d1d5db;
    border-radius: 10px;
    color: #374151;
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.3s;
}

.mts-admin-link:hover {
    background: linear-gradient(135deg, #14b8a6, #06b6d4);
    color: white;
    border-color: transparent;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(20, 184, 166, 0.3);
}

/* Floating Admin Button */
.mts-floating-admin {
    position: fixed;
    bottom: 100px;
    left: 20px;
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, #374151, #1f2937);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    text-decoration: none;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    z-index: 90;
    transition: all 0.3s;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.mts-floating-admin.visible {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.mts-floating-admin:hover {
    transform: scale(1.1);
    background: linear-gradient(135deg, #14b8a6, #06b6d4);
    box-shadow: 0 6px 20px rgba(20, 184, 166, 0.4);
}

/* Progress Bar */
.mts-progress-bar {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(255,255,255,0.95);
    backdrop-filter: blur(10px);
    padding: 1rem;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.mts-progress-fill {
    height: 8px;
    background: linear-gradient(90deg, #14b8a6, #06b6d4);
    border-radius: 4px;
    transition: width 0.3s;
}

.mts-progress-text {
    display: block;
    text-align: center;
    font-size: 0.875rem;
    color: #6b7280;
    margin-top: 0.5rem;
}

/* Navigation (Fixed Bottom) */
.mts-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(255,255,255,0.95);
    backdrop-filter: blur(10px);
    padding: 1rem;
    box-shadow: 0 -4px 20px rgba(0,0,0,0.1);
    z-index: 100;
    max-width: 900px;
    margin: 0 auto;
    left: 50%;
    transform: translateX(-50%);
    border-radius: 20px 20px 0 0;
    display: flex;
    justify-content: space-between;
    gap: 1rem;
}

/* Card Headers */
.mts-card-header {
    padding: 1.5rem 2rem;
    color: white;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.mts-header-teal { background: linear-gradient(135deg, #14b8a6, #06b6d4); }
.mts-header-blue { background: linear-gradient(135deg, #3b82f6, #6366f1); }
.mts-header-pink { background: linear-gradient(135deg, #ec4899, #f43f5e); }
.mts-header-amber { background: linear-gradient(135deg, #f59e0b, #f97316); }
.mts-header-green { background: linear-gradient(135deg, #10b981, #22c55e); }
.mts-header-violet { background: linear-gradient(135deg, #8b5cf6, #a855f7); }
.mts-header-cyan { background: linear-gradient(135deg, #06b6d4, #14b8a6); }
.mts-header-red { background: linear-gradient(135deg, #ef4444, #f97316); }
.mts-header-indigo { background: linear-gradient(135deg, #6366f1, #3b82f6); }
.mts-header-purple { background: linear-gradient(135deg, #8b5cf6, #ec4899); }

.mts-header-icon {
    font-size: 2.5rem;
    background: rgba(255,255,255,0.2);
    padding: 0.75rem;
    border-radius: 12px;
}

.mts-card-header h2 {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.mts-card-header p {
    opacity: 0.9;
    font-size: 0.9rem;
}

/* Card Body */
.mts-card-body {
    padding: 2rem;
}

/* Form Fields */
.mts-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.mts-field {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.mts-field label {
    font-weight: 600;
    color: #374151;
}

.mts-field input[type="text"],
.mts-field input[type="date"],
.mts-field input[type="password"] {
    padding: 0.875rem 1rem;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    font-size: 1rem;
    font-family: inherit;
    direction: rtl;
    transition: all 0.3s;
}

.mts-field input:focus {
    outline: none;
    border-color: #14b8a6;
    box-shadow: 0 0 0 3px rgba(20, 184, 166, 0.1);
}

/* Field Groups (Radio) */
.mts-field-group {
    margin-bottom: 1.5rem;
}

.mts-field-group > label {
    display: block;
    font-weight: 600;
    color: #374151;
    margin-bottom: 0.75rem;
    font-size: 1.1rem;
}

.mts-radio-group {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.mts-grid-3 .mts-radio-label {
    flex: 0 0 calc(33.333% - 0.5rem);
}

.mts-grid-4 .mts-radio-label {
    flex: 0 0 calc(25% - 0.5625rem);
}

.mts-radio-label {
    cursor: pointer;
}

.mts-radio-label input {
    display: none;
}

.mts-radio-label span {
    display: block;
    padding: 0.75rem 1.25rem;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    text-align: center;
    transition: all 0.3s;
    font-size: 0.95rem;
}

.mts-radio-label input:checked + span {
    background: linear-gradient(135deg, #ccfbf1, #a5f3fc);
    border-color: #14b8a6;
    color: #0e7490;
    font-weight: 600;
}

.mts-radio-label:hover span {
    border-color: #14b8a6;
}

.mts-small span {
    font-size: 0.85rem !important;
    padding: 0.625rem 0.75rem !important;
}

/* Questions (Likert Scale) */
.mts-question {
    background: linear-gradient(135deg, #f0fdfa, #ecfeff);
    border: 1px solid #ccfbf1;
    border-radius: 16px;
    padding: 1.25rem;
    margin-bottom: 1.5rem;
    transition: all 0.3s;
}

.mts-question:hover {
    border-color: #14b8a6;
    box-shadow: 0 4px 15px rgba(20, 184, 166, 0.1);
}

.mts-question-number {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, #14b8a6, #06b6d4);
    color: white;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.875rem;
    float: right;
    margin-left: 0.75rem;
    margin-bottom: 0.5rem;
}

.mts-question-text {
    color: #374151;
    line-height: 1.7;
    font-weight: 500;
    margin-bottom: 1rem;
}

/* Likert Scale */
.mts-likert {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    clear: both;
}

.mts-likert-option {
    cursor: pointer;
}

.mts-likert-option input {
    display: none;
}

.mts-likert-option span {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    font-weight: 700;
    font-size: 1.125rem;
    transition: all 0.2s;
    background: white;
}

.mts-likert-option input:checked + span {
    background: linear-gradient(135deg, #14b8a6, #06b6d4);
    border-color: #0d9488;
    color: white;
    transform: scale(1.1);
    box-shadow: 0 4px 15px rgba(20, 184, 166, 0.3);
}

.mts-likert-option:hover span {
    border-color: #14b8a6;
    transform: scale(1.05);
}

.mts-likert-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: #9ca3af;
    margin-top: 0.5rem;
    padding: 0 0.25rem;
}

/* Submit Area */
.mts-submit-area {
    text-align: center;
    padding: 2rem;
}

/* Success Message */
.mts-success {
    text-align: center;
    padding: 4rem 2rem;
    max-width: 500px;
    margin: 4rem auto;
    background: white;
    border-radius: 24px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.1);
}

.mts-success-icon {
    font-size: 5rem;
    margin-bottom: 1rem;
}

.mts-success h2 {
    font-size: 2rem;
    color: #059669;
    margin-bottom: 0.5rem;
}

.mts-success p {
    color: #6b7280;
    font-size: 1.125rem;
    margin-bottom: 2rem;
}

/* Responsive */
@media (max-width: 768px) {
    .mts-survey-wrapper {
        padding: 0.5rem;
    }
    
    .mts-title {
        font-size: 1.75rem;
    }
    
    .mts-cover {
        height: 150px;
    }
    
    .mts-card-body {
        padding: 1.25rem;
    }
    
    .mts-stats-grid {
        grid-template-columns: repeat(2, 1fr);
        padding: 0 1rem 1rem;
    }
    
    .mts-grid-3 .mts-radio-label,
    .mts-grid-4 .mts-radio-label {
        flex: 0 0 calc(50% - 0.375rem);
    }
    
    .mts-nav {
        border-radius: 16px 16px 0 0;
        padding: 0.75rem;
    }
    
    .mts-btn {
        padding: 0.75rem 1.25rem;
        font-size: 0.95rem;
    }
    
    .mts-likert-option span {
        width: 44px;
        height: 44px;
    }
    
    .mts-question-number {
        width: 28px;
        height: 28px;
        font-size: 0.8rem;
    }
}

@media (max-width: 480px) {
    .mts-icons {
        gap: 0.5rem;
    }
    
    .mts-icon {
        width: 45px;
        height: 45px;
        font-size: 22px;
    }
    
    .mts-stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.5rem;
    }
    
    .mts-stat-item {
        padding: 0.75rem 0.5rem;
    }
    
    .mts-stat-icon {
        font-size: 1.5rem;
    }
    
    .mts-row {
        grid-template-columns: 1fr;
    }
}
