/* Homepage Styles */
.homepage-container {
    text-align: center;
    padding: 40px 20px;
    max-width: 800px;
    margin: 0 auto;
}

.homepage-description {
    font-size: 1.2em;
    color: #666;
    margin-bottom: 40px;
}

.homepage-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
    margin-bottom: 40px;
}

.option-card {
    background: white;
    border-radius: 15px;
    padding: 30px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    cursor: pointer;
    border: 2px solid transparent;
}

.option-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
    border-color: #88d8a3;
}

.option-icon {
    font-size: 3em;
    margin-bottom: 20px;
}

.option-card h3 {
    color: #4a5568;
    font-size: 1.5em;
    margin-bottom: 15px;
    font-weight: 600;
}

.option-card p {
    color: #718096;
    margin-bottom: 25px;
    line-height: 1.6;
}

.report-access-form {
    background: white;
    border-radius: 15px;
    padding: 30px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    max-width: 400px;
    margin: 0 auto;
}

.report-access-form h3 {
    color: #4a5568;
    margin-bottom: 20px;
    text-align: center;
}

/* Responsive Design */
@media (max-width: 768px) {
    .homepage-options {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .option-card {
        padding: 20px;
    }
    
    .option-icon {
        font-size: 2.5em;
    }
}

/* CSS Reset */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: #333;
    background: linear-gradient(135deg, #a8e6cf 0%, #88d8a3 100%);
    min-height: 100vh;
}

.container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 20px;
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    border-radius: 10px;
    margin-top: 20px;
    margin-bottom: 20px;
}

/* Header */
.header {
    text-align: center;
    margin-bottom: 40px;
    padding: 30px 0;
    border-bottom: 2px solid #f0f0f0;
}

.header h1 {
    color: #4a5568;
    font-size: 2.5em;
    margin-bottom: 10px;
    font-weight: 700;
}

.subtitle {
    color: #718096;
    font-size: 1.1em;
    font-weight: 300;
}

/* Progress Bar */
.progress-container {
    margin-bottom: 40px;
}

.progress-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
}

.progress-bar::before {
    content: '';
    position: absolute;
    top: 20px;
    left: 20px;
    right: 20px;
    height: 2px;
    background: #e2e8f0;
    z-index: 0;
}


.progress-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    z-index: 1。
}

.step-number {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #e2e8f0;
    color: #718096;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 1.1em;
    transition: all 0.3s ease;
}

.step-label {
    margin-top: 10px;
    font-size: 0.9em;
    color: #718096;
    text-align: center;
    max-width: 100px;
}

.progress-step.active .step-number {
    background: #88d8a3;
    color: white;
}

.progress-step.active .step-label {
    color: #4a5568;
    font-weight: 500;
}

/* Step Content */
.step-content {
    display: none;
    animation: fadeIn 0.5s ease-in;
}

.step-content.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Forms */
.form-container, .questionnaire-container, .report-container {
    max-width: 800px;
    margin: 0 auto;
}

.form-group {
    margin-bottom: 25px;
}

label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #4a5568;
    font-size: 1em;
}

input[type="text"], input[type="date"], select {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 1em;
    background: white;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

input[type="text"]:focus, input[type="date"]:focus, select:focus {
    outline: none;
    border-color: #88d8a3;
    box-shadow: 0 0 0 3px rgba(136, 216, 163, 0.1);
}

/* Radio Buttons */
.radio-group {
    display: flex;
    gap: 20px;
    margin-top: 10px;
}

.radio-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-weight: 400;
    color: #4a5568;
}

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

.radio-button {
    width: 20px;
    height: 20px;
    border: 2px solid #e2e8f0;
    border-radius: 50%;
    margin-right: 8px;
    position: relative;
    transition: all 0.3s ease;
}

.radio-label input[type="radio"]:checked + .radio-button {
    border-color: #88d8a3;
    background: #88d8a3;
}

.radio-label input[type="radio"]:checked + .radio-button::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 8px;
    height: 8px;
    background: white;
    border-radius: 50%;
}

/* Questionnaire Sections */
.instruction {
    background: #f7fafc;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 30px;
    color: #4a5568;
    font-size: 1em;
    border-left: 4px solid #88d8a3;
}

.question-section {
    margin-bottom: 40px;
    padding: 25px;
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.question-section h3 {
    color: #4a5568;
    margin-bottom: 20px;
    font-size: 1.3em;
    font-weight: 600;
}

.question-group {
    margin-bottom: 25px;
}

.question-group label {
    font-weight: 500;
    margin-bottom: 10px;
    font-size: 1em;
}

/* Likert Scale */
.likert-scale, .panas-scale {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 10px;
}

.scale-labels {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
}

.scale-labels .scale-value {
    font-weight: bold;
    color: #88d8a3;
    font-size: 1.1em;
    min-width: 20px;
    text-align: center;
}

/* English text styling for Chinese language */
.english-text {
    font-style: italic;
    color: #666;
    font-size: 0.9em;
    margin-left: 5px;
}

input[type="range"] {
    flex: 1;
    height: 8px;
    border-radius: 5px;
    background: #e2e8f0;
    outline: none;
    transition: background 0.3s ease;
    appearance: none;
    -webkit-appearance: none;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #88d8a3;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

input[type="range"]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #88d8a3;
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.scale-value {
    min-width: 30px;
    text-align: center;
    font-weight: bold;
    color: #88d8a3;
    font-size: 1.2em;
}

.scale-labels {
    display: flex;
    justify-content: space-between;
    margin-top: 5px;
    font-size: 0.8em;
    color: #718096;
}

/* PANAS Grid */
.panas-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

.panas-scale {
    flex-direction: column;
    gap: 10px;
}

/* Buttons */
.btn {
    padding: 14px 30px;
    border: none;
    border-radius: 8px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
    margin: 10px 10px 10px 0;
}

.btn-primary {
    background: linear-gradient(135deg, #a8e6cf 0%, #88d8a3 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(102, 126, 234, 0.3);
}

.btn-secondary {
    background: #e2e8f0;
    color: #4a5568;
}

.btn-secondary:hover {
    background: #cbd5e0;
    transform: translateY(-2px);
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Error Messages */
.error-message {
    color: #e53e3e;
    font-size: 0.9em;
    margin-top: 5px;
    display: none;
}

.error-message.show {
    display: block;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    animation: fadeIn 0.3s ease;
}

.modal-content {
    background: white;
    margin: 15% auto;
    padding: 30px;
    border-radius: 10px;
    width: 90%;
    max-width: 500px;
    position: relative;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from { transform: translateY(-50px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    position: absolute;
    top: 15px;
    right: 20px;
}

.close:hover {
    color: #000;
}

/* Report Styles */
.report-container {
    padding: 30px 0;
}

.report-loading {
    text-align: center;
    padding: 60px 20px;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #e2e8f0;
    border-left-color: #88d8a3;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.report-section {
    margin-bottom: 40px;
}

.report-chart {
    background: white;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    margin-bottom: 20px;
}

.report-summary {
    background: linear-gradient(135deg, #a8e6cf 0%, #88d8a3 100%);
    color: white;
    padding: 30px;
    border-radius: 10px;
    margin-bottom: 30px;
}

.score-item {
    background: white;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 15px;
    border-left: 4px solid #88d8a3;
}

.score-label {
    font-weight: 600;
    color: #4a5568;
    margin-bottom: 5px;
}

.score-value {
    font-size: 2em;
    font-weight: bold;
    color: #88d8a3;
}

.score-description {
    color: #718096;
    font-size: 0.9em;
    margin-top: 5px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        margin: 10px;
        padding: 15px;
    }

    .header h1 {
        font-size: 2em;
    }

    .progress-bar {
        font-size: 0.8em;
    }

    .step-number {
        width: 35px;
        height: 35px;
        font-size: 0.9em;
    }

    .step-label {
        max-width: 80px;
        font-size: 0.8em;
    }

    .panas-grid {
        grid-template-columns: 1fr;
    }

    .likert-scale {
        flex-direction: column;
        gap: 10px;
    }

    .scale-labels {
        font-size: 0.7em;
    }

    .btn {
        width: 100%;
        margin: 5px 0;
    }

    .modal-content {
        margin: 10% auto;
        padding: 20px;
    }
}

/* Progress Loading Styles */
.progress-loading {
    text-align: center;
    padding: 20px;
    margin-top: 20px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.progress-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #e9ecef;
    border-left-color: #88d8a3;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 15px;
}

.progress-bar-simple {
    width: 100%;
    height: 8px;
    background: #e9ecef;
    border-radius: 4px;
    overflow: hidden;
    margin-top: 15px;
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #a8e6cf, #88d8a3);
    border-radius: 4px;
    animation: progressFill 2s ease-in-out infinite;
}

@keyframes progressFill {
    0% { width: 0%; }
    50% { width: 80%; }
    100% { width: 100%; }
}

/* User Found Display */
.user-found-display {
    margin-top: 20px;
}

.user-info-card {
    background: linear-gradient(135deg, #a8e6cf 0%, #88d8a3 100%);
    color: white;
    padding: 25px;
    border-radius: 12px;
    text-align: center;
    box-shadow: 0 4px 15px rgba(136, 216, 163, 0.3);
    animation: slideInUp 0.5s ease-out;
}

.user-info-card h3 {
    margin: 0 0 15px 0;
    font-size: 1.4em;
    font-weight: 600;
}

.user-info-card p {
    margin: 8px 0;
    font-size: 1.1em;
}

.user-info-card strong {
    font-weight: 600;
}

.auto-proceed-text {
    color: #90cdf4 !important;
    font-size: 1em !important;
    margin: 15px 0 10px 0 !important;
    font-weight: 500;
}

.countdown-timer {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 5px;
    margin-top: 10px;
    font-size: 0.9em;
    color: #e2e8f0;
}

#countdownText {
    background: rgba(255, 255, 255, 0.2);
    padding: 4px 8px;
    border-radius: 4px;
    font-weight: bold;
    min-width: 20px;
    text-align: center;
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ECharts Styling */
.report-chart {
    background: white;
    border-radius: 10px;
    padding: 20px;
    margin: 20px 0;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    border: 1px solid #e2e8f0;
}

.report-chart h3 {
    color: #4a5568;
    margin-bottom: 15px;
    text-align: center;
    font-size: 1.2em;
    font-weight: 600;
}

/* PERMA Charts Side by Side Layout */
.report-chart-container {
    display: flex;
    gap: 20px;
    margin: 20px 0;
    padding: 20px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.report-chart-half {
    flex: 1;
    min-width: 0; /* Allows flex items to shrink below their content size */
}

/* Responsive charts */
@media (max-width: 768px) {
    .report-chart {
        padding: 15px;
        margin: 15px 0;
    }
    
    .report-chart h3 {
        font-size: 1.1em;
    }
    
    .report-chart-container {
        flex-direction: column;
        gap: 15px;
    }
    
    .report-chart-half {
        width: 100%;
    }
}
input[type="range"]:focus {
    box-shadow: 0 0 0 3px rgba(136, 216, 163, 0.2);
}

.skip-link {
    position: absolute;
    top: -40px;
    left: 6px;
    background: #000;
    color: #fff;
    padding: 8px;
    text-decoration: none;
    z-index: 100;
}

.skip-link:focus {
    top: 6px;
}

/* Print Styles */
@media print {
    body {
        background: white;
    }
    
    .container {
        box-shadow: none;
        margin: 0;
        padding: 0;
    }
    
    .progress-container, .btn {
        display: none;
    }
    
    .step-content {
        display: block !important;
    }
}

/* PANAS Matrix Styles */
.panas-matrix {
    margin: 2rem 0;
    overflow-x: auto;
}

.matrix-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    font-size: 0.9rem;
}

.matrix-table thead th {
    background: linear-gradient(135deg, #a8e6cf 0%, #88d8a3 100%);
    color: white;
    padding: 1rem 0.5rem;
    text-align: center;
    font-weight: 600;
    border: none;
}

.matrix-table thead th:first-child {
    text-align: left;
    padding-left: 1rem;
}

.matrix-table tbody td {
    padding: 0.8rem 0.5rem;
    text-align: center;
    border-bottom: 1px solid #e0e0e0;
    vertical-align: middle;
}

.matrix-table tbody td:first-child {
    text-align: left;
    padding-left: 1rem;
    font-weight: 500;
    background-color: #f8f9fa;
}

.matrix-table tbody tr:nth-child(even) {
    background-color: #f8f9fa;
}

.matrix-table tbody tr:hover {
    background-color: #e3f2fd;
    transition: background-color 0.2s ease;
}

.scale-column {
    min-width: 60px;
}

.scale-column input[type="radio"] {
    margin: 0;
    transform: scale(1.2);
    accent-color: #88d8a3;
}

.matrix-table small {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.8);
}

@media (max-width: 768px) {
    .panas-matrix {
        font-size: 0.8rem;
    }
    
    .matrix-table thead th,
    .matrix-table tbody td {
        padding: 0.6rem 0.3rem;
    }
    
    .matrix-table thead th:first-child,
    .matrix-table tbody td:first-child {
        padding-left: 0.5rem;
    }
    
    .scale-column {
        min-width: 45px;
    }
    
    .scale-column input[type="radio"] {
        transform: scale(1);
    }
}
