/* public/css/style.css */

@font-face {
    font-family: 'Sahel';
    src: url('../fonts/Sahel-Regular.eot'); /* IE9 Compat Modes */
    src: url('../fonts/Sahel-Regular.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */
         url('../fonts/Sahel-Regular.woff') format('woff'), /* Modern Browsers */
         url('../fonts/Sahel-Regular.ttf') format('truetype'); /* Safari, Android, iOS */
    font-weight: normal;
    font-style: normal;
}

@font-face {
    font-family: 'Sahel';
    src: url('../fonts/Sahel-Bold.eot'); /* IE9 Compat Modes */
    src: url('../fonts/Sahel-Bold.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */
         url('../fonts/Sahel-Bold.woff') format('woff'), /* Modern Browsers */
         url('../fonts/Sahel-Bold.ttf') format('truetype'); /* Safari, Android, iOS */
    font-weight: bold;
    font-style: normal;
}

/* --- Variables & Base --- */
:root {
    --primary-color: #007bff; /* Blue */
    --primary-hover: #0056b3;
    --secondary-color: #6c757d; /* Gray */
    --success-color: #28a745; /* Green */
    --success-hover: #218838;
    --danger-color: #dc3545; /* Red */
    --danger-hover: #c82333;
    --info-color: #17a2b8;   /* Teal */
    --info-hover: #138496;
    --warning-color: #ffc107; /* Yellow */
    --warning-hover: #e0a800; /* Darker Yellow for hover */
    --light-bg: #f0f2f5; /* Lighter gray for overall background */
    --white-bg: #ffffff;
    --text-color: #343a40;
    --text-muted: #6c757d;
    --border-color: #dee2e6;
    --font-family: 'Sahel', 'Tahoma', 'Vazirmatn', sans-serif; /* Updated Font Family */
    --border-radius: 0.3rem;
    --box-shadow: 0 2px 10px rgba(0, 0, 0, 0.075);
}

body {
    margin: 0;
    padding: 0;
    font-family: var(--font-family); /* Apply the updated font family */
    font-size: 14px;
    direction: rtl;
    background-color: var(--light-bg); /* Use the new light-bg for the whole page */
    color: var(--text-color);
    line-height: 1.6;
}

.container {
    max-width: 1200px; 
    margin: 20px auto;
    padding: 25px; /* Increased padding */
    background-color: var(--white-bg); /* White background for content area */
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
}

/* --- Links --- */
a {
    color: var(--primary-color);
    text-decoration: none; 
    transition: color 0.2s ease;
}
a:hover {
    color: var(--primary-hover);
    text-decoration: underline; 
}

/* --- Buttons --- */
.btn {
    display: inline-block;
    font-weight: 400;
    font-family: var(--font-family); /* Explicitly set font for all buttons */
    color: #fff; 
    text-align: center;
    vertical-align: middle;
    cursor: pointer;
    user-select: none;
    background-color: transparent;
    border: 1px solid transparent;
    padding: 0.5rem 1rem;
    font-size: 0.9rem; /* Slightly reduced base font size for buttons */
    line-height: 1.5;
    border-radius: var(--border-radius);
    transition: color 0.15s ease-in-out, background-color 0.15s ease-in-out, border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out, transform 0.1s ease;
}
.btn:hover, a.btn:hover { /* Ensures no underline on buttons styled as links */
    transform: translateY(-1px);
    text-decoration: none !important; 
}
.btn-primary { background-color: var(--primary-color); border-color: var(--primary-color); color: #fff; }
.btn-primary:hover { background-color: var(--primary-hover); border-color: var(--primary-hover); color: #fff; /* Keep text color */ }
.btn-success { background-color: var(--success-color); border-color: var(--success-color); color: #fff; }
.btn-success:hover { background-color: var(--success-hover); border-color: var(--success-hover); color: #fff; /* Keep text color */ }
.btn-danger { background-color: var(--danger-color); border-color: var(--danger-color); color: #fff; } 
.btn-danger:hover { background-color: var(--danger-hover); border-color: var(--danger-hover); color: #fff; /* Keep text color */ }
.btn-info { background-color: var(--info-color); border-color: var(--info-color); color: #fff; }
.btn-info:hover { background-color: var(--info-hover); border-color: var(--info-hover); color: #fff; /* Keep text color */ }
.btn-warning { background-color: var(--warning-color); border-color: var(--warning-color); color: #212529; } /* Text color for warning */
.btn-warning:hover { background-color: var(--warning-hover); border-color: var(--warning-hover); color: #212529; /* Keep text color */ }
.btn-secondary { background-color: var(--secondary-color); border-color: var(--secondary-color); color: #fff; }
.btn-secondary:hover { background-color: #5a6268; border-color: #545b62; color: #fff; /* Keep text color */ }
.btn-sm { padding: 0.35rem 0.8rem; font-size: 0.8rem; line-height: 1.4; } /* Adjusted padding and font-size for sm */
.btn-block { display: block; width: 100%; }
.mb-3 { margin-bottom: 1rem !important; }


/* --- Forms --- */
.form-group {
    margin-bottom: 1.25rem; /* Slightly reduced margin */
}
.form-group label, .form-label { /* Added .form-label for filter form */
    display: block;
    margin-bottom: 0.4rem; /* Slightly reduced margin */
    font-weight: 600;
    color: var(--text-color);
    font-size: 0.9em;
}
.form-control, .form-select { /* Added .form-select */
    display: block;
    width: 100%;
    padding: 0.6rem 0.9rem; /* Adjusted padding */
    font-size: 0.95rem;
    font-family: var(--font-family); /* Explicitly set font for form elements */
    font-weight: 400;
    line-height: 1.5;
    color: #495057;
    background-color: #fff;
    background-clip: padding-box;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
    box-sizing: border-box; 
}
.form-control:focus, .form-select:focus {
    color: #495057;
    background-color: #fff;
    border-color: #80bdff; /* Standard focus color */
    outline: 0;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}
select.form-control, select.form-select {
     height: calc(1.5em + 1.2rem + 2px); /* Match input height (based on new padding) */
}
.form-control-sm, .form-select-sm { /* Styles for smaller form controls */
    padding: 0.5rem 0.7rem; /* Increased padding for search box height */
    font-size: 0.85rem;
    height: auto; /* Allow height to be determined by padding and font-size */
}


/* --- Page Header (for list pages etc.) --- */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}
.page-header h1 {
    font-size: 1.8em;
    color: var(--primary-color);
    margin: 0; /* Remove default margin */
}
.page-nav a {
    margin-right: 15px; /* Spacing for nav links */
    color: var(--secondary-color);
    text-decoration: none;
    font-size: 0.95em;
}
.page-nav a:hover {
    color: var(--primary-color);
    text-decoration: none; /* Remove underline from nav links on hover */
}
.page-nav a:last-child {
    margin-right: 0;
}


/* --- Filter Form Specifics (e.g., students/list.php) --- */
.filter-form .filter-form-row { /* Replaces .row for more control */
    display: flex;
    align-items: flex-end; /* Align items to the bottom (label, select, buttons) */
    gap: 0.75rem; /* Space between select and buttons block */
    margin-bottom: 1rem; /* Replaces mb-3 on form if needed */
}

.filter-form .filter-form-group-select {
    /* flex-grow: 1; */ /* Remove flex-grow to strictly follow width/flex-basis */
    flex-basis: 50%; /* Use flex-basis for better control in flex container */
    max-width: 50%; /* Ensure it doesn't exceed 50% */
    /* width: 50%; */ /* Can be redundant if using flex-basis in a flex row */
}
.filter-form .filter-form-group-select .form-select-sm {
    width: 100%; /* Ensure select fills its container */
}

.filter-form .filter-form-group-buttons {
    display: flex;
    gap: 0.5rem; /* Space between the two buttons */
    flex-shrink: 0; /* Prevent buttons from shrinking */
}

.filter-form .form-label { /* This was already mostly covered, ensuring it here */
    margin-bottom: 0.3rem;
    font-size: 0.9em;
}

.filter-form .btn { 
    white-space: nowrap; /* Prevent button text from wrapping */
}

.search-input-group { /* For the student search input */
    margin-bottom: 1rem;
    margin-top: 1rem; /* Added top margin */
}
.search-input-group .form-label {
    font-weight: normal;
    font-size: 0.9em;
    color: var(--text-muted);
}


/* --- Messages & Alerts --- */
.alert {
    position: relative;
    padding: 0.9rem 1.1rem; /* Adjusted padding */
    margin-bottom: 1rem;
    border: 1px solid transparent;
    border-radius: var(--border-radius);
    text-align: center; 
}
.alert-danger { color: #721c24; background-color: #f8d7da; border-color: #f5c6cb; }
.alert-success { color: #155724; background-color: #d4edda; border-color: #c3e6cb; }
.alert-warning { color: #856404; background-color: #fff3cd; border-color: #ffeeba; }
.alert-info { color: #0c5460; background-color: #d1ecf1; border-color: #bee5eb; }

/* --- Login & Select Year Pages --- */
.auth-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
    background-color: var(--light-bg);
}
.auth-box {
    background-color: var(--white-bg);
    padding: 35px 45px;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    width: 100%;
    max-width: 420px;
    text-align: center;
}
.auth-header { margin-bottom: 2rem; }
.auth-header h1, .auth-header h2 { color: var(--primary-color); margin-bottom: 0.75rem; font-size: 1.8em; }
.auth-header p { color: var(--text-muted); font-size: 1em; }
.auth-box .form-group { text-align: right; } 
.auth-box .btn { margin-top: 1rem; }
.logout-link { display: block; margin-top: 1.5rem; color: var(--text-muted); font-size: 0.9em; }

/* --- Dashboard --- */
.user-info-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2.5rem; 
    padding-bottom: 1.5rem;
    border-bottom: 2px solid var(--primary-color);
}

.user-info-header .site-title-date h1 {
    margin-bottom: 0.3rem;
    font-size: 1.7em; 
    color: var(--primary-color);
    font-weight: bold;
}
.user-info-header .site-title-date .current-date {
    font-size: 0.9em;
    color: var(--text-muted);
}

.user-details {
    text-align: left;
}
.user-details p {
    margin: 0.3rem 0;
    font-size: 0.9em;
    color: var(--text-muted);
}
.user-details strong {
    color: var(--text-color);
    font-weight: bold;
}
.user-details a {
    color: var(--info-color);
    font-weight: bold;
}
.user-details a:hover {
    color: var(--info-hover);
}
.user-details .btn-logout {
    margin-top: 0.5rem;
    color: #fff !important; 
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); 
    gap: 2rem;
    margin-top: 1rem;
}

.dashboard-card {
    background-color: var(--white-bg);
    border-radius: var(--border-radius);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.08); 
    padding: 1.5rem;
    text-align: center;
    transition: transform 0.25s ease-in-out, box-shadow 0.25s ease-in-out;
    display: flex; 
    flex-direction: column;
    justify-content: space-between; 
}
.dashboard-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.12);
}

.dashboard-card .card-link {
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    align-items: center; 
    height: 100%; 
}

.dashboard-card .card-icon {
    font-size: 3.5rem; 
    margin-bottom: 1rem;
    line-height: 1;
    color: var(--primary-color); 
}

.dashboard-card h3 {
    margin-top: 0;
    font-size: 1.15em; 
    color: var(--text-color);
    margin-bottom: 0.75rem; 
    font-weight: bold;
}

.dashboard-card .btn-enter {
    margin-top: auto; 
    padding: 0.5rem 1.5rem;
    font-size: 0.9rem;
    width: auto; 
    min-width: 100px;
}

.dashboard-card ul ul li a { 
    color: var(--info-color);
    background-color: transparent;
    border: none;
    padding: 0.3rem 0;
    font-weight: normal;
}
.dashboard-card ul ul li a:hover {
    color: var(--info-hover);
    background-color: transparent;
    text-decoration: underline;
}

.dashboard-sections h3 { 
     margin-top: 2rem;
     margin-bottom: 1rem;
     border-bottom: 1px solid var(--border-color);
     padding-bottom: 0.5rem;
     font-size: 1.4rem;
     color: var(--secondary-color);
}
.dashboard-sections ul { list-style: none; padding-right: 0; }
.dashboard-sections ul li { margin-bottom: 0.75rem; }
.dashboard-sections ul li a { font-size: 1.1rem; }

/* --- User List Page & General Table Styles --- */
.table-container { 
    overflow-x: auto; 
    margin-top: 1.5rem; /* Added margin top */
}
table.data-table {
    width: 100%;
    border-collapse: collapse;
    background-color: var(--white-bg); /* Ensure table has white background */
    box-shadow: 0 1px 3px rgba(0,0,0,0.05); /* Softer shadow for table */
    /* margin-top: 1rem; Removed, added to .table-container */
    font-size: 0.9rem; /* Slightly smaller font for more data */
}
table.data-table th, table.data-table td {
    padding: 10px 12px; /* Adjusted padding */
    text-align: right;
    border: 1px solid var(--border-color); /* Use variable for border */
    vertical-align: middle;
}
table.data-table thead th {
    background-color: #f8f9fa; /* Light gray for header, consistent */
    font-weight: 600;
    color: var(--text-color);
    white-space: nowrap; /* Prevent header text wrapping */
}
table.data-table tbody tr:nth-of-type(even) { /* Changed from odd to even */
    background-color: #fcfcfc; /* Very light gray for even rows */
}
table.data-table tbody tr:hover {
    background-color: #f1f1f1; /* Consistent hover effect */
}
.action-links a, .action-links button {
    margin-left: 6px; /* Spacing between action buttons */
    margin-bottom: 5px; /* Prevent overlap if they wrap */
    white-space: nowrap; 
}
.action-links a:last-child, .action-links button:last-child {
    margin-left: 0; /* Remove margin from last button */
}
.status-text-active { color: var(--success-color); font-weight: bold; }
.status-text-inactive { color: var(--danger-color); font-weight: bold; }
.checkbox-cell { width: 1%; text-align: center; } /* For select-all checkbox */
.bulk-actions { /* For the div containing bulk delete button */
    margin-bottom: 1rem;
    padding: 0.5rem;
    background-color: var(--light-bg);
    border-radius: var(--border-radius);
}


/* --- 404 Page --- */
.error-page-container {
    text-align: center;
    padding-top: 80px;
    min-height: 80vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}
.error-page-container h1 {
    font-size: 6em;
    color: var(--secondary-color);
    margin-bottom: 0;
    font-weight: 700;
}
.error-page-container p {
    color: var(--text-muted);
    font-size: 1.4em;
    margin-top: 0;
}

/* --- Footer --- */
footer {
    text-align: center;
    margin-top: 3rem;
    padding-top: 1.5rem; /* Increased padding */
    border-top: 1px solid var(--border-color);
    color: var(--text-muted);
    font-size: 0.9em;
}

/* Input Placeholders */
::-webkit-input-placeholder { /* WebKit, Blink, Edge */
    font-family: var(--font-family);
    color: var(--text-muted); /* Optional: style placeholder color */
}
::-moz-placeholder { /* Firefox 19+ */
    font-family: var(--font-family);
    color: var(--text-muted);
    opacity: 1; /* Firefox adds a lower opacity by default */
}
:-ms-input-placeholder { /* Internet Explorer 10-11 */
    font-family: var(--font-family);
    color: var(--text-muted);
}
::placeholder { /* Most modern browsers */
    font-family: var(--font-family);
    color: var(--text-muted);
} 

/* Added to fix invisible header links on white backgrounds */
.page-header .page-nav a {
    color: var(--primary-hover) !important; /* Use a strong blue color */
    text-decoration: none;
}

.page-header .page-nav a:hover {
    text-decoration: underline;
} 