/* static/css/survey.css */
/* 問卷系統樣式表 - 參考 quiz.css 風格 */

/* ============================================
   通用樣式
   ============================================ */

.survey-container {
    max-width: 900px;
    margin: 0 auto;
    padding: 20px;
}

/* ============================================
   問卷卡片
   ============================================ */

.survey-card {
    transition: box-shadow 0.2s, border-color 0.2s;
    border-left: 4px solid #0d6efd;
    background: white;
    border-radius: 4px;
    padding: 15px 18px;
    margin-bottom: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.survey-card:hover {
    border-color: #007bff;
    box-shadow: 0 0 10px rgba(0, 123, 255, 0.15);
}

.survey-card.draft {
    border-left-color: #6c757d;
}

.survey-card.active {
    border-left-color: #198754;
}

.survey-card.closed {
    border-left-color: #dc3545;
}

/* ============================================
   題目卡片
   ============================================ */

.question-card {
    background: white;
    border-radius: 8px;
    padding: 25px;
    margin-bottom: 20px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: all 0.3s;
}

.question-card:hover {
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.question-number {
    display: inline-block;
    width: 36px;
    height: 36px;
    line-height: 36px;
    text-align: center;
    background: #0d6efd;
    color: white;
    border-radius: 50%;
    font-weight: bold;
    margin-right: 12px;
    font-size: 1.1rem;
}

.question-required {
    color: #dc3545;
    font-weight: bold;
    margin-left: 5px;
}

/* ============================================
   題目類型標籤
   ============================================ */

.question-type-badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.type-single_choice {
    background-color: #0d6efd;
    color: white;
}

.type-multiple_choice {
    background-color: #6610f2;
    color: white;
}

.type-text_short, .type-text_long {
    background-color: #198754;
    color: white;
}

.type-rating_scale, .type-likert_scale {
    background-color: #fd7e14;
    color: white;
}

.type-matrix {
    background-color: #d63384;
    color: white;
}

.type-ranking {
    background-color: #20c997;
    color: white;
}

.type-date, .type-time {
    background-color: #6c757d;
    color: white;
}

/* ============================================
   選項樣式
   ============================================ */

.option-item {
    padding: 15px;
    margin: 10px 0;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
    background: white;
}

.option-item:hover {
    border-color: #0d6efd;
    background: #f8f9fa;
}

.option-item.selected {
    border-color: #0d6efd;
    background: #e7f1ff;
}

.option-label {
    display: inline-block;
    width: 30px;
    height: 30px;
    line-height: 30px;
    text-align: center;
    background: #e9ecef;
    border-radius: 50%;
    margin-right: 12px;
    font-weight: bold;
    transition: all 0.3s;
}

.option-item.selected .option-label {
    background: #0d6efd;
    color: white;
}

/* 多選題的複選框樣式 */
.checkbox-label {
    display: inline-block;
    width: 24px;
    height: 24px;
    line-height: 24px;
    text-align: center;
    background: #e9ecef;
    border: 2px solid #dee2e6;
    border-radius: 4px;
    margin-right: 12px;
    transition: all 0.3s;
}

.option-item.selected .checkbox-label {
    background: #0d6efd;
    border-color: #0d6efd;
    color: white;
}

.checkbox-label::after {
    content: '✓';
    display: none;
}

.option-item.selected .checkbox-label::after {
    display: inline;
}

/* ============================================
   評分量表樣式
   ============================================ */

.rating-scale {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    margin: 20px 0;
}

.rating-item {
    flex: 1;
    text-align: center;
    cursor: pointer;
}

.rating-circle {
    width: 50px;
    height: 50px;
    line-height: 50px;
    text-align: center;
    border-radius: 50%;
    background: #e9ecef;
    border: 2px solid #dee2e6;
    font-weight: bold;
    font-size: 1.2rem;
    margin: 0 auto 8px;
    transition: all 0.3s;
}

.rating-item:hover .rating-circle {
    border-color: #0d6efd;
    background: #f8f9fa;
}

.rating-item.selected .rating-circle {
    background: #0d6efd;
    border-color: #0d6efd;
    color: white;
}

.rating-label {
    font-size: 0.875rem;
    color: #6c757d;
}

/* ============================================
   文字輸入框樣式
   ============================================ */

.text-input {
    width: 100%;
    padding: 12px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.3s;
}

.text-input:focus {
    border-color: #0d6efd;
    outline: none;
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25);
}

.text-input.error {
    border-color: #dc3545;
}

.text-input-short {
    height: 45px;
}

.text-input-long {
    min-height: 120px;
    resize: vertical;
}

/* ============================================
   矩陣題樣式
   ============================================ */

.matrix-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin: 20px 0;
}

.matrix-table th,
.matrix-table td {
    padding: 12px;
    text-align: center;
    border: 1px solid #dee2e6;
}

.matrix-table th {
    background: #f8f9fa;
    font-weight: 600;
}

.matrix-table td {
    background: white;
}

.matrix-radio {
    width: 24px;
    height: 24px;
    cursor: pointer;
}

/* ============================================
   進度條樣式
   ============================================ */

.progress-container {
    position: sticky;
    top: 0;
    z-index: 100;
    background: white;
    padding: 15px 0;
    margin-bottom: 20px;
    border-bottom: 2px solid #e9ecef;
}

.progress-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    font-size: 0.875rem;
    color: #6c757d;
}

.progress-bar-wrapper {
    width: 100%;
    height: 12px;
    background: #e9ecef;
    border-radius: 6px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #0d6efd, #0dcaf0);
    border-radius: 6px;
    transition: width 0.5s ease;
}

/* ============================================
   計時器樣式
   ============================================ */

.timer {
    font-size: 1.5rem;
    font-weight: bold;
    color: #0d6efd;
    display: flex;
    align-items: center;
    gap: 8px;
}

.timer.warning {
    color: #ffc107;
    animation: pulse 1s infinite;
}

.timer.danger {
    color: #dc3545;
    animation: pulse 0.5s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* ============================================
   問卷標題區域
   ============================================ */

.survey-header {
    background: white;
    border-radius: 8px;
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.survey-title {
    font-size: 2rem;
    font-weight: bold;
    color: #212529;
    margin-bottom: 15px;
}

.survey-description {
    font-size: 1.1rem;
    color: #6c757d;
    line-height: 1.6;
}

.survey-meta {
    display: flex;
    gap: 20px;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #e9ecef;
}

.meta-item {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #6c757d;
    font-size: 0.95rem;
}

.meta-item i {
    font-size: 1.2rem;
}

/* ============================================
   提交區域
   ============================================ */

.submit-section {
    background: white;
    border-radius: 8px;
    padding: 30px;
    margin-top: 40px;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.submit-section .btn {
    min-width: 200px;
    padding: 12px 30px;
    font-size: 1.1rem;
}

/* ============================================
   統計結果樣式
   ============================================ */

.stats-overview {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stats-card {
    background: white;
    border-radius: 8px;
    padding: 25px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    text-align: center;
    transition: all 0.3s;
}

.stats-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transform: translateY(-4px);
}

.stats-value {
    font-size: 2.5rem;
    font-weight: bold;
    color: #0d6efd;
    margin-bottom: 10px;
}

.stats-label {
    font-size: 1rem;
    color: #6c757d;
}

.chart-container {
    background: white;
    border-radius: 8px;
    padding: 25px;
    margin-bottom: 30px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.chart-title {
    font-size: 1.2rem;
    font-weight: bold;
    color: #212529;
    margin-bottom: 20px;
}

/* 長條圖樣式 */
.bar-chart {
    margin: 20px 0;
}

.bar-item {
    margin-bottom: 15px;
}

.bar-label {
    display: flex;
    justify-content: space-between;
    margin-bottom: 5px;
    font-size: 0.95rem;
}

.bar-value {
    font-weight: bold;
    color: #0d6efd;
}

.bar-track {
    height: 30px;
    background: #e9ecef;
    border-radius: 4px;
    overflow: hidden;
}

.bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #0d6efd, #0dcaf0);
    border-radius: 4px;
    display: flex;
    align-items: center;
    padding: 0 10px;
    color: white;
    font-weight: bold;
    transition: width 0.5s ease;
}

/* ============================================
   狀態標籤
   ============================================ */

.status-badge {
    display: inline-block;
    padding: 0.35rem 0.65rem;
    border-radius: 0.25rem;
    font-size: 0.875rem;
    font-weight: 600;
}

.status-draft {
    background-color: #6c757d;
    color: white;
}

.status-active {
    background-color: #198754;
    color: white;
}

.status-paused {
    background-color: #ffc107;
    color: #000;
}

.status-closed {
    background-color: #dc3545;
    color: white;
}

/* ============================================
   空狀態樣式
   ============================================ */

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #6c757d;
}

.empty-state i {
    font-size: 4rem;
    margin-bottom: 20px;
    opacity: 0.3;
}

.empty-state h4 {
    margin-bottom: 15px;
}

.empty-state p {
    margin-bottom: 25px;
}

/* ============================================
   載入動畫（已移至全域 uedu.css）
   ============================================ */

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.loading-content {
    background: white;
    padding: 30px;
    border-radius: 8px;
    text-align: center;
}

/* ============================================
   響應式設計
   ============================================ */

@media (max-width: 768px) {
    .survey-container {
        padding: 10px;
    }

    .question-card {
        padding: 15px;
    }

    .survey-header {
        padding: 20px;
    }

    .survey-title {
        font-size: 1.5rem;
    }

    .rating-scale {
        flex-wrap: wrap;
    }

    .rating-circle {
        width: 40px;
        height: 40px;
        line-height: 40px;
        font-size: 1rem;
    }

    .stats-overview {
        grid-template-columns: 1fr;
    }

    .timer {
        font-size: 1.2rem;
    }
}

/* ============================================
   列印樣式
   ============================================ */

@media print {
    .survey-header,
    .question-card {
        box-shadow: none;
        border: 1px solid #dee2e6;
    }

    .submit-section,
    .progress-container {
        display: none;
    }
}
