/* General Styles */
* {
    margin: 0;
    padding: 0;
}
body {
    font-family: Arial, sans-serif;
    text-align: center;
    padding: 0px 20px;
}
/* Dashboard layout */
.dashboard-container {
    display: flex;
    height: 100vh;
}
  
/* Sidebar styles */
.sidebar {
    width: 250px;
    background-color: #2f3e46;
    color: #ffffff;
    display: flex;
    flex-direction: column;
    padding: 1rem;
    box-shadow: 2px 0 6px rgba(0,0,0,0.1);
    height: 100vh;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(0,0,0,0.3) transparent;
}
.sidebar::-webkit-scrollbar {
  width: 6px;
}
.sidebar::-webkit-scrollbar-thumb {
  border-radius: 3px;
  background-color: rgba(0,0,0,0.2);
}
.sidebar::-webkit-scrollbar-track {
  background: transparent;
}
.sidebar__title {
    font-size: 1.5rem;
    margin-bottom: 1rem;
    text-align: center;
}
.sidebar__nav ul {
    list-style: none;
    flex: 1;
    overflow-y: auto;
}
.sidebar__nav li {
    margin-bottom: 0.5rem;
}
.sidebar__nav a {
    display: block;
    padding: 0.5rem 0.75rem;
    color: #ffffff;
    text-decoration: none;
    border-radius: 0.25rem;
    transition: background-color 0.2s;
}
.sidebar__nav a:hover,
.sidebar__nav a.active {
    background-color: #354f52;
}
  
/* Main content area */
.main-content {
    flex: 1;
    background-color: #ffffff;
    padding: 1.5rem;
    overflow-y: auto;
}
.content-section {
    max-width: 800px;
    margin: 0 auto;
}
  
/* Inputs and buttons */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="date"],
input[type="number"],
select {
    width: 100%;
    padding: 0.5rem;
    margin: 0.5rem auto;
    border: 1px solid #ced4da;
    border-radius: 0.25rem;
}
button {
    padding: 0.5rem 1rem;
    border: none;
    background-color: #52796f;
    color: #ffffff;
    border-radius: 0.25rem;
    cursor: pointer;
    transition: background-color 0.2s;
}
button:hover {
    background-color: #354f52;
}
  
/* Utility classes */
.no-print { display: inline-block; }
.toast-container {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 1000;
}
  
.site-nav {
    background: #040133;
    padding: 0.5rem 1rem;
}
  
.site-nav ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    gap: 1rem;
}
  
.site-nav a {
    color: #fff;
    text-decoration: none;
    font-weight: 500;
    padding: 0.4rem 0.6rem;
    transition: background 0.2s ease;
}
  
.site-nav a:hover {
    background: rgba(255,255,255,0.2);
    border-radius: 4px;
}

#reportCard h4 {
    font-size: 20px;
}

#studentPassportDisplay {
    width: 100%;
    height: 100%;
    border: 1px solid black;
}

input, button {
    display: block;
    margin: 10px auto;
    padding: 10px;
    width: 80%;
    max-width: 300px;
}

button {
    background: rgb(49, 15, 238);
    color: white;
    border: none;
    cursor: pointer;
}

#collegeLogo, #primaryLogo {
    display: none;
}
  

#deleteStudentRecord button {
    background: red;
    color: white;
    border: none;
    cursor: pointer;
}
#deleteSubjectSection button {
    background: red;
    color: white;
    border: none;
    cursor: pointer;
}

#reportCard {
    margin-top: 20px;
    text-align: center;
    width: 90%;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
    padding: 20px;
    border: 2px solid black;
}
.att {
    display: flex;
    justify-content: center;
    gap: 10px;
}

#reportCard h3{
    font-size: 35px;
    margin: 5px 0 0 0;
    padding: 0;
    color: #ff1493;
}

#reportCard p{
    font-size: 15px;
    margin: 5px;
}

.reportLogosText {
    display: block;
}

/* container holds image + info side-by-side */
.headercontent {
    display: flex;
    align-items: flex-start;
    gap: 1.5rem;
    margin-bottom: 1rem;
}
  
  /* passport box */
.passport-cell img {
    display: block;
    width: 100px;
    height: 100px;
    object-fit: cover;
    border: 1px solid #333;
    border-radius: 4px;
}
  
  /* 4-column grid of label/value pairs */
.details-grid {
    display: grid;
    /* 4 columns: label / value / label / value */
    grid-template-columns: auto 1fr auto 1fr auto 1fr;
    grid-row-gap: 0.5rem;
    grid-column-gap: 1rem;
    align-items: center;
}
  
  /* tighten up spacing inside */
.details-grid span {
    margin: 0;
    line-height: 1.2;
}
  

.headercontent td {
    border: none;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
}

th, td {
    border: 1px solid black;
    padding: 8px;
    text-align: center;
}

.total-score-container {
    display: flex;
    justify-content: center;
}

#collegeLogo, #primaryLogo {
    display: none;
}

.reportlogos {
    display: flex;
    margin: 0 5px;
    gap: 2%;
}


.reportheader {
    display: block;
}

.reportheader img{
    height: 80px;
}

.comments {
    justify-content: left;
}

/* Style for dropdown select */
select {
    display: block;
    width: 85%;
    max-width: 300px;
    margin: 10px auto;
    padding: 10px;
    font-size: 16px;
    border: 2px solid #4CAF50;
    border-radius: 5px;
    background-color: white;
    color: #333;
    cursor: pointer;
}

/* Dropdown hover & focus effect */
select:hover, select:focus {
    border-color: #45a049;
    outline: none;
}

/* Style dropdown options */
select option {
    font-size: 16px;
    padding: 10px;
    background-color: white;
    color: black;
}

.teacherPortal {
    display: flex;
    justify-content: center;
    gap: 30px;
}

#resultEntry {
    width: 100%;
}
#deleteStudentRecord {
    width: 100%;
}
#registerSubjectsSection {
    width: 100%;
}
#registerStudentSection {
    width: 100%;
}
#generatePinSection {
    width: 100%;
}
#generateBroadsheetSection {
    width: 100%;
}
#attendanceEntrySection {
    width: 100%;
}
#attendanceEntrySection input {
    width: 80%
}
#deleteSubjectSection {
    width: 100%;
}
#promoteStudentsSection {
    width: 100%;
}
.toast-container {
    position: fixed;
    top: 1rem;
    right: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    z-index: 9999;
}
  
.toast {
    background: rgba(0,0,0,0.8);
    color: #fff;
    padding: 0.75rem 1rem;
    border-radius: 4px;
    min-width: 200px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
    opacity: 0;
    transform: translateX(100%);
    transition: opacity 0.3s ease, transform 0.3s ease;
}
  
  /* when we add the "show" class it slides in */
.toast.show {
    opacity: 1;
    transform: translateX(0);
}

table.broadsheet {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}
  
.broadsheet th,
.broadsheet td {
    border: 1px solid #333;
    padding: 4px;
    text-align: center;
    font-size: 12px;
    vertical-align: middle;
}
  
  /* Wider “Name” column */
.broadsheet .col-name {
    width: 200px;
}
  
  /* Vertical header titles, bottom→top */
.broadsheet .vertical-header {
    writing-mode: vertical-rl;
    text-orientation: mixed;
    white-space: nowrap;
    padding: 8px 4px;
}

/* Loading Overlay Styles */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6); /* Semi-transparent black background */
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999; /* Ensure it's on top of everything */
    visibility: hidden; /* Hidden by default */
    opacity: 0;
    transition: visibility 0s, opacity 0.3s ease-in-out;
}

.loading-overlay.show {
    visibility: visible;
    opacity: 1;
}

.loading-content {
    background-color: #fff;
    padding: 30px 40px;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.spinner {
    border: 5px solid #f3f3f3; /* Light grey */
    border-top: 5px solid #3498db; /* Blue */
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

#loadingMessage {
    font-size: 1.1rem;
    color: #333;
    font-weight: bold;
}

/* Toast Notification Styles */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1050; /* Above loading overlay */
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: flex-end; /* Align toasts to the right */
    /* Add pointer-events: none; when no toasts are present to prevent blocking clicks */
    /* This needs to be managed by JS, but setting it here as a default */
    pointer-events: none; /* Initially non-interactive */
}

/* When toasts are added, pointer-events can be set to auto by JS if needed,
   but generally, toasts overlay and don't need interaction. */

.toast-message {
    background-color: #333;
    color: #fff;
    padding: 12px 20px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    opacity: 0; /* Start hidden */
    transform: translateX(100%); /* Start off-screen to the right */
    transition: opacity 0.5s ease-out, transform 0.5s ease-out;
    min-width: 250px;
    text-align: center;
    font-size: 0.95rem;
    pointer-events: auto; /* Make individual toast interactive if needed (e.g., for close button) */
}

.toast-message.show {
    opacity: 1;
    transform: translateX(0); /* Slide in */
}

.toast-message.hide {
    opacity: 0;
    transform: translateX(100%); /* Slide out */
    /* Ensure the animation completes and stays in the final state */
    animation: fadeOutSlideOut 0.5s forwards; /* Use an explicit animation for hide */
}

/* --- Activity Log Table Responsiveness --- */
.table-responsive {
    overflow-x: auto; /* Allows horizontal scrolling if table content overflows */
    -webkit-overflow-scrolling: touch; /* Improves scrolling on iOS */
    margin-top: 15px;
    border: 1px solid #ddd;
    border-radius: 8px;
    background-color: #fff;
    padding: 10px;
}

.activity-log-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 600px; /* Ensures table doesn't shrink too much on small screens */
}

.activity-log-table th,
.activity-log-table td {
    border: 1px solid #e0e0e0;
    padding: 10px 8px;
    text-align: left;
    font-size: 0.9em;
    vertical-align: top;
}

.activity-log-table th {
    background-color: #f5f5f5;
    font-weight: bold;
    color: #333;
    white-space: nowrap; /* Prevent headers from wrapping too early */
}

/* --- Pagination Controls Styling --- */
.pagination-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 20px;
    gap: 15px; /* Space between elements */
}

.pagination-btn {
    background-color: #007bff;
    color: white;
    border: none;
    border-radius: 5px;
    padding: 10px 20px;
    cursor: pointer;
    font-size: 1em;
    transition: background-color 0.3s ease;
}

.pagination-btn:hover:not(:disabled) {
    background-color: #0056b3;
}

.pagination-btn:disabled {
    background-color: #cccccc;
    cursor: not-allowed;
}

#pageInfo {
    font-size: 1.1em;
    color: #555;
    font-weight: bold;
}

/* Filter Controls Styling (optional, but good for consistency) */
.filter-controls {
    display: flex;
    flex-wrap: wrap; /* Allow items to wrap on smaller screens */
    gap: 10px; /* Space between filter elements */
    margin-bottom: 20px;
    align-items: center;
}

.filter-controls label {
    font-weight: bold;
    color: #333;
}

.filter-controls input[type="date"],
.filter-controls select,
.filter-controls button {
    padding: 8px 12px;
    border: 1px solid #ccc;
    border-radius: 5px;
    font-size: 0.95em;
}

.filter-controls button {
    background-color: #0056b3;
    color: white;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.filter-controls button:hover {
    background-color: #218838;
}

/* Basic styling for content sections and dashboard (adjust as needed) */
.content-section {
    padding: 20px;
    background-color: #f9f9f9;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 20px;
}

@media print {
    /* Hide controls */
    .no-print,
    .search-section,
    button,
    .site-nav {
      display: none !important;
    }
    thead {
      display: table-header-group;
    }
  
    /* Hide everything except reportCard, broadsheet, and footer */
    body * {
      visibility: hidden !important;
    }
    /* ReportCard visible */
    #reportCard,
    #reportCard * {
      visibility: visible !important;
    }
    /* Broadsheet containers visible */
    #broadsheet-container,
    #broadsheet-container *,
    .class-section,
    .class-section * {
      visibility: visible !important;
    }
    /* Footer visible */
    .print-footer,
    .print-footer * {
      visibility: visible !important;
    }

    .pin-container {
        /* This is the crucial line: */
        height: 1in; /* Sets the height to 2 inches */

        /* Other styling for visual appeal and layout: */
        width: 3.5in; /* Example width, adjust as needed */
        border: 1px solid #ccc;
        margin: 0.1in; /* Space around each pin cell */
        padding: 0.1in;
        box-sizing: border-box; /* Ensures padding and border are included in the 2in height */

        /* Flexbox for centering content within the cell */
        display: flex;
        flex-direction: column;
        justify-content: center; /* Centers vertically */
        align-items: center;     /* Centers horizontally */

        page-break-inside: avoid; /* Prevents a single PIN cell from splitting across two pages */
    }
  
    /* Page sizing */
    @page {
      size: A4 portrait;
      margin: 10mm;
    }
    @page broadsheet-landscape {
      size: A4 landscape;
      margin: 10mm;
    }
  
    /* Position and size the report card to fill the page (minus margins & footer) */
    #reportCard {
      position: absolute;
      top: 10mm;           /* match top margin */
      bottom: 25mm;        /* leave room for footer */
      left: 10mm;          /* match left margin */
      right: 10mm;         /* match right margin */
      overflow: hidden;
      page-break-inside: avoid !important;
    }
  
    /* Footer pinned at bottom */
    .print-footer {
      position: fixed;
      bottom: 10mm;        /* just above page bottom margin */
      left: 10mm;
      right: 10mm;
      text-align: center;
      font-size: 10px;
    }
  
    /* Preserve your header/grid layouts in reportCard */
    .headercontent {
      display: flex !important;
      flex-direction: row !important;
      gap: 1rem !important;
    }
    .passport-cell,
    .details-grid {
      display: block !important;
    }
    .passport-cell img {
      display: block !important;
    }
    .details-grid {
      display: grid !important;
      grid-template-columns: auto 1fr auto 1fr auto 1fr !important;
      grid-row-gap: 0.5rem !important;
      grid-column-gap: 1rem !important;
      font-size: 14px;
    }
    att { font-size: 14px; }
    #reportCard h4 { font-size: 20px; }
    #reportcomment { font-size: 14px; }

    #resultTable.shrink-on-print {
        transform: scale(0.85);           /* tweak as needed */
        transform-origin: top left;
    }
}


@media print {
  /* A4 portrait, minimal margins */
  @page {
    size: A4 portrait;
    margin: 3mm;
  }

  /* hide UI you don’t want on print */
  .no-print,
  button,
  input,
  select {
    display: none !important;
  }
  /* keep your footer visible and full-width */
  .print-footer {
    display: block !important;
    position: fixed;
    bottom: 0;
    width: 100%;
    /* optional: tweak font-size or padding for print */
  }

  /* scale the whole report */
  #reportCard {
    transform: scale(0.90);
    transform-origin: top center;
    width: 100%;
  }

  /* force fixed layout on all tables */
  #reportCard table {
    width: 100%;
    table-layout: fixed;
    border-collapse: collapse;
  }

  /* compact your cells */
  #reportCard th,
  #reportCard td {
    padding: 3px;
    font-size: 10px;
    word-wrap: break-word;
  }

  /* prevent breaks inside these key blocks */
  #reportCard tr,
  #behaviorDisplay,          /* behavioral report */
  #totalDisplay,             /* total scores wrapper */
  #teacherComment,           /* teacher’s comment */
  #directorComment {         /* director’s comment */
    page-break-inside: avoid;
  }

  /* repeat table header if needed */
  #reportCard thead {
    display: table-header-group;
  }

  #studentPassportDisplay {
    width: 100px;
    height: 100px;
    border: 1px solid black;
  }
}

  

/* Responsive Design */

/* For smaller screens like mobile phones */
@media (max-width: 600px) {
    body {
        padding: 10px;
    }
    .dashboard-container {
        flex-direction: column;
    }
    .sidebar {
        width: 100%;
        flex-direction: row;
        overflow-x: auto;
        height: auto;
    }
    .sidebar__nav ul {
        display: flex;
        flex-direction: row;
    }
    .sidebar__nav li {
        margin: 0 0.5rem;
    }
    

    .site-nav ul {
        flex-direction: column;
        gap: 0.3rem;
    }

    input, button, select {
        width: 90%;
        max-width: none;
    }

    #reportCard {
        width: 100%;
        padding: 10px;
        font-size: 8px;
    }
    #generatePinSection {
        width: 100%;
    }
    
    #reportCard h3{
    font-size: 30px;
    }
    
    #reportCard p{
    font-size: 10px;
    }
    
    .reportheader img{
    height: 50px;
    }

    .reportheader {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    /* container holds image + info side-by-side */
    .headercontent {
        display: flex;
        align-items: flex-start;
        gap: 1.5rem;
        margin-bottom: 1rem;
    }
    
    /* passport box */
    .passport-cell img {
        display: block;
        width: 100px;
        height: 100px;
        object-fit: cover;
        border: 1px solid #333;
        border-radius: 4px;
    }
    
    /* 4-column grid of label/value pairs */
    .details-grid {
        display: grid;
        /* 4 columns: label / value / label / value */
        grid-template-columns: auto 1fr auto 1fr auto 1fr;
        grid-row-gap: 0.5rem;
        grid-column-gap: 1rem;
        align-items: center;
    }
    
    /* tighten up spacing inside */
    .details-grid span {
        margin: 0;
        line-height: 1.2;
    }

    .headercontent td {
        border: none;
    }

    .teacherPortal {
        display: block;
        text-align: center;
    }
}

/* For tablets */
@media (min-width: 601px) and (max-width: 1024px) {
    .teacherPortal {
        flex-direction: column;
        align-items: center;
    }

    #reportCard {
        max-width: 80%;
    }
    #generatePinSection {
        width: 100%;
    }
    
    #reportCard h3{
    font-size: 40px;
    }
}

/* For desktops */
@media (min-width: 1025px) {
    #reportCard {
        max-width: 600px;
    }
}