/* Google Fonts Import Link */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&family=Noto+Sans+Sinhala:wght@400;700&display=swap');

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Poppins', 'Noto Sans Sinhala', sans-serif;
}

:root {
  --primary-color: #800000; /* මෙරූන් පැහැය */
  --secondary-color: #d4ac0d; /* රන් පැහැය */
  --light-bg: #f5f6fa;
  --text-color: #333;
  --green-color: #27ae60;
  --blue-color: #2980b9;
  --red-color: #e74c3c;
  --border-color: #ddd;
}

body {
  min-height: 100vh;
  width: 100%;
  overflow-x: hidden;
  color: var(--text-color);
}

/* --- Sidebar Styles (සංස්කරණය කරන ලදී) --- */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  height: 100%;
  width: 240px;
  background: var(--primary-color);
  z-index: 100;
  transition: all 0.5s ease;
  
  /* අලුතින් එක් කළ කොටස: Scroll පහසුකම */
  overflow-y: auto;  /* උස වැඩි වූ විට පහළට Scroll වේ */
  overflow-x: hidden; /* හරස් අතට Scroll වීම නවතයි */
}

/* Sidebar Scrollbar Styling (ලස්සන කිරීම) */
.sidebar::-webkit-scrollbar {
  width: 6px;
}
.sidebar::-webkit-scrollbar-track {
  background: var(--primary-color);
}
.sidebar::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 10px;
}
.sidebar::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.4);
}

.sidebar.active {
  width: 60px;
}

.sidebar .logo-details {
  height: 80px;
  display: flex;
  align-items: center;
  width: 100%;
  padding-left: 15px; 
}

.sidebar .logo-details i {
  font-size: 28px;
  font-weight: 500;
  color: #fff;
  min-width: 60px;
  text-align: center;
}

.sidebar .logo-details .logo_name {
  color: #fff;
  font-size: 20px;
  font-weight: 600;
  white-space: nowrap;
  opacity: 1;
  transition: 0.3s;
}

.sidebar.active .logo-details .logo_name {
  opacity: 0;
  pointer-events: none;
}

.sidebar .nav-links {
  margin-top: 10px;
  /* height: 100%;  මෙය ඉවත් කරන ලදී (Scroll ගැටළුව විසඳීමට) */
  height: auto;
  /* overflow: auto; මෙය ඉවත් කරන ලදී (මුළු Sidebar එකම Scroll වන නිසා) */
  padding-bottom: 100px; 
}

/* පැරණි සැඟවුණු Scrollbar කේතය ඉවත් කරන ලදී */

.sidebar .nav-links li {
  position: relative;
  list-style: none;
  height: 50px;
}

.sidebar .nav-links li a {
  height: 100%;
  width: 100%;
  display: flex;
  align-items: center;
  text-decoration: none;
  color: #fff !important; 
  transition: all 0.4s ease;
}

.sidebar .nav-links li a.active {
  background: rgba(255, 255, 255, 0.1); 
  border-left: 4px solid var(--secondary-color);
}

.sidebar .nav-links li a:hover {
  background: rgba(255, 255, 255, 0.1);
}

.sidebar .nav-links li i {
  min-width: 60px;
  text-align: center;
  font-size: 18px;
  color: #fff !important; 
}

.sidebar .nav-links li a .links_name {
  color: #fff !important; 
  font-size: 15px;
  font-weight: 400;
  white-space: nowrap;
  transition: 0.3s;
}

.sidebar.active .nav-links li a .links_name {
  opacity: 0;
  pointer-events: none;
}

.sidebar .nav-links .log_out {
  position: absolute;
  bottom: 0;
  width: 100%;
  background: #600000;
}

/* --- Menu Headers (Reports, Operations) --- */
.menu-header {
  padding: 15px 25px 5px 25px; 
  color: #dcdcdc; 
  font-size: 0.75rem; 
  text-transform: uppercase; 
  font-weight: bold;
  letter-spacing: 1px;
}

.sidebar.active .menu-header {
  display: none;
}

/* --- Main Content (Home Section) --- */
.home-section {
  position: relative;
  background: var(--light-bg);
  min-height: 100vh;
  top: 0;
  left: 240px;
  width: calc(100% - 240px);
  transition: all 0.5s ease;
}

.sidebar.active ~ .home-section {
  left: 60px;
  width: calc(100% - 60px);
}

.home-section nav {
  display: flex;
  justify-content: space-between;
  height: 80px;
  background: #fff;
  display: flex;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 99;
  padding: 0 20px;
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.1);
}

.home-section nav .sidebar-button {
  display: flex;
  align-items: center;
  font-size: 24px;
  font-weight: 500;
}

nav .sidebar-button i {
  font-size: 35px;
  margin-right: 10px;
  cursor: pointer;
}

.home-section nav .profile-details {
  display: flex;
  align-items: center;
  background: var(--light-bg);
  border: 2px solid #efefef;
  border-radius: 6px;
  height: 50px;
  min-width: 190px;
  padding: 0 15px 0 2px;
}

nav .profile-details img {
  height: 40px;
  width: 40px;
  border-radius: 6px;
  object-fit: cover;
}

nav .profile-details .admin_name {
  font-size: 15px;
  font-weight: 500;
  color: #333;
  margin: 0 10px;
  white-space: nowrap;
}

/* --- Dashboard Cards --- */
.home-content {
    padding: 20px;
}

.overview-boxes {
  display: flex;
  flex-wrap: wrap; 
  justify-content: space-between;
  padding: 0 20px;
  margin-bottom: 26px;
  gap: 20px; 
}

.overview-boxes .box {
  display: flex;
  align-items: center;
  justify-content: center;
  width: calc(25% - 15px); 
  background: #fff;
  padding: 20px; 
  border-radius: 12px;
  box-shadow: 0 5px 10px rgba(0, 0, 0, 0.1);
  transition: transform 0.3s ease;
  min-width: 200px; 
}

.overview-boxes .box:hover {
    transform: translateY(-5px);
}

.overview-boxes .box-topic {
  font-size: 16px;
  font-weight: 500;
  color: #666;
  margin-bottom: 10px; 
}

.overview-boxes .box .number {
  display: block; 
  font-size: 35px;
  font-weight: 500;
  color: var(--primary-color);
}

.overview-boxes .box .indicator {
  display: flex;
  align-items: center;
}

.overview-boxes .box .indicator i {
  height: 20px;
  width: 20px;
  background: #8FDACB;
  line-height: 20px;
  text-align: center;
  border-radius: 50%;
  color: #fff;
  font-size: 20px;
  margin-right: 5px;
}

.overview-boxes .box i.cart {
  display: inline-block;
  font-size: 40px; 
  height: 60px;
  width: 60px;
  background: rgba(128, 0, 0, 0.1); 
  line-height: 60px;
  text-align: center;
  border-radius: 12px;
  color: var(--primary-color);
  margin-left: 15px;
}

.overview-boxes .box i.cart.two {
  color: #2BD47D;
  background: #C0F2D8;
}

.overview-boxes .box i.cart.three {
  color: #e0a800;
  background: #ffeeba;
}

.overview-boxes .box i.cart.four {
  color: #ff6b6b;
  background: #ffe3e3;
}

/* --- Common UI Elements --- */
.container {
    background: #fff;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
    margin: 20px;
    width: auto;
    max-width: 1000px;
}

/* --- Page Headers & Top Bar --- */
.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    border-bottom: 2px solid #eee;
    padding-bottom: 15px;
}

.top-bar h2, .container h2 {
    color: var(--primary-color);
    margin: 0 0 20px 0;
    border-bottom: 2px solid #f0f0f0;
    padding-bottom: 10px;
    font-size: 1.5rem;
}

.add-btn {
    background: var(--green-color);
    color: #fff;
    padding: 10px 20px;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 500;
    transition: 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.add-btn:hover {
    background: #1e8449;
    transform: translateY(-2px);
    box-shadow: 0 6px 8px rgba(0,0,0,0.15);
}

/* --- IMPROVED FORM STYLING --- */
.form-group {
    margin-bottom: 25px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #444;
    font-size: 0.95rem;
}

input[type="text"], 
input[type="date"], 
input[type="number"], 
input[type="email"], 
input[type="password"],
input[type="tel"],
select, 
textarea {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 1rem;
    outline: none;
    transition: all 0.3s ease;
    background-color: #fdfdfd;
    height: 50px;
}

textarea {
    height: auto;
    min-height: 100px;
    resize: vertical;
    font-family: inherit;
}

input[type="color"] {
    padding: 5px;
    height: 50px;
    cursor: pointer;
    background: #fff;
}

input[type="file"] {
    padding: 10px;
    background: #f9f9f9;
    height: auto;
}

input:focus, select:focus, textarea:focus {
    border-color: var(--primary-color);
    background-color: #fff;
    box-shadow: 0 0 0 3px rgba(128, 0, 0, 0.1);
}

/* Search Form Specifics */
.search-form-container {
    background: #f8f9fa;
    padding: 25px;
    border-radius: 8px;
    margin-bottom: 30px;
    border: 1px solid #e9ecef;
}

.search-form {
    display: flex;
    gap: 20px;
    align-items: flex-end;
    flex-wrap: wrap;
}

.form-group-inline {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 250px;
}

/* --- Buttons --- */
.btn-submit, button {
    background: var(--primary-color);
    color: white;
    padding: 12px 30px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    display: inline-block;
    margin-top: 10px;
}

.btn-submit:hover, button:hover {
    background: #600000;
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.2);
}

/* --- Table Styles --- */
.btn-sm {
    padding: 6px 12px;
    font-size: 0.85rem;
    border-radius: 4px;
    text-decoration: none;
    color: white !important;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    margin-right: 5px;
    transition: 0.3s;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.btn-edit { background-color: var(--blue-color); }
.btn-edit:hover { background-color: #1f618d; transform: translateY(-1px); }

.btn-delete { background-color: var(--red-color); }
.btn-delete:hover { background-color: #c0392b; transform: translateY(-1px); }

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
    background: #fff;
    border-radius: 8px;
    overflow: hidden; 
    box-shadow: 0 0 10px rgba(0,0,0,0.05);
}

table th, table td {
    padding: 15px;
    text-align: left;
    border-bottom: 1px solid #eee;
}

table th {
    background-color: var(--primary-color);
    color: white;
    font-weight: 500;
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 0.5px;
}

table tr:hover {
    background-color: #fff5f5;
}

/* --- Print Styles --- */
@media print {
    .sidebar, .top-bar, .no-print, .btn-submit, form, .actions, .add-btn, .search-form-container {
        display: none !important;
    }

    body { background-color: white; color: black; }
    .home-section { margin: 0 !important; width: 100% !important; left: 0 !important; }
    .container { box-shadow: none !important; border: none !important; padding: 0 !important; margin: 0 !important; width: 100% !important; }
    table th, table td { border: 1px solid #000 !important; color: #000 !important; padding: 5px !important; }
}

/* --- RESPONSIVE DESIGN (Mobile & Tablet) --- */
.header-logo {
    height: 50px;
    width: auto;
}

.school-name {
    font-size: 1.2rem;
    font-weight: bold;
    color: #800000;
}

.school-sub {
    font-size: 0.8rem;
    color: #555;
}

.date-badge {
    font-weight: bold; 
    color: #444; 
    background: #eee; 
    padding: 5px 15px; 
    border-radius: 20px; 
    font-size: 0.9rem;
}

@media (max-width: 768px) {
    .sidebar {
        width: 0;
        padding: 0;
        overflow: hidden; 
    }

    .sidebar.active {
        width: 240px; 
    }

    .home-section {
        left: 0;
        width: 100%;
        padding-left: 0;
    }

    .home-section nav .sidebar-button i {
        font-size: 30px; 
    }

    .school-text {
        display: none;
    }
    
    .date-badge {
        display: none; 
    }
    
    .profile-details {
        min-width: auto;
        padding: 0 10px;
    }

    .profile-details .admin_name {
        display: none; 
    }

    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    .overview-boxes .box {
        width: 100%;
        margin-bottom: 15px;
    }
    
    .container {
        padding: 15px;
        margin: 10px;
    }
    
    table {
        display: block;
        width: 100%;
        overflow-x: auto; 
    }
}
/* --- PRINTING OPTIMIZATION (A4) --- */
@media print {
    /* අනවශ්‍ය කොටස් මුද්‍රණයෙන් ඉවත් කිරීම */
    .sidebar, .home-section nav, .top-bar, .no-print, .web-admin-card, .btn-submit, .trophy-icon, .stats-grid {
        display: none !important;
    }

    .home-section {
        left: 0 !important;
        width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    .container {
        box-shadow: none !important;
        border: none !important;
        width: 100% !important;
        max-width: none !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    .card {
        box-shadow: none !important;
        border: 1px solid #000 !important;
        margin-bottom: 20px !important;
        page-break-inside: avoid; /* වගු මැදින් කැඩීම වැළැක්වීමට */
    }

    .dash-table {
        width: 100% !important;
        border-collapse: collapse !important;
    }

    .dash-table th, .dash-table td {
        border: 1px solid #000 !important;
        padding: 8px !important;
        color: #000 !important;
    }

    @page {
        size: A4;
        margin: 1.5cm;
    }
    
    body {
        -webkit-print-color-adjust: exact;
    }
}


