/**
 * Thai Lessons Manager - Modern Clean Theme
 */

:root {
    /* Light Theme */
    --bg-primary: #f8f9fa;
    --bg-secondary: #ffffff;
    --bg-tertiary: #f1f3f5;
    --bg-hover: #e9ecef;
    --text-primary: #212529;
    --text-secondary: #6c757d;
    --text-muted: #adb5bd;
    --accent-primary: #0d6efd;
    --accent-hover: #0b5ed7;
    --accent-light: #cfe2ff;
    --success: #28a745;
    --success-light: #d4edda;
    --warning: #ffc107;
    --warning-light: #fff3cd;
    --error: #dc3545;
    --error-light: #f8d7da;
    --border: #dee2e6;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 4px 16px rgba(0, 0, 0, 0.12);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    font-size: 15px;
}

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

.container-narrow {
    max-width: 600px;
    margin: 0 auto;
    padding: 20px;
}

/* Header */
header {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    margin-bottom: 30px;
    box-shadow: var(--shadow-sm);
}

header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
}

header h1 {
    font-size: 22px;
    font-weight: 600;
    color: var(--accent-primary);
}

header nav {
    display: flex;
    gap: 24px;
    align-items: center;
    flex-wrap: wrap;
}

header nav a {
    color: var(--text-secondary);
    text-decoration: none;
    transition: color 0.2s;
    font-weight: 500;
    font-size: 14px;
    padding: 8px 12px;
    border-radius: 6px;
    transition: all 0.2s;
}

header nav a:hover {
    color: var(--accent-primary);
    background: var(--bg-tertiary);
}

header .user-info {
    color: var(--text-muted);
    font-size: 13px;
    padding: 6px 12px;
    background: var(--bg-tertiary);
    border-radius: 20px;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 10px 20px;
    background: var(--accent-primary);
    color: white;
    text-decoration: none;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
    box-shadow: var(--shadow-sm);
}

.btn:hover {
    background: var(--accent-hover);
    box-shadow: var(--shadow);
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    box-shadow: none;
}

.btn-secondary:hover {
    background: var(--bg-hover);
}

.btn-success {
    background: var(--success);
}

.btn-danger {
    background: var(--error);
}

.btn-small {
    padding: 6px 14px;
    font-size: 13px;
}

/* Forms */
form {
    background: var(--bg-secondary);
    padding: 32px;
    border-radius: 8px;
    box-shadow: var(--shadow);
}

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

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

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 11px 14px;
    background: var(--bg-tertiary);
    border: 2px solid transparent;
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 15px;
    transition: all 0.2s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--accent-primary);
    background: var(--bg-secondary);
    box-shadow: 0 0 0 3px var(--accent-light);
}

.form-group input[readonly] {
    background: var(--bg-primary);
    color: var(--text-secondary);
    cursor: not-allowed;
}

.form-group textarea {
    min-height: 120px;
    resize: vertical;
    font-family: inherit;
}

.form-actions {
    margin-top: 28px;
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

/* Flash Messages */
.flash {
    padding: 14px 18px;
    border-radius: 8px;
    margin-bottom: 24px;
    font-size: 14px;
    border-left: 4px solid;
    box-shadow: var(--shadow-sm);
}

.flash-success {
    background: var(--success-light);
    border-color: var(--success);
    color: #155724;
}

.flash-error {
    background: var(--error-light);
    border-color: var(--error);
    color: #721c24;
}

.flash-warning {
    background: var(--warning-light);
    border-color: var(--warning);
    color: #856404;
}

.flash-info {
    background: var(--accent-light);
    border-color: var(--accent-primary);
    color: #004085;
}

/* Tables */
table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    background: var(--bg-secondary);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: var(--shadow);
}

thead {
    background: var(--bg-tertiary);
}

th {
    padding: 14px 16px;
    text-align: left;
    font-weight: 600;
    font-size: 13px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid var(--border);
}

td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
}

tbody tr:last-child td {
    border-bottom: none;
}

tbody tr:hover {
    background: var(--bg-tertiary);
}

/* Cards */
.card {
    background: var(--bg-secondary);
    padding: 24px;
    border-radius: 8px;
    margin-bottom: 24px;
    box-shadow: var(--shadow);
}

.card-header {
    font-size: 17px;
    font-weight: 600;
    margin-bottom: 18px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--border);
    color: var(--text-primary);
}

/* Tabs */
.tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
    border-bottom: 2px solid var(--border);
}

.tab {
    padding: 12px 24px;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    border-bottom: 3px solid transparent;
    transition: all 0.2s;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: -2px;
}

.tab:hover {
    color: var(--text-primary);
    background: var(--bg-tertiary);
}

.tab.active {
    color: var(--accent-primary);
    border-bottom-color: var(--accent-primary);
}

.tab-content {
    display: none;
}

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

/* Stats */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}

.stat-card {
    background: var(--bg-secondary);
    padding: 24px;
    border-radius: 8px;
    text-align: center;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    transition: all 0.2s;
}

.stat-card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

.stat-value {
    font-size: 36px;
    font-weight: 700;
    color: var(--accent-primary);
    margin-bottom: 8px;
    line-height: 1;
}

.stat-label {
    font-size: 13px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 500;
}

/* Login Page */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.login-box {
    width: 100%;
    max-width: 420px;
    padding: 20px;
}

.login-box h2 {
    text-align: center;
    margin-bottom: 32px;
    font-size: 28px;
    color: white;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.login-box form {
    box-shadow: var(--shadow-lg);
}

/* Page Headings */
h2 {
    font-size: 26px;
    font-weight: 600;
    margin-bottom: 24px;
    color: var(--text-primary);
}

/* Utilities */
.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

.text-muted {
    color: var(--text-muted);
}

.text-success {
    color: var(--success);
    font-weight: 500;
}

.text-error {
    color: var(--error);
    font-weight: 500;
}

.text-warning {
    color: var(--warning);
    font-weight: 500;
}

.mt-1 { margin-top: 12px; }
.mt-2 { margin-top: 20px; }
.mt-3 { margin-top: 32px; }
.mb-1 { margin-bottom: 12px; }
.mb-2 { margin-bottom: 20px; }
.mb-3 { margin-bottom: 32px; }

.hidden {
    display: none;
}

/* Responsive */
@media (max-width: 768px) {
    header .container {
        flex-direction: column;
        gap: 16px;
        text-align: center;
    }

    header nav {
        justify-content: center;
    }

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

    .form-actions {
        flex-direction: column;
    }

    .form-actions .btn {
        width: 100%;
    }
}

/* Student/Payment specific styles */
.student-list {
    max-height: 250px;
    overflow-y: auto;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg-secondary);
    margin-top: 8px;
    box-shadow: var(--shadow);
}

.student-item {
    padding: 12px 16px;
    cursor: pointer;
    border-bottom: 1px solid var(--border);
    transition: background 0.2s;
}

.student-item:hover {
    background: var(--bg-tertiary);
}

.student-item:last-child {
    border-bottom: none;
}

.student-item-name {
    font-weight: 600;
    margin-bottom: 4px;
}

.student-item-email {
    font-size: 13px;
    color: var(--text-secondary);
}

.new-student-toggle {
    margin-top: 12px;
    font-size: 14px;
}

.new-student-toggle a {
    color: var(--accent-primary);
    text-decoration: none;
    font-weight: 500;
}

.new-student-toggle a:hover {
    text-decoration: underline;
}

.new-student-fields {
    display: none;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 2px solid var(--border);
}

.calculated-hours {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 8px;
    font-weight: 500;
}

/* Small text */
small {
    font-size: 13px;
    color: var(--text-secondary);
}

/* Lists */
ul {
    line-height: 1.8;
}

/* Strong text */
strong {
    font-weight: 600;
    color: var(--text-primary);
}
