/**
 * Theme 5 - Mobile First Minimal
 * A clean, focused, mobile-first theme for survey forms
 */

/* ========================================
   CSS Variables
   ======================================== */
:root {
    --theme5-bg: #f8f9fa;
    --theme5-text: #212529;
    --theme5-text-light: #6c757d;
    --theme5-primary: #0d6efd;
    --theme5-border: #dee2e6;
    --theme5-white: #ffffff;
    --theme5-shadow: rgba(0, 0, 0, 0.1);
    --theme5-radius: 8px;
    --theme5-transition: 0.3s ease;
}

/* ========================================
   Reset & Base
   ======================================== */
*, *::before, *::after {
    box-sizing: border-box;
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
}

body {
    margin: 0;
    padding: 0;
    font-family: 'Vazirmatn', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 1rem;
    line-height: 1.6;
    color: var(--theme5-text);
    background-color: var(--theme5-bg);
    direction: rtl;
    text-align: right;
    min-height: 100vh;
    overflow-x: hidden;
}

/* ========================================
   Main Container - Full Screen Layout
   ======================================== */
.theme-5-container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    max-width: 100%;
    margin: 0;
    padding: 0;
}

/* ========================================
   Header - Logo Top Right
   ======================================== */
.theme-5-header {
    position: fixed;
    top: 0;
    right: 0;
    left: 0;
    z-index: 100;
    padding: 12px 16px;
    background: var(--theme5-white);
    border-bottom: 1px solid var(--theme5-border);
    display: flex;
    justify-content: flex-end;
    align-items: center;
}

.theme-5-logo {
    max-height: 40px;
}

.theme-5-logo img {
    max-height: 40px;
    max-width: 120px;
    width: auto;
    object-fit: contain;
}

/* ========================================
   Main Content - Centered Questions
   ======================================== */
.theme-5-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 80px 16px 100px;
    width: 100%;
}

/* Survey Container */
#surveyContainer {
    width: 100%;
    max-width: 100%;
    background: var(--theme5-white);
    border-radius: var(--theme5-radius);
    padding: 16px;
}

/* Before Form Text */
.theme-5-before-text {
    width: 100%;
    margin-bottom: 24px;
    padding: 16px;
    background: var(--theme5-white);
    border-radius: var(--theme5-radius);
    text-align: center;
    font-size: 0.95rem;
    color: var(--theme5-text-light);
}

/* Password Form */
.theme-5-password {
    width: 100%;
    max-width: 320px;
    padding: 24px;
    background: var(--theme5-white);
    border-radius: var(--theme5-radius);
    box-shadow: 0 2px 10px var(--theme5-shadow);
    text-align: center;
}

.theme-5-password p {
    margin-bottom: 20px;
    color: var(--theme5-text);
}

.theme-5-password-input {
    margin-bottom: 16px;
    text-align: right;
}

.theme-5-password-input label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
}

.theme-5-password-input input {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--theme5-border);
    border-radius: var(--theme5-radius);
    font-family: inherit;
    font-size: 1rem;
    direction: ltr;
    text-align: left;
}

/* Message (after submit) */
.theme-5-message {
    width: 100%;
    max-width: 480px;
    padding: 32px 24px;
    background: var(--theme5-white);
    border-radius: var(--theme5-radius);
    text-align: center;
    box-shadow: 0 2px 10px var(--theme5-shadow);
}

.theme-5-message p {
    margin: 0;
    font-size: 1.1rem;
    line-height: 1.8;
}

/* ========================================
   Buttons
   ======================================== */
.theme-5-btn {
    display: inline-block;
    padding: 12px 32px;
    font-family: inherit;
    font-size: 1rem;
    font-weight: 500;
    color: var(--theme5-white);
    background-color: var(--theme5-primary);
    border: none;
    border-radius: var(--theme5-radius);
    cursor: pointer;
    transition: background-color var(--theme5-transition);
}

.theme-5-btn:hover,
.theme-5-btn:focus {
    background-color: #0b5ed7;
    outline: none;
}

/* SurveyJS Button Overrides */
#surveyContainer .sv_next_btn,
#surveyContainer .sv_prev_btn,
#surveyContainer .sv_complete_btn {
    display: inline-block;
    padding: 14px 32px;
    font-family: 'Vazirmatn', inherit;
    font-size: 1rem;
    font-weight: 500;
    border: none;
    border-radius: var(--theme5-radius);
    cursor: pointer;
    transition: all var(--theme5-transition);
    min-width: 100px;
}

#surveyContainer .sv_next_btn,
#surveyContainer .sv_complete_btn {
    color: var(--theme5-white);
    background-color: var(--theme5-primary);
}

#surveyContainer .sv_next_btn:hover,
#surveyContainer .sv_complete_btn:hover {
    background-color: #0b5ed7;
}

#surveyContainer .sv_prev_btn {
    color: var(--theme5-text);
    background-color: var(--theme5-bg);
    border: 1px solid var(--theme5-border);
}

#surveyContainer .sv_prev_btn:hover {
    background-color: #e9ecef;
}

/* ========================================
   Footer - Minimal Copyright
   ======================================== */
.theme-5-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 12px 16px;
    background: var(--theme5-white);
    border-top: 1px solid var(--theme5-border);
    text-align: center;
    z-index: 100;
}

.theme-5-copyright {
    font-size: 0.75rem;
    color: var(--theme5-text-light);
    margin: 0;
}

/* ========================================
   SurveyJS Customizations
   ======================================== */

/* Question Title */
#surveyContainer .sv_q_title {
    font-weight: 600;
    font-size: 1.1rem;
    margin-bottom: 12px;
}

/* Question Container */
#surveyContainer .sv_q {
    margin-bottom: 24px;
}

/* Input Fields */
#surveyContainer input[type="text"],
#surveyContainer input[type="number"],
#surveyContainer input[type="email"],
#surveyContainer textarea,
#surveyContainer select {
    width: 100%;
    padding: 12px;
    font-family: inherit;
    font-size: 1rem;
    border: 1px solid var(--theme5-border);
    border-radius: var(--theme5-radius);
    background-color: var(--theme5-white);
    direction: rtl;
}

#surveyContainer input:focus,
#surveyContainer textarea:focus,
#surveyContainer select:focus {
    outline: none;
    border-color: var(--theme5-primary);
    box-shadow: 0 0 0 3px rgba(13, 110, 253, 0.15);
}

/* Radio & Checkbox */
#surveyContainer .sv_q_checkbox,
#surveyContainer .sv_q_radiogroup {
    padding: 0;
}

#surveyContainer .sv_q_checkbox_label,
#surveyContainer .sv_q_radiogroup_label {
    display: flex;
    align-items: center;
    padding: 10px 12px;
    margin-bottom: 8px;
    background: var(--theme5-bg);
    border-radius: var(--theme5-radius);
    cursor: pointer;
    transition: background-color var(--theme5-transition);
}

#surveyContainer .sv_q_checkbox_label:hover,
#surveyContainer .sv_q_radiogroup_label:hover {
    background: #e9ecef;
}

/* Matrix Question */
#surveyContainer table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

#surveyContainer th,
#surveyContainer td {
    padding: 10px 8px;
    text-align: center;
    border-bottom: 1px solid var(--theme5-border);
}

#surveyContainer th {
    background: var(--theme5-bg);
    font-weight: 500;
}

/* Progress Bar */
#surveyContainer .sv_progress {
    height: 4px;
    background: var(--theme5-bg);
    border-radius: 2px;
    margin-bottom: 20px;
    overflow: hidden;
}

#surveyContainer .sv_progress_bar {
    height: 100%;
    background: var(--theme5-primary);
    border-radius: 2px;
    transition: width var(--theme5-transition);
}

/* Page Title */
#surveyContainer .sv_page_title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 20px;
    text-align: center;
}

/* Navigation Buttons Container */
#surveyContainer .sv_nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-top: 24px;
    padding-top: 16px;
    border-top: 1px solid var(--theme5-border);
    flex-wrap: wrap;
}

#surveyContainer .sv_next_btn {
    order: 1;
}

#surveyContainer .sv_prev_btn {
    order: 2;
}

/* Completed Page */
#surveyContainer .sv_completed_page {
    text-align: center;
    padding: 32px 16px;
}

#surveyContainer .sv_completed_page h3 {
    font-size: 1.5rem;
    margin-bottom: 16px;
}

/* ========================================
   Responsive - Tablet (≥ 576px)
   ======================================== */
@media (min-width: 576px) {
    .theme-5-main {
        padding: 80px 24px 100px;
    }

    #surveyContainer {
        max-width: 540px;
        padding: 24px;
    }

    .theme-5-before-text {
        max-width: 540px;
    }

    .theme-5-logo img {
        max-height: 48px;
        max-width: 140px;
    }
}

/* ========================================
   Responsive - Desktop (≥ 768px)
   ======================================== */
@media (min-width: 768px) {
    .theme-5-header {
        padding: 16px 24px;
    }

    .theme-5-main {
        padding: 100px 32px 80px;
    }

    #surveyContainer {
        max-width: 640px;
        padding: 32px;
        box-shadow: 0 4px 20px var(--theme5-shadow);
    }

    .theme-5-before-text {
        max-width: 640px;
        padding: 20px 24px;
    }

    .theme-5-logo img {
        max-height: 50px;
        max-width: 160px;
    }

    #surveyContainer .sv_q_title {
        font-size: 1.2rem;
    }

    .theme-5-copyright {
        font-size: 0.8rem;
    }
}

/* ========================================
   Responsive - Large Desktop (≥ 992px)
   ======================================== */
@media (min-width: 992px) {
    #surveyContainer {
        max-width: 720px;
    }

    .theme-5-before-text {
        max-width: 720px;
    }

    .theme-5-message {
        max-width: 560px;
    }
}

/* ========================================
   Dark Mode Support (Optional)
   ======================================== */
@media (prefers-color-scheme: dark) {
    :root {
        --theme5-bg: #1a1a1a;
        --theme5-text: #e9e9e9;
        --theme5-text-light: #9a9a9a;
        --theme5-border: #333333;
        --theme5-white: #222222;
        --theme5-shadow: rgba(0, 0, 0, 0.3);
    }
}

/* ========================================
   Print Styles
   ======================================== */
@media print {
    .theme-5-header,
    .theme-5-footer {
        position: static;
        border: none;
    }

    .theme-5-main {
        padding: 0;
    }

    #surveyContainer {
        box-shadow: none;
        max-width: 100%;
    }
}
