/* Main CSS for Megacare Lite */

:root {
    /* Default Light Theme Colors */
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --secondary: #64748b;
    --success: #22c55e;
    --danger: #ef4444;
    --warning: #f59e0b;
    --info: #3b82f6;
    
    /* Layout - Compact */
    --sidebar-width: 160px;
    --sidebar-collapsed-width: 60px;
    --topbar-height: 48px;
    
    /* Colors */
    --bg-primary: #f8fafc;
    --bg-secondary: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
    
    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);
    
    /* Transitions */
    --transition-fast: 0.15s ease;
    --transition: 0.3s ease;
}

/* Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
}

/* App Container */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    z-index: 1000;
    transition: transform var(--transition);
    opacity: 1;
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: var(--topbar-height);
    padding: 0 1rem;
    border-bottom: 1px solid var(--border-color);
}

.sidebar .logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1rem;
    font-weight: 700;
    color: var(--primary);
}

.sidebar .logo i {
    font-size: 1.25rem;
}

.sidebar-toggle {
    background: none;
    border: none;
    font-size: 1.25rem;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.25rem;
}

.sidebar-nav {
    flex: 1;
    padding: 0.5rem 0;
    overflow-y: auto;
}

.nav-list {
    list-style: none;
}

.nav-item {
    margin-bottom: 0.125rem;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.375rem 0.5rem;
    color: var(--text-secondary);
    text-decoration: none;
    transition: all var(--transition-fast);
    border-left: 3px solid transparent;
    font-size: 0.875rem;
}

.nav-link:hover {
    background: var(--bg-primary);
    color: var(--primary);
}

.nav-link.active {
    background: linear-gradient(90deg, rgba(99, 102, 241, 0.1), transparent);
    color: var(--primary);
    border-left-color: var(--primary);
    font-weight: 500;
}

.nav-link i {
    font-size: 1rem;
    width: 1.25rem;
    text-align: center;
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Top Bar */
.topbar {
    position: sticky;
    top: 0;
    height: var(--topbar-height);
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    z-index: 100;
    opacity: 1;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.btn-menu {
    background: none;
    border: none;
    font-size: 1.25rem;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.25rem;
}

.page-title {
    font-size: 1rem;
    font-weight: 600;
    margin: 0;
}

.topbar-center {
    display: flex;
    align-items: center;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.filters-wrapper {
    display: flex;
    gap: 0.5rem;
}

.filters-wrapper .form-select {
    min-width: 110px;
    font-size: 0.8125rem;
    padding: 0.25rem 1.75rem 0.25rem 0.5rem;
}

/* Theme Toggle Button */
.btn-theme-toggle {
    background: none;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-theme-toggle:hover {
    background: var(--bg-primary);
    color: var(--warning);
}

/* User Menu */
.user-menu .btn-user {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    padding: 0.25rem 0.5rem 0.25rem 0.25rem;
    border-radius: 2rem;
    transition: all var(--transition-fast);
}

.user-menu .btn-user:hover {
    border-color: var(--primary);
}

.user-menu .btn-user::after {
    display: none;
}

.user-avatar-wrapper {
    position: relative;
    width: 28px;
    height: 28px;
}

.user-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
    position: absolute;
    top: 0;
    left: 0;
}

.user-initials {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.user-name {
    font-size: 0.8125rem;
    font-weight: 500;
    max-width: 100px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--text-primary);
}

.user-chevron {
    font-size: 0.625rem;
    color: var(--text-secondary);
}

/* Mobile Filters */
.mobile-filters {
    padding: 0.5rem 0.75rem;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
}

.mobile-filters .filters-wrapper {
    flex-wrap: wrap;
}

.mobile-filters .form-select {
    flex: 1;
    min-width: 90px;
}

/* Content Area */
.content-area {
    flex: 1;
    padding: 1rem;
}

/* Loading Spinner */
.loading-spinner {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 300px;
}

/* Sidebar Overlay (Mobile) */
.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition);
}

.sidebar-overlay.show {
    opacity: 1;
    visibility: visible;
}

/* View Container */
.view-container {
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.view-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1rem;
}

.view-title {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.view-title h2 {
    font-size: 1.5rem;
    font-weight: 600;
    margin: 0;
}

.view-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

/* Search Box */
.search-box {
    position: relative;
}

.search-box i {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
}

.search-box input {
    padding-left: 2.25rem;
    min-width: 200px;
}

/* Tables */
.table-responsive {
    background: var(--bg-secondary);
    border-radius: 0.75rem;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
}

.table {
    background: var(--bg-secondary);
    border-radius: 0.5rem;
    overflow: hidden;
    margin-bottom: 0;
    color: var(--text-primary);
}

.table thead {
    background: var(--bg-primary);
}

.table thead th {
    font-weight: 600;
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.75rem 1rem;
    border-bottom: 2px solid var(--border-color);
    background: var(--bg-primary);
}

.table tbody td {
    padding: 0.625rem 1rem;
    vertical-align: middle;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-color);
}

.table tbody tr {
    background: var(--bg-secondary);
}

.table-hover tbody tr:hover {
    background: var(--bg-primary);
}

/* Attendance Table */
.attendance-table {
    font-size: 0.875rem;
}

.attendance-table th,
.attendance-table td {
    text-align: center;
    padding: 0.5rem;
}

.attendance-table .student-name {
    text-align: left;
    white-space: nowrap;
}

.attendance-input {
    width: 40px;
    text-align: center;
    padding: 0.25rem;
    border: 1px solid var(--border-color);
    border-radius: 0.25rem;
    font-size: 0.875rem;
}

.attendance-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}

/* Pagination */
.pagination-wrapper {
    display: flex;
    justify-content: center;
    margin-top: 1.5rem;
}

.pagination {
    gap: 0.25rem;
}

.page-link {
    border-radius: 0.375rem;
    padding: 0.5rem 0.875rem;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
}

.page-link:hover {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

.page-item.active .page-link {
    background: var(--primary);
    border-color: var(--primary);
}

/* Remarks List */
.remarks-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.remark-card {
    background: var(--bg-secondary);
    border-radius: 0.5rem;
    padding: 1rem;
    box-shadow: var(--shadow);
}

.remark-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.5rem;
}

.remark-student {
    font-weight: 600;
}

.remark-type {
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
    border-radius: 1rem;
}

.remark-type.positive {
    background: rgba(34, 197, 94, 0.1);
    color: var(--success);
}

.remark-type.negative {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
}

.remark-type.general {
    background: rgba(100, 116, 139, 0.1);
    color: var(--secondary);
}

.remark-content {
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.remark-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

/* Action Buttons */
.btn-action {
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
}

.action-buttons {
    display: flex;
    gap: 0.25rem;
}

/* Error Page */
.error-page {
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 2rem;
}

.error-content h1 {
    font-size: 6rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 0.5rem;
}

.error-content h2 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
}

.error-content p {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

/* Responsive */
@media (max-width: 991.98px) {
    .sidebar {
        transform: translateX(-100%);
    }
    
    .sidebar.show {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
    }
}

@media (max-width: 767.98px) {
    .view-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .view-actions {
        width: 100%;
        flex-wrap: wrap;
    }
    
    .search-box {
        width: 100%;
    }
    
    .search-box input {
        width: 100%;
        min-width: 0;
    }
}
