/* ========================================
   Modern Minimalist Design System
   Teacher Assessment System - PNRU
   ======================================== */

:root {
    --primary-color: #2c3e50;
    --secondary-color: #34495e;
    --accent-color: #3498db;
    --success-color: #27ae60;
    --warning-color: #f39c12;
    --danger-color: #e74c3c;
    --light-bg: #ecf0f1;
    --white: #ffffff;
    --text-dark: #2c3e50;
    --text-light: #7f8c8d;
    --border-color: #bdc3c7;
    --shadow-sm: 0 2px 4px rgba(0,0,0,0.08);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 25px rgba(0,0,0,0.15);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Sarabun', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    color: var(--text-dark);
    line-height: 1.6;
    min-height: 100vh;
}

/* ========================================
   Header Section - Compact Design
   ======================================== */

.header {
    background: linear-gradient(135deg, #2c3e50 0%, #16a085 100%);
    padding: 1rem 2rem;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1); /* เงาด้านล่างนุ่มๆ */
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 1rem;	
}

.logo {
    width: 80px;
    height: 80px;
    object-fit: contain; 
}

.header-text h1 {
    color: var(--white);
    font-size: 1.5rem;
    font-weight: 600;
    margin: 0;
}

.header-text p {
    color: rgba(255,255,255,0.8);
    font-size: 0.875rem;
    margin: 0;
}

/* ========================================
   Container & Layout
   ======================================== */

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
}

.section {
    /* 1. กำหนดพื้นหลัง 2 ชั้น: 
          ชั้นบน = สีขาว (เนื้อหา)
          ชั้นล่าง = สีไล่ระดับ (ขอบ) */
    background: linear-gradient(var(--white), var(--white)) padding-box,
                linear-gradient(135deg, #2c3e50 0%, #16a085 100%) border-box;
    
    /* 2. สั่งให้ขอบใส เพื่อให้มองทะลุเห็นพื้นหลังชั้นล่าง */
    border: 1px solid transparent;
    
    border-radius: 12px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow-sm);
}

.section-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.section-title::before {
    content: '';
    width: 4px;
    height: 24px;
    background: var(--accent-color);
    border-radius: 2px;
}

/* ========================================
   Card System
   ======================================== */

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.card {
    background: var(--white);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 2rem;
    text-align: center;
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--accent-color);
    transform: scaleX(0);
    transition: transform 0.3s ease;
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--accent-color);
}

.card:hover::before {
    transform: scaleX(1);
}

.card-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.9;
}

.card-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 0.5rem;
}

.card-subtitle {
    font-size: 0.875rem;
    color: var(--text-light);
    margin-bottom: 0.75rem;
}

.card-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    background: var(--light-bg);
    color: var(--text-dark);
}

/* Card Colors */
.card-student {
    border-left: 4px solid #3498db;
}

.card-boss {
    border-left: 4px solid #27ae60;

}

.card-coach {
    border-left: 4px solid #3498db;
}

.card-master {
    border-left: 4px solid #f39c12;
}

.card-admin {
    border-left: 4px solid #95a5a6;
}

.card-document {
    border-left: 4px solid #e74c3c;
}

/* ========================================
   Statistics Cards
   ======================================== */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.stat-card {
    background: var(--white);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
    text-align: center;
    transition: all 0.3s ease;
}

.stat-card:hover {
    box-shadow: var(--shadow-md);
}

.stat-icon {
    font-size: 2.5rem;
    margin-bottom: 0.75rem;
}

.stat-number {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 0.25rem;
}

.stat-label {
    font-size: 0.875rem;
    color: var(--text-light);
}

/* ========================================
   Buttons
   ======================================== */

.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    text-decoration: none;
    text-align: center;
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
	margin:2px;
}

.btn-primary {
    background: var(--accent-color);
    color: var(--white);
}

.btn-primary:hover {
    background: #2980b9;
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn-success {
    background: var(--success-color);
    color: var(--white);
}

.btn-success:hover {
    background: #229954;
}

.btn-warning {
    background: var(--warning-color);
    color: var(--white);
}

.btn-warning:hover {
    background: #e67e22;
}

.btn-secondary {
    background: var(--secondary-color);
    color: var(--white);
}

.btn-secondary:hover {
    background: #2c3e50;
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--accent-color);
    color: var(--accent-color);
}

.btn-outline:hover {
    background: var(--accent-color);
    color: var(--white);
}

/* ========================================
   Assessment Criteria Section
   ======================================== */

.criteria-section {
    margin-top: 2rem;
}

.criteria-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.criteria-card {
    background: var(--light-bg);
    border-radius: 8px;
    padding: 1.5rem;
}

.criteria-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--accent-color);
    margin-bottom: 1rem;
}

.criteria-list {
    list-style: none;
    padding-left: 0;
}

.criteria-list li {
    padding: 0.5rem 0;
    padding-left: 1.5rem;
    position: relative;
    font-size: 0.9rem;
    color: var(--text-dark);
}

.criteria-list li::before {
    content: '▪';
    position: absolute;
    left: 0;
    color: var(--accent-color);
    font-weight: bold;
}

/* ========================================
   Footer
   ======================================== */

.footer {
    background: linear-gradient(135deg, #2c3e50 0%, #16a085 100%);
    color: var(--white);
    text-align: center;
    padding: 1.5rem;
    margin-top: 2rem;
    border-radius: 0px;
}

.footer p {
    margin: 0.25rem 0;
    font-size: 0.9rem;
}

/* ========================================
   Responsive Design
   ======================================== */

@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }
    
    .header {
        padding: 0.6rem;
    }
    
    .header-content {
        flex-direction: column;
        width: 100%;
        justify-content: center;
    }
    .logo-container {
        display: flex;
        flex-direction: column; /* เปลี่ยนแนวแกนหลักเป็นแนวตั้ง (โลโก้บน ข้อความล่าง) */
        align-items: center;    /* จัดกึ่งกลางแนวนอน */
        justify-content: center;
        width: 100%;
        gap: 0.2rem;            /* ระยะห่างระหว่างโลโก้กับข้อความ */
    }
	.header-text {
        text-align: center;     /* บังคับให้ข้อความข้างในจัดกึ่งกลาง */
        width: 100%;
    }
    .logo {
        width: 70px;
        height: 70px;		
    }
    
    .header-text h1 {
        font-size: 1.35rem;
    }
    
    .section {
        padding: 1.5rem;
    }
    
    .card-grid,
    .stats-grid,
    .criteria-grid {
        grid-template-columns: 1fr;
    }
}

/* ========================================
   Animation
   ======================================== */

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.card,
.section {
    animation: fadeInUp 0.5s ease;
}

/* ========================================
   Utility Classes
   ======================================== */

.text-center {
    text-align: center;
}

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }

.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }

.p-1 { padding: 0.5rem; }
.p-2 { padding: 1rem; }
.p-3 { padding: 1.5rem; }
.p-4 { padding: 2rem; }
/* ========================================
   Enhanced Mobile Responsive Tables
   ======================================== */

@media (max-width: 768px) {
    /* Responsive Tables */
    .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    table {
        border: 0;
        font-size: 0.9rem;
        min-width: 100%;
    }
    
    table thead {
        display: none;
    }
    
    table tr {
        display: block;
        margin-bottom: 1rem;
        border: 1px solid var(--border-color);
        border-radius: 8px;
        padding: 0.75rem;
        background: var(--white);
        box-shadow: var(--shadow-sm);
    }
    
    table td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 0.5rem 0;
        border-bottom: 1px solid #f0f0f0;
        text-align: right;
        min-height: 40px;
    }
    
    table td:last-child {
        border-bottom: 0;
    }
    
    table td::before {
        content: attr(data-label);
        font-weight: 600;
        text-align: left;
        flex: 1;
        padding-right: 1rem;
        color: var(--text-dark);
        font-size: 0.85rem;
    }
    
    /* ปุ่มในตาราง Mobile */
    table td .btn-sm {
        font-size: 0.75rem;
        padding: 0.3rem 0.6rem;
        margin: 0.2rem;
        white-space: nowrap;
    }
    
    /* Tabs Mobile */
    .tabs {
        flex-wrap: wrap;
        overflow-x: auto;
    }
    
    .tab {
        font-size: 0.85rem;
        padding: 0.75rem 1rem;
        min-width: fit-content;
    }
    
    /* Forms Mobile */
    .form-control,
    .search-box input {
        font-size: 16px !important; /* ป้องกัน zoom ใน iOS */
    }
}

/* ========================================
   Score Column Toggle Feature
   ======================================== */

.score-column {
    display: none;
}

/* สำหรับ Desktop */
@media (min-width: 769px) {
    .score-column.show {
        display: table-cell !important;
    }
}

/* สำหรับ Mobile */
@media (max-width: 768px) {
    .score-column.show {
        display: flex !important;
    }
}

/* Button Styles */
.btn-info {
    background: #17a2b8;
    color: var(--white);
}

.btn-info:hover {
    background: #138496;
}
/* ========================================
   Mobile Form Optimization - Wider Inputs
   ======================================== */

@media (max-width: 768px) {
    /* ปรับ Container ให้ใช้พื้นที่เต็มที่ */
    .container {
        padding: 0.5rem !important;
    }
    
    .section {
        padding: 1rem !important;
        margin-bottom: 1rem;
        border-radius: 8px;
    }
    
    /* ปรับฟอร์มให้กว้างเต็มที่ */
    .form-group {
        margin-bottom: 1rem;
        width: 100%;
    }
    
    .form-group label {
        display: block;
        margin-bottom: 0.5rem;
        font-size: 0.95rem;
        font-weight: 500;
        color: var(--text-dark);
    }
    
    /* ช่อง Input ให้กว้างเต็มที่ */

    .form-control,
    select,
    input[type="text"],
    input[type="email"],
    input[type="tel"],
    input[type="number"],
    textarea {
        width: 100% !important;
        max-width: 100% !important;
        padding: 0.75rem !important;
        font-size: 16px !important;
        border: 1px solid var(--border-color) !important;
        border-radius: 8px !important;
        background: var(--white) !important;
        box-sizing: border-box !important;
    }
    
    /* ปรับ Select Dropdown */
    select {
        appearance: none;
        -webkit-appearance: none;
        -moz-appearance: none;
        background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23333' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
        background-repeat: no-repeat;
        background-position: right 0.75rem center;
        padding-right: 2.5rem !important;
    }
    
    /* ปรับปุ่มส่งฟอร์ม */
    .btn,
    button[type="submit"],
    input[type="submit"] {
        width: 100% !important;
        padding: 1rem !important;
        font-size: 1.1rem !important;
        margin-top: 1rem !important;
        border-radius: 8px !important;
    }
    
    /* Radio และ Checkbox */
    .radio-group,
    .checkbox-group {
        display: flex;
        flex-direction: column;
        gap: 0.75rem;
        margin-top: 0.5rem;
    }
    
    .radio-group label,
    .checkbox-group label {
        display: flex;
        align-items: center;
        gap: 0.5rem;
        padding: 0.75rem;
        background: var(--light-bg);
        border-radius: 8px;
        cursor: pointer;
        font-weight: 400;
    }
    
    input[type="radio"],
    input[type="checkbox"] {
        width: 20px !important;
        height: 20px !important;
        min-width: 20px;
        margin: 0 !important;
    }
    
    /* ปรับการ์ดให้กว้างขึ้น */
    .card {
        margin: 0 0 1rem 0 !important;
        padding: 1.5rem 1rem !important;
    }
    
    /* Alert Messages */
    .alert {
        padding: 1rem;
        margin-bottom: 1rem;
        border-radius: 8px;
        font-size: 0.95rem;
    }
    
    /* ปรับหัวข้อ */
    .section-title {
        font-size: 1.2rem !important;
        margin-bottom: 1rem !important;
    }
    
    /* Fieldset */
    fieldset {
        border: 1px solid var(--border-color);
        border-radius: 8px;
        padding: 1rem;
        margin-bottom: 1rem;
    }
    
    legend {
        font-size: 1rem;
        font-weight: 600;
        color: var(--accent-color);
        padding: 0 0.5rem;
    }
    
    /* Textarea */
    textarea {
        min-height: 100px !important;
        resize: vertical !important;
    }
    
    /* หัวข้อส่วน */
    .form-section-header {
        background: linear-gradient(135deg, #9b59b6 0%, #8e44ad 100%);
        color: white;
        padding: 1rem;
        border-radius: 8px;
        margin-bottom: 1rem;
        text-align: center;
    }
    
    .form-section-header h3 {
        margin: 0;
        font-size: 1.2rem;
    }
    
    /* Warning Box */
    .warning-box,
    .alert-warning {
        padding: 1rem;
        background: #fff3cd;
        border: 1px solid #ffc107;
        border-radius: 8px;
        margin-bottom: 1rem;
        font-size: 0.9rem;
    }
    
    /* Required */
    .required::after {
        content: " *";
        color: var(--danger-color);
        font-weight: bold;
    }
    
    /* Readonly */
    input[readonly],
    select[disabled] {
        background-color: #f5f5f5 !important;
        cursor: not-allowed;
        opacity: 0.7;
    }
}