/* ===== KHMHS Alathiyur Timetable - Styles ===== */
:root {
    --primary: #2563eb;
    --primary-light: #dbeafe;
    --success: #16a34a;
    --warning: #d97706;
    --danger: #dc2626;
    --bg: #f8fafc;
    --bg-card: #ffffff;
    --text: #1e293b;
    --text-light: #64748b;
    --border: #e2e8f0;
    --radius: 10px;
    --shadow: 0 1px 3px rgba(0,0,0,0.08);
    --shadow-lg: 0 4px 12px rgba(0,0,0,0.1);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
}

.app-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 240px;
    background: linear-gradient(135deg, #1e3a5f 0%, #0f172a 100%);
    color: white;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 100;
    transition: transform 0.3s;
}

.sidebar-header {
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-header i { font-size: 24px; color: #60a5fa; }
.sidebar-header h2 { font-size: 16px; font-weight: 700; }
.sidebar-header p { font-size: 11px; opacity: 0.7; margin-top: 2px; }

.sidebar-nav { padding: 12px 0; flex: 1; }

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    color: rgba(255,255,255,0.7);
    text-decoration: none;
    font-size: 14px;
    transition: all 0.2s;
}

.nav-item:hover { background: rgba(255,255,255,0.1); color: white; }
.nav-item.active { background: rgba(96,165,250,0.2); color: #60a5fa; border-left: 3px solid #60a5fa; }
.nav-item i { width: 20px; text-align: center; }

/* Main Content */
.main-content {
    flex: 1;
    margin-left: 240px;
    display: flex;
    flex-direction: column;
}

.top-bar {
    background: var(--bg-card);
    padding: 16px 24px;
    display: flex;
    align-items: center;
    gap: 16px;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 50;
}

.top-bar h1 { font-size: 18px; font-weight: 600; }

.menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: var(--text);
}

.content-area { padding: 24px; flex: 1; }

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

.stat-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: var(--shadow);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.stat-icon.blue { background: var(--primary-light); color: var(--primary); }
.stat-icon.green { background: #dcfce7; color: var(--success); }
.stat-icon.yellow { background: #fef3c7; color: var(--warning); }

.stat-info h3 { font-size: 24px; font-weight: 700; }
.stat-info p { font-size: 13px; color: var(--text-light); }

/* Panel */
.panel {
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 24px;
}

.panel-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
}

.panel-header h2 { font-size: 16px; font-weight: 600; }
.panel-body { padding: 20px; }

/* Search - kept for future use */
.search-container {
    position: relative;
    max-width: 400px;
    margin-bottom: 20px;
}

.search-container input {
    width: 100%;
    padding: 12px 16px 12px 40px;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}

.search-container input:focus { border-color: var(--primary); }
.search-container i { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--text-light); }

/* Class/Teacher List */
.item-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 10px;
}

.item-chip {
    padding: 10px 14px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    text-align: center;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.item-chip:hover { background: var(--primary-light); border-color: var(--primary); color: var(--primary); }
.item-chip.active { background: var(--primary); color: white; border-color: var(--primary); }

/* Timetable Table */
.timetable-container { overflow-x: auto; }

.timetable {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    min-width: 700px;
}

.timetable th, .timetable td {
    border: 1px solid var(--border);
    padding: 10px 8px;
    text-align: center;
    vertical-align: middle;
}

.timetable th {
    background: #1e3a5f;
    color: white;
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
}

.timetable td { min-width: 90px; }

.timetable tr:nth-child(even) { background: #f8fafc; }
.timetable tr:hover { background: #eff6ff; }

.tt-cell {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
}

.tt-subject {
    font-weight: 600;
    color: var(--primary);
    font-size: 12px;
}

.tt-teacher {
    font-size: 11px;
    color: var(--text-light);
}

.tt-class {
    font-size: 11px;
    color: var(--success);
    font-weight: 500;
    background: #dcfce7;
    padding: 1px 5px;
    border-radius: 3px;
    margin: 1px 0;
}

.tt-empty { color: #cbd5e1; font-style: italic; font-size: 11px; }

.day-label {
    font-weight: 700;
    background: #f1f5f9 !important;
    color: var(--text);
    white-space: nowrap;
}

/* Dropdown Select */
.select-row {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.select-row label {
    font-weight: 600;
    font-size: 14px;
    color: var(--text);
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 8px;
}

.dropdown {
    padding: 12px 16px;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 500;
    min-width: 260px;
    outline: none;
    background: white;
    cursor: pointer;
    transition: border-color 0.2s, box-shadow 0.2s;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 36px;
}

.dropdown:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.dropdown:hover { border-color: #94a3b8; }

.teacher-meta {
    display: flex;
    gap: 24px;
    flex-wrap: wrap;
    margin-bottom: 16px;
    padding: 12px 16px;
    background: var(--bg);
    border-radius: 8px;
    font-size: 13px;
    color: var(--text-light);
}

/* Card link */
.card-link { cursor: pointer; transition: transform 0.2s, box-shadow 0.2s; }
.card-link:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }

/* Buttons */
.btn {
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s;
}

.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: #1d4ed8; }
.btn-outline { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn-outline:hover { background: var(--bg); }

/* Footer */
.app-footer {
    text-align: center;
    padding: 12px;
    font-size: 12px;
    color: var(--text-light);
    border-top: 1px solid var(--border);
    margin-left: 240px;
}

/* Mobile */
@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .main-content { margin-left: 0; }
    .app-footer { margin-left: 0; }
    .menu-toggle { display: block; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
    .item-grid { grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)); }
}

@media (max-width: 480px) {
    .stats-grid { grid-template-columns: 1fr; }
    .content-area { padding: 16px; }
}

/* Print */
@media print {
    .sidebar, .top-bar, .menu-toggle, .app-footer, .search-container, .panel-header button { display: none !important; }
    .main-content { margin-left: 0; }
    .timetable { font-size: 11px; }
    .panel { box-shadow: none; border: 1px solid #ddd; }
}

/* Badge periods */
.badge-periods {
    background: var(--primary-light);
    color: var(--primary);
    padding: 3px 10px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 13px;
}

/* Free teacher chips */
.free-list { display: flex; flex-wrap: wrap; gap: 8px; }
.free-chip {
    padding: 6px 12px;
    background: #dcfce7;
    color: #166534;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
}

/* Workload bar */
.bar-bg {
    width: 100%;
    height: 8px;
    background: #e2e8f0;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 2px;
}
.bar-fill { height: 100%; border-radius: 4px; transition: width 0.3s; }
