/**
 * School Grade Portal - Modern CSS Styles
 * 
 * @author Siam Thanat Hack Co., Ltd. (STH)
 * @description Modern responsive CSS for Thai school portal
 */

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

:root {
    --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --secondary-gradient: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    --success-color: #28a745;
    --error-color: #dc3545;
    --warning-color: #ffc107;
    --info-color: #17a2b8;
    --light-bg: #f8f9fa;
    --dark-bg: #333;
    --text-primary: #333;
    --text-secondary: #666;
    --text-muted: #888;
    --border-color: #e1e5e9;
    --shadow-light: 0 5px 15px rgba(0,0,0,0.1);
    --shadow-heavy: 0 20px 40px rgba(0,0,0,0.1);
    --border-radius: 10px;
    --border-radius-lg: 15px;
    --transition: all 0.3s ease;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--primary-gradient);
    min-height: 100vh;
    line-height: 1.6;
    color: var(--text-primary);
}

/* Loading States */
.loading {
    opacity: 0.6;
    pointer-events: none;
    position: relative;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Container Styles */
.container {
    max-width: 1200px;
    margin: 0 auto;
    background: white;
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-heavy);
    overflow: hidden;
    animation: fadeInUp 0.6s ease-out;
}

.login-container {
    max-width: 400px;
    margin: 0 auto;
    background: white;
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-heavy);
    overflow: hidden;
    animation: fadeInUp 0.6s ease-out;
}

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

/* Header Styles */
.header {
    background: var(--secondary-gradient);
    color: white;
    padding: 30px;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.header::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
    animation: float 6s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-20px); }
}

.header h1 {
    font-size: 2.5em;
    margin-bottom: 10px;
    position: relative;
    z-index: 1;
}

.header p {
    font-size: 1.2em;
    opacity: 0.9;
    position: relative;
    z-index: 1;
}

.login-header {
    background: var(--secondary-gradient);
    color: white;
    padding: 30px;
    text-align: center;
}

.login-header h1 {
    font-size: 1.8em;
    margin-bottom: 10px;
}

/* Dashboard Header */
.dashboard-header {
    background: var(--secondary-gradient);
    color: white;
    padding: 20px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.dashboard-header h1 {
    font-size: 1.8em;
}

/* Button Styles */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 25px;
    font-size: 1em;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    transition: var(--transition);
    font-weight: 500;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255,255,255,0.2);
    border-radius: 50%;
    transition: width 0.6s, height 0.6s;
    transform: translate(-50%, -50%);
}

.btn:hover::before {
    width: 300px;
    height: 300px;
}

.btn-primary {
    background: var(--primary-gradient);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-light);
}

.btn-secondary {
    background: rgba(255,255,255,0.2);
    color: white;
    border: 1px solid rgba(255,255,255,0.3);
}

.btn-secondary:hover {
    background: rgba(255,255,255,0.3);
}

.btn-full {
    width: 100%;
}

/* Form Styles */
.form-group {
    margin-bottom: 20px;
    position: relative;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-primary);
    font-weight: 500;
    transition: var(--transition);
}

.form-control {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 1em;
    transition: var(--transition);
    background: white;
}

.form-control:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
    transform: translateY(-1px);
}

.form-control:focus + label {
    color: #667eea;
}

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

/* Card Styles */
.card {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-light);
    padding: 20px;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
    transition: left 0.5s;
}

.card:hover::before {
    left: 100%;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 30px rgba(0,0,0,0.15);
}

.teacher-card {
    text-align: center;
}

.teacher-photo {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: var(--primary-gradient);
    margin: 0 auto 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 24px;
    font-weight: bold;
    position: relative;
    overflow: hidden;
}

.teacher-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.teacher-photo::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.3) 0%, transparent 70%);
    animation: rotate 4s linear infinite;
}

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

.teacher-name {
    font-size: 1.3em;
    font-weight: bold;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.teacher-line {
    color: var(--text-secondary);
    margin-bottom: 10px;
}

.teacher-motto {
    font-style: italic;
    color: var(--text-muted);
    font-size: 0.9em;
    line-height: 1.4;
}

/* Profile Styles */
.teacher-profile {
    background: var(--light-bg);
    border-radius: var(--border-radius);
    padding: 25px;
    margin-bottom: 25px;
    border: 1px solid #e9ecef;
}

.profile-header {
    display: flex;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 20px;
}

.profile-info h2 {
    color: var(--text-primary);
    margin-bottom: 5px;
}

.profile-info p {
    color: var(--text-secondary);
    margin-bottom: 3px;
}

/* Admin Section */
.admin-section {
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    border-radius: var(--border-radius);
    padding: 20px;
    margin-top: 20px;
}

.admin-section h3 {
    color: #856404;
    margin-bottom: 15px;
}

.file-form {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.file-form input {
    flex: 1;
    min-width: 200px;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 5px;
}

.file-form button {
    background: #667eea;
    color: white;
    padding: 8px 16px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: var(--transition);
}

.file-form button:hover {
    background: #5a6fd8;
    transform: translateY(-1px);
}

.file-content {
    background: var(--light-bg);
    border: 1px solid #ddd;
    border-radius: 5px;
    padding: 15px;
    white-space: pre-wrap;
    font-family: 'Courier New', monospace;
    max-height: 400px;
    overflow-y: auto;
    font-size: 0.9em;
    line-height: 1.4;
}

/* Message Styles */
.message {
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    position: relative;
    animation: slideInDown 0.5s ease-out;
}

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

.error-message {
    background: #fee;
    color: #c33;
    border-left: 4px solid var(--error-color);
}

.success-message {
    background: #efe;
    color: #3c3;
    border-left: 4px solid var(--success-color);
}

.warning-message {
    background: #fff3cd;
    color: #856404;
    border-left: 4px solid var(--warning-color);
}

/* Section Styles */
.login-section {
    background: var(--light-bg);
    padding: 30px;
    text-align: center;
    border-top: 1px solid #eee;
}

.login-section h2 {
    color: var(--text-primary);
    margin-bottom: 15px;
}

.login-form {
    padding: 30px;
}

.dashboard-content {
    padding: 30px;
}

/* Footer */
.footer {
    background: var(--dark-bg);
    color: white;
    text-align: center;
    padding: 20px;
    font-size: 0.9em;
}

/* Utility Classes */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 1rem; }
.mt-4 { margin-top: 1.5rem; }
.mt-5 { margin-top: 3rem; }

.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 1rem; }
.mb-4 { margin-bottom: 1.5rem; }
.mb-5 { margin-bottom: 3rem; }

.p-1 { padding: 0.25rem; }
.p-2 { padding: 0.5rem; }
.p-3 { padding: 1rem; }
.p-4 { padding: 1.5rem; }
.p-5 { padding: 3rem; }

/* Responsive Design */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }
    
    .container {
        margin: 0;
        border-radius: 0;
    }
    
    .login-container {
        margin: 0;
        border-radius: 0;
    }
    
    .header {
        padding: 20px;
    }
    
    .header h1 {
        font-size: 2em;
    }
    
    .teachers-grid {
        grid-template-columns: 1fr;
        padding: 20px;
        gap: 15px;
    }
    
    .dashboard-header {
        flex-direction: column;
        text-align: center;
    }
    
    .profile-header {
        flex-direction: column;
        text-align: center;
    }
    
    .file-form {
        flex-direction: column;
    }
    
    .file-form input {
        min-width: auto;
    }
}

@media (max-width: 480px) {
    .header h1 {
        font-size: 1.5em;
    }
    
    .login-header h1 {
        font-size: 1.5em;
    }
    
    .dashboard-content {
        padding: 20px;
    }
    
    .login-form {
        padding: 20px;
    }
    
    .teacher-photo {
        width: 60px;
        height: 60px;
        font-size: 18px;
    }
}

/* Print Styles */
@media print {
    body {
        background: white;
        color: black;
    }
    
    .header {
        background: none;
        color: black;
    }
    
    .btn {
        display: none;
    }
    
    .admin-section {
        background: none;
        border: 1px solid #ccc;
    }
}
/* Addition
al Form Validation Styles */
.form-control.error {
    border-color: var(--error-color);
    box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.1);
}

.field-error {
    color: var(--error-color);
    font-size: 0.875em;
    margin-top: 5px;
    display: block;
    animation: slideInDown 0.3s ease-out;
}

/* Message Close Button */
.message {
    position: relative;
}

.message-close {
    position: absolute;
    top: 10px;
    right: 15px;
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.3s ease;
    color: inherit;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.message-close:hover {
    opacity: 1;
    background: rgba(0,0,0,0.1);
}

/* Notification Styles */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 15px 20px;
    border-radius: 8px;
    color: white;
    font-weight: 500;
    z-index: 1000;
    transform: translateX(100%);
    transition: transform 0.3s ease;
    max-width: 300px;
    box-shadow: var(--shadow-light);
}

.notification.show {
    transform: translateX(0);
}

.notification-success {
    background: var(--success-color);
}

.notification-error {
    background: var(--error-color);
}

.notification-warning {
    background: var(--warning-color);
    color: #333;
}

.notification-info {
    background: var(--info-color);
}

/* Enhanced Button Loading State */
.btn.loading {
    pointer-events: none;
    opacity: 0.7;
    position: relative;
}

.btn.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 16px;
    height: 16px;
    margin: -8px 0 0 -8px;
    border: 2px solid transparent;
    border-top: 2px solid currentColor;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* Focus Management */
.form-control:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
    transform: translateY(-1px);
}

.form-group.focused label {
    color: #667eea;
    transform: translateY(-2px);
    transition: var(--transition);
}

/* Mobile-specific enhancements */
@media (max-width: 768px) {
    .notification {
        top: 10px;
        right: 10px;
        left: 10px;
        max-width: none;
        transform: translateY(-100%);
    }
    
    .notification.show {
        transform: translateY(0);
    }
    
    .message-close {
        top: 8px;
        right: 12px;
        font-size: 18px;
    }
}
/* Im
age Optimization and Loading States */
.teacher-photo img {
    transition: opacity 0.3s ease;
    opacity: 0;
}

.teacher-photo img.loaded {
    opacity: 1;
}

.teacher-photo.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top: 2px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* Lazy loading support */
.teacher-photo img[loading="lazy"] {
    opacity: 0;
    transition: opacity 0.3s ease;
}

.teacher-photo img[loading="lazy"].loaded {
    opacity: 1;
}

/* Image error handling */
.teacher-photo .image-error {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    background: var(--primary-gradient);
    color: white;
    font-size: 24px;
    font-weight: bold;
    border-radius: 50%;
}

/* High DPI image support */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .teacher-photo img {
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
    }
}/* Progr
essive image loading */
.teacher-photo img {
    filter: blur(5px);
    transition: filter 0.3s ease, opacity 0.3s ease;
}

.teacher-photo img.loaded {
    filter: blur(0);
}

/* Image aspect ratio preservation */
.teacher-photo {
    aspect-ratio: 1;
}

/* WebP support detection */
.webp .teacher-photo img[data-webp] {
    content: attr(data-webp);
}

/* Responsive images */
@media (max-width: 480px) {
    .teacher-photo {
        width: 60px;
        height: 60px;
        font-size: 18px;
    }
}

@media (min-width: 1200px) {
    .teacher-photo {
        width: 100px;
        height: 100px;
        font-size: 28px;
    }
}
/*
 Thai Language and Cultural Elements */
.school-motto {
    margin-top: 10px;
    padding: 10px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: var(--border-radius);
    font-size: 0.9em;
    color: rgba(255, 255, 255, 0.9);
}

.thai-footer {
    font-size: 0.85em;
    color: rgba(255, 255, 255, 0.8);
    margin-top: 5px;
}

.contact-info {
    font-size: 0.8em;
    color: rgba(255, 255, 255, 0.7);
    margin-top: 3px;
}

.footer-content {
    text-align: center;
}

.footer-content p {
    margin: 2px 0;
}

.login-subtitle {
    margin-top: 8px;
    font-size: 0.9em;
    color: rgba(255, 255, 255, 0.8);
}

.login-note {
    font-size: 0.85em;
    color: var(--text-secondary);
    margin-top: 5px;
}

.login-help {
    margin-top: 20px;
    padding: 15px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: var(--border-radius);
    text-align: center;
}

.help-text {
    font-size: 0.8em;
    color: rgba(255, 255, 255, 0.7);
    margin: 3px 0;
}

.welcome-text {
    font-size: 0.9em;
    color: rgba(255, 255, 255, 0.9);
    margin-right: 15px;
}

.header-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
}

.admin-note {
    font-size: 0.85em;
    color: var(--warning-color);
    margin-top: 5px;
}

.system-info {
    font-size: 0.75em;
    color: rgba(255, 255, 255, 0.6);
    margin-top: 3px;
}

.file-content pre {
    background: #f8f9fa;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 15px;
    margin-top: 10px;
    white-space: pre-wrap;
    word-wrap: break-word;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
    line-height: 1.4;
    max-height: 400px;
    overflow-y: auto;
}

/* Enhanced Thai Typography */
body {
    font-family: 'Segoe UI', 'Leelawadee UI', 'Tahoma', 'Noto Sans Thai', sans-serif;
}

h1, h2, h3, h4, h5, h6 {
    font-family: 'Segoe UI', 'Leelawadee UI', 'Tahoma', 'Noto Sans Thai', sans-serif;
}

/* Responsive adjustments for Thai content */
@media (max-width: 768px) {
    .header-actions {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }
    
    .welcome-text {
        margin-right: 0;
        margin-bottom: 10px;
    }
    
    .school-motto {
        font-size: 0.8em;
        padding: 8px;
    }
    
    .thai-footer {
        font-size: 0.8em;
    }
    
    .contact-info {
        font-size: 0.75em;
    }
}

/* Enhanced form styling for Thai content */
.form-control {
    font-family: 'Segoe UI', 'Leelawadee UI', 'Tahoma', 'Noto Sans Thai', sans-serif;
}

input[type="text"], input[type="password"], textarea {
    font-family: 'Segoe UI', 'Leelawadee UI', 'Tahoma', 'Noto Sans Thai', sans-serif;
}

/* Cultural color enhancements */
.teacher-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-heavy);
}

.profile-motto {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
    border-left: 4px solid var(--primary-gradient);
    padding: 15px;
    margin-top: 20px;
    border-radius: var(--border-radius);
}

.profile-motto h3 {
    color: var(--text-primary);
    margin-bottom: 10px;
    font-size: 1.1em;
}

.profile-motto p {
    font-style: italic;
    color: var(--text-secondary);
    line-height: 1.5;
}