/* 全域設定 */
:root {
    --primary-color: #4A90E2;
    --secondary-color: #f5f5f5;
    --text-color: #333;
    --border-color: #ddd;
    --danger-color: #e74c3c;
    --success-color: #2ecc71;
}

body {
    font-family: "Microsoft JhengHei", "Heiti TC", sans-serif;
    margin: 0;
    padding: 0;
    background-color: var(--secondary-color);
    color: var(--text-color);
    line-height: 1.6;
}

.container {
    max-width: 900px;
    margin: 10px auto;
    background: #fff;
    padding: 25px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    border-radius: 12px;
}

h1, h2, h3 { color: var(--primary-color); margin-top: 0; }
a { color: var(--primary-color); text-decoration: none; }
p { 
    margin-top: 5px;
    margin-bottom: 5px;
}

/* 表單與按鈕 */
input[type="text"], input[type="password"], input[type="date"], input[type="email"], select, textarea {
    width: 100%;
    padding: 12px;
    margin: 8px 0;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    box-sizing: border-box;
    font-size: 16px; 
}

input[type="radio"] { transform: scale(1.2); margin-right: 5px; }
label { cursor: pointer; font-size: 1.05rem; margin-right: 15px; display: inline-block; padding: 5px 0; }

.btn {
    display: inline-block;
    padding: 10px 20px;
    background-color: var(--primary-color);
    color: #fff;
    text-decoration: none;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1rem;
    text-align: center;
    transition: background 0.3s;
}
.btn:hover { background-color: #357ABD; }
.btn-danger { background-color: var(--danger-color); }
.btn-secondary { background-color: #95a5a6; }
.btn-block { display: block; width: 100%; margin-top: 10px; }

/* 統一的報表統計標題樣式 (Admin & Teacher 共用) */
.report-section { margin-bottom: 40px; }
.report-header { 
    margin-bottom: 15px; 
    padding: 15px; 
    background: #f9f9f9; 
    border-left: 5px solid var(--primary-color); 
    border-radius: 4px;
    position: relative;
}
.stat-bar { 
    margin-top: 8px; 
    font-size: 1rem; 
    color: #555; 
}

/* 簽名板區域 */
#signature-pad {
    border: 2px dashed #999;
    background-color: #fffaf0;
    cursor: crosshair;
    touch-action: none;
    width: 100%;
    height: 250px;
    border-radius: 8px;
    position: relative;
}
#signature-pad:after {
    content: "請在此區域簽名";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #ccc;
    font-size: 2rem;
    pointer-events: none;
    z-index: 0;
}
canvas { position: relative; z-index: 1; }

/* 唯讀檢視模式 */
.readonly-box {
    border: 2px solid var(--primary-color);
    background-color: #f0f7ff;
    padding: 20px;
    border-radius: 8px;
    margin-top: 20px;
}
.readonly-field { margin-bottom: 0px; border-bottom: 1px dashed #ccc; padding-bottom: 5px; }
.readonly-label { font-weight: bold; color: #555; }
.readonly-value { font-size: 1.1rem; color: #000; }
.signature-img {
    max-width: 150px;
    border: 1px solid #ddd;
    background: #fff;
}

/* 表格樣式 */
table { width: 100%; border-collapse: collapse; margin-top: 10px; }
th, td { padding: 10px; border-bottom: 1px solid var(--border-color); text-align: left; vertical-align: middle; }
th { background-color: #f8f9fa; font-weight: bold; }

.badge { padding: 4px 8px; border-radius: 4px; font-size: 0.9em; font-weight: normal; }
.badge-yes { background-color: #d4edda; color: #155724; }
.badge-no { background-color: #f8d7da; color: #721c24; }

/* Google 按鈕樣式 */
.btn-google {
    background-color: #fff;
    color: #757575;
    border: 1px solid #ddd;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px;
    font-weight: bold;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    transition: background 0.3s;
}
.btn-google:hover { background-color: #f8f8f8; }
.btn-google img { width: 18px; height: 18px; margin-right: 10px; }

/* 手機版 RWD 適配 */
@media (max-width: 600px) {
    .container { margin: 10px; padding: 15px; width: auto; }
    
    table, thead, tbody, th, td, tr { display: block; }
    thead tr { position: absolute; top: -9999px; left: -9999px; }
    tr { border: 1px solid #ccc; margin-bottom: 10px; border-radius: 8px; padding: 10px; box-shadow: 0 2px 4px rgba(0,0,0,0.05); background: #fff; }
    
    td { 
        border: none; 
        border-bottom: 1px solid #eee; 
        position: relative; 
        padding-left: 40%; 
        text-align: right; 
        min-height: 40px;
    }
    
    td:before { 
        position: absolute; 
        left: 10px; 
        width: 35%; 
        padding-right: 10px; 
        white-space: nowrap; 
        text-align: left; 
        font-weight: bold; 
        color: #666;
        content: attr(data-label); 
    }
    
    td:last-child { border-bottom: none; text-align: center; padding-left: 0; padding-top: 15px; }
    td:last-child:before { display: none; }
}

/* 列印樣式 */
@media print {
    .no-print { display: none !important; }
    body, .container { background: #fff; margin: 0; padding: 0; box-shadow: none; max-width: 100%; width: 100%; }
    .page-break { page-break-after: always; }
    .report-header { border-left: 2px solid #000; background: none; padding: 0; margin-bottom: 10px; }
    a { text-decoration: none; color: #000; }
    table { width: 100% !important; display: table !important; }
    thead { display: table-header-group !important; }
    tbody { display: table-row-group !important; }
    tr { display: table-row !important; border: none !important; box-shadow: none !important; }
    th, td { display: table-cell !important; text-align: left !important; padding: 5px !important; border-bottom: 1px solid #000 !important; }
    td:before { content: none !important; }
}