@import url('https://fonts.googleapis.com/css2?family=Tajawal:wght@400;700&display=swap');

/* 
   =============================
   =  CSS Variables (Colors)   =
   =============================
   Change these to quickly adjust the theme
*/
:root {
  /* Week Value Styling */
  --week-value-bg: #e74c3c;       /* Red background for "week value" row */
  --week-value-color: #ffffff;    /* White text color for "week value" */
  
  /* Title Row Styling */
  --title-row-bg: #75b600;        /* Green background for the daily-homework-title row */
  --title-text-color: #ffffff;     /* White text color for the title row */
  
  /* Footer Row Styling */
  --footer-row-bg: #60a2ca;       /* Background color for the footer row */
  --footer-text-color: #ffffff;    /* White text color for footer content */
  
  /* Table Header Background Colors */
  --heading-hissa-bg: #d5ba35;    /* Background for الحصة header */
  --heading-madda-bg: #d5ba35;    /* Background for المادة header */
  --heading-lesson-bg: #d5ba35;   /* Background for عنوان الدرس header */
  --heading-hw-bg: #d5ba35;       /* Background for الواجب header */
  --heading-teacher-bg: #d5ba35;  /* Background for اسم المعلم header */
  
  /* Period Column Background */
  --period-col-bg: #d5ba35;       /* Background for الحصة column cells */
  
  /* 
     ==============
     = Column Sizes =
     ==============
     Adjust these to change column widths easily
  */
  --period-col-width: 8%; 
  --subject-col-width: 10%;
  --lesson-col-width: 25%;
  --homework-col-width: 45%; 
  --teacher-col-width: 12%;
}

/* Global resets */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}



/* Base body and typography */
html, body {
  font-family: 'Tajawal', sans-serif;
  background: #f3f4f6;
  color: #333;
  direction: rtl;
  line-height: 1.6;
}

/* Main container styling */
.container {
  max-width: 1200px;
  margin: 2rem auto;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 5px 20px rgba(0,0,0,0.05);
  padding: 2rem;
}

/* Headings */
h1, h2 {
    margin-bottom: 1.5rem;
    color: #00663d;
    text-align: center;
    font-weight: 700;
}

/* Navigation links at the top */
.nav-links {
  display: flex;
  gap: 1rem;
  justify-content: center;
  margin-bottom: 2rem;
}
.nav-links a {
  background: #0d6efd;
  color: #fff;
  padding: 0.8rem 1.4rem;
  text-decoration: none;
  border-radius: 6px;
  font-weight: 600;
  transition: background 0.3s;
}
.nav-links a:hover {
  background: #0b5ed7;
}

/* Forms */
form {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
  margin-bottom: 1.5rem;
}
form label {
  font-weight: 600;
  min-width: 80px;
}
form input,
form select,
form textarea {
  padding: 0.6rem 0.8rem;
  border: 1px solid #ccc;
  border-radius: 6px;
  font-size: 1rem;
  flex: 1 1 auto;
  min-width: 160px;
}
textarea {
  min-height: 70px;
}

/* Buttons (general) */
button {
  background: #198754;
  color: #fff;
  border: none;
  padding: 0.7rem 1.3rem;
  border-radius: 6px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.3s;
}
button:hover {
  background: #157347;
}

/* "Save as Image" button styles */
.save-image-btn {
  display: block;
  margin: 0 auto 1rem auto; /* center horizontally + bottom margin */
  background: #28a745;
  font-size: 1rem;
  font-weight: 700;
  padding: 0.8rem 2rem;
  border-radius: 8px;
  position: relative;
}
.save-image-btn::before {
  content: "📷 ";
  font-size: 1.2rem;
  vertical-align: middle;
}

/* Table with black borders */
table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 1rem;
  border: 4px solid #000; /* black outside border */
}
table th,
table td {
  border: 1px solid #000; /* black cell borders */
  padding: 0.4rem;
  text-align: center;
  vertical-align: middle;
  color: #000;
  font-weight: 400;
}

/* Adjust column widths using CSS variables */
.period-col {
  width: var(--period-col-width);
  background-color: var(--period-col-bg); /* background for الحصة column cells */
}
.subject-col {
  width: var(--subject-col-width);
}
.lesson-col {
  width: var(--lesson-col-width);
}
.homework-col {
  width: var(--homework-col-width);
}
.teacher-col {
  width: var(--teacher-col-width);
}

/* Gray empty cells */
.gray-cell {
  background: #a4a4a4;
  color: #000000;
}

/* "week value" row: red & bold, custom background from variable */
.week-value-row {
  background-color: var(--week-value-bg);  /* Red background */
  color: var(--week-value-color);          /* White text */
  font-weight: bold;
}
.week-value-row th {
  color: var(--week-value-color) !important;
  font-weight: bold !important;
}

/* "daily homework title" row background color and custom text color */
.daily-homework-title {
  background-color: var(--title-row-bg);
  color: var(--title-text-color);
  font-weight: 600;
}

/* Unique background colors for the table headers */
.heading-hissa {
  background-color: var(--heading-hissa-bg);
}
.heading-madda {
  background-color: var(--heading-madda-bg);
}
.heading-lesson {
  background-color: var(--heading-lesson-bg);
}
.heading-hw {
  background-color: var(--heading-hw-bg);
}
.heading-teacher {
  background-color: var(--heading-teacher-bg);
}

/* Footer row styling */
.footer-row {
  background-color: var(--footer-row-bg);
  color: var(--footer-text-color);
}

/* Messages (errors, success) */
.message {
  text-align: center;
  font-weight: 600;
  margin: 1rem auto;
}
.message.error {
  color: #e74c3c;
}
.message.success {
  color: #2ecc71;
}

/* Footer text at bottom */
.footer {
  margin-top: 2rem;
  text-align: center;
  font-size: 0.9rem;
  color: #666;
}

/* Advanced header for ministry + logos inside the table's <th> */
.advanced-header .row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: nowrap; 
}

/* ========== A4-Landscape Simulation ========== */
#a4-landscape {
  width: 1123px;
  margin: 0 auto;
  background: #fff;
  position: relative;
  box-shadow: 0 0 5px rgba(0,0,0,0.3);
}
#a4-padding {
  padding: 40px;
}

/* Remove vertical dividing line in last row */
#view-table-container.screenshot-mode #a4-landscape {
  /* e.g., overflow: hidden; */
}


/* =========== Enhanced Edit Page Styling =========== */

/* Container and overall layout */
.container {
  max-width: 900px;
  margin: 2rem auto;
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 5px 20px rgba(0,0,0,0.08);
  padding: 2rem;
}

/* Nav links at top (optional) */
.nav-links {
  display: flex;
  gap: 1rem;
  justify-content: center;
  margin-bottom: 1.5rem;
}
.nav-links a {
  background: #0d6efd;
  color: #fff;
  padding: 0.6rem 1.4rem;
  border-radius: 5px;
  text-decoration: none;
  transition: background 0.3s;
}
.nav-links a:hover {
  background: #0b5ed7;
}

/* Headings */
h2 {
    text-align: center;
    margin-bottom: 1.5rem;
    font-size: 1.8rem;
    color: #00663d;
}

/* Forms */
form {
  display: flex;
  flex-wrap: wrap; /* allow items to wrap on smaller screens */
  gap: 1rem;
  margin-bottom: 1.5rem;
}

form label {
  display: block;
  margin-bottom: 0.4rem;
  font-weight: 600;
  color: #333;
}
form input[type="text"],
form textarea,
form select {
  width: 100%;
  padding: 0.6rem;
  border: 1px solid #ddd;
  border-radius: 5px;
  font-size: 1rem;
}
form button {
  background: #198754;
  color: #fff;
  padding: 0.7rem 1.4rem;
  border: none;
  border-radius: 5px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.3s;
  align-self: flex-start; /* place the button at the start of the row */
}
form button:hover {
  background: #157347;
}

/* Specific forms */
#teacher-id-form {
  flex-direction: column;
}
#teacher-id-form input[type="text"] {
  max-width: 250px;
}
#teacher-id-error {
  margin-top: 0.5rem;
}

#edit-form {
  display: none; /* hidden until teacher logs in */
  flex-direction: column;
}

/* Feedback messages */
.message {
  font-weight: 600;
  text-align: center;
  margin-top: 1rem;
}
.message.error {
  color: #e74c3c;
}
.message.success {
  color: #2ecc71;
}

/* Footer */
.footer {
  text-align: center;
  margin-top: 2rem;
  font-size: 0.9rem;
  color: #666;
}

/* ========== Responsive Design ========== */
@media (max-width: 768px) {
  form {
    flex-direction: column; /* stack form fields vertically on smaller screens */
  }
  .container {
    margin: 1rem;
    padding: 1.5rem;
  }
  h2 {
    font-size: 1.6rem;
  }
  form button {
    align-self: stretch; /* make button full-width on small screens */
  }
}

/****************************************
 * Premium Responsive Style for Home Page
 ****************************************/

/* Container with a nice shadow, spacing */
.container {
  max-width: 1200px;
  margin: 2rem auto;
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 5px 20px rgba(0,0,0,0.08);
  padding: 2rem;
}

/* Advanced header styling */
.advanced-header {
  margin-bottom: 1.5rem;
  background: #fafafa;
  border-radius: 6px;
  padding: 1rem;
}
.advanced-header .row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap; /* allow text and logo to wrap on smaller screens */
}
.advanced-header img {
  max-width: 140px;
}
.advanced-header div div {
  margin-bottom: 0.2rem;
  font-size: 0.9rem;
  color: #555;
}

/* Heading */
h1 {
  text-align: center;
  margin-bottom: 1.2rem;
  color: #2c3e50;
}

/* Paragraph for instructions */
p {
  text-align: center;
  margin-bottom: 1.5rem;
  color: #444;
  font-size: 1rem;
}

/* Navigation links for the main 3 buttons */
.nav-links {
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  margin-bottom: 2rem;
}
.nav-links a {
  display: inline-block;
  color: #fff;
  text-decoration: none;
  font-weight: 600;
  font-size: 1.1rem;
  padding: 0.8rem 1.6rem;
  border-radius: 6px;
  transition: background 0.3s;
}

/* Distinct button colors */
.leader-btn {
  background-color: #75b600; /* color 1 */
}
.leader-btn:hover {
  background-color: #659f00; /* slightly darker on hover */
}

.teacher-btn {
  background-color: #60a2ca; /* color 2 */
}
.teacher-btn:hover {
  background-color: #4b87a5;
}

.archive-btn {
  background-color: #d5ba35; /* color 3 */
}
.archive-btn:hover {
  background-color: #c2a82f;
}

/* Footer styling */
.footer {
  margin-top: 2rem;
  text-align: center;
  font-size: 0.9rem;
  color: #666;
}

/* Responsive design for smaller screens */
@media (max-width: 768px) {
  .row {
    flex-direction: column;
    align-items: flex-start;
  }
  .nav-links {
    flex-direction: column;
    align-items: center;
    gap: 1rem;
  }
  .nav-links a {
    width: 80%; /* or 100% if you prefer full width on mobile */
    text-align: center;
  }
}

/* Example: put all your .leader-btn, .teacher-btn, .archive-btn rules near the bottom. */

.nav-links {
  display: flex;
  gap: 1.5rem;
  justify-content: center;
  margin-bottom: 2rem;
}

/* For each button, ensure we override link states (link & visited). */
.nav-links a.leader-btn:link,
.nav-links a.leader-btn:visited {
  background-color: #75b600;
  color: #fff;
  text-decoration: none;
  font-weight: 600;
  font-size: 1.1rem;
  padding: 0.8rem 1.6rem;
  border-radius: 6px;
  transition: background 0.3s;
}
.nav-links a.leader-btn:hover {
  background-color: #659f00; /* slightly darker */
}
.nav-links a.leader-btn:active {
  background-color: #588800; /* optional active state */
}

/* Similarly for teacher-btn and archive-btn: */
.nav-links a.teacher-btn:link,
.nav-links a.teacher-btn:visited {
  background-color: #60a2ca;
  color: #fff;
  /* etc. */
}
.nav-links a.teacher-btn:hover {
  background-color: #4b87a5;
}

.nav-links a.archive-btn:link,
.nav-links a.archive-btn:visited {
  background-color: #d5ba35;
  color: #fff;
}
.nav-links a.archive-btn:hover {
  background-color: #c2a82f;
}

/* Button for "الوجبات LIVE" with #78ffe5 background and black text */
.nav-links a.live-btn:link,
.nav-links a.live-btn:visited {
  background-color: #78ffe5; /* New background color */
  color: #000;              /* Black text */
  text-decoration: none;
  font-weight: 600;
  font-size: 1.1rem;
  padding: 0.8rem 1.6rem;
  border-radius: 6px;
  transition: background 0.3s;
}

.nav-links a.live-btn:hover {
  background-color: #5fdcc7; /* Slightly darker shade on hover */
}

.nav-links a.live-btn:active {
  background-color: #4ab0a0; /* Another shade for active state */
}

/* Add small pulsating live indicator in top-left corner */
.nav-links a.live-btn {
  position: relative;
}

.nav-links a.live-btn::after {
  content: "🔴 مباشر";
  position: absolute;
  top: -8px;
  left: -8px;
  background: #ff4444;
  color: white;
  font-size: 0.7rem;
  padding: 2px 6px;
  border-radius: 4px;
  white-space: nowrap;
  animation: fastPulse 0.8s infinite;
  box-shadow: 0 2px 4px rgba(0,0,0,0.3);
  z-index: 1;
}

/* Fast pulsating animation */
@keyframes fastPulse {
  0% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.6;
    transform: scale(1.05);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}



/******************************************************
 * Premium & Responsive Style for the Teacher Login
 ******************************************************/

/* Container overarching layout */
.container {
  max-width: 900px;
  margin: 2rem auto;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
  padding: 2rem;
}

/* Navigation links at the top */
.nav-links {
  display: flex;
  gap: 1rem;
  justify-content: center;
  margin-bottom: 2rem;
}
.nav-links a {
  background: #0d6efd;
  color: #fff;
  padding: 0.6rem 1.4rem;
  border-radius: 5px;
  text-decoration: none;
  font-weight: 600;
  transition: background 0.3s;
}
.nav-links a:hover {
  background: #0b5ed7;
}

/* Header & Footer */
h2 {
    text-align: center;
    font-size: 1.8rem;
    color: #00663d;
    margin-bottom: 1.5rem;
}
.footer {
  text-align: center;
  margin-top: 2rem;
  font-size: 0.9rem;
  color: #666;
}

/* ========== Teacher ID Form (Login) ========== */
#teacher-id-form {
  background: #fafafa;
  border: 1px solid #ddd;
  border-radius: 6px;
  padding: 1.5rem;
  margin-bottom: 2rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* Teacher ID label */
#teacher-id-form label {
  font-weight: 600;
  color: #333;
  margin-bottom: 0.5rem;
}

/* Teacher ID text input */
#teacher-id-form input[type="text"] {
  padding: 0.7rem;
  border: 1px solid #ccc;
  border-radius: 5px;
  font-size: 1rem;
  max-width: 300px;
}

/* Teacher ID button */
#teacher-id-form button {
  background: #198754;
  color: #fff;
  padding: 0.7rem 1.4rem;
  border: none;
  border-radius: 5px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.3s;
  align-self: flex-start;
}
#teacher-id-form button:hover {
  background: #157347;
}

/* Error message styling */
#teacher-id-error {
  display: none; /* shown dynamically */
  font-weight: 600;
  color: #e74c3c;
  margin-top: -0.5rem;
}

/* ========== The Edit Form ========== */
#edit-form {
  display: none; /* hidden until teacher logs in */
  flex-direction: column;
  gap: 1rem;
}

/* Edit form label, inputs, etc. */
#edit-form label {
  font-weight: 600;
  margin-bottom: 0.4rem;
  color: #333;
}
    #edit-form select,
    #edit-form textarea {
        width: 100%;
        padding: 0.7rem;
        border: 2px solid #00663d;
        border-radius: 5px;
        font-size: 1rem;
    }
    #edit-form button {
        background: #00663d;
        color: #fff;
        padding: 0.7rem 1.4rem;
        border: none;
        border-radius: 5px;
        font-weight: 600;
        font-family: "Tajawal";
        cursor: pointer;
        transition: background 0.3s;
    }
#edit-form button:hover {
  background: #157347;
}

/* Feedback message below the forms */
.message {
  text-align: center;
  font-weight: 600;
  margin-top: 1rem;
}
.message.error {
  color: #e74c3c;
}
.message.success {
  color: #2ecc71;
}

/* ========== Responsive Design for smaller screens ========== */
@media (max-width: 768px) {
  .container {
    margin: 1rem;
    padding: 1.5rem;
  }
  #teacher-id-form,
  #edit-form {
    gap: 1rem;
  }
  #teacher-id-form input[type="text"] {
    max-width: 100%;
  }
}


/* Container to hold the toggle switch */
.toggle-container {
  position: relative;
  width: 60px;   /* Adjust width as desired */
  height: 30px;  /* Adjust height as desired */
}

/* Hide the actual checkbox */
.toggle-container input[type="checkbox"] {
  display: none;
}

/* The "track" of the toggle switch */
.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: red;        /* Initial color (red) */
  border-radius: 30px;          /* Rounded edges to create an oval */
  transition: background-color 0.4s;
}

/* The "knob" of the toggle switch */
.slider::before {
  content: "";
  position: absolute;
  width: 22px;      /* Adjust knob size as desired */
  height: 22px;
  left: 4px;        /* Distance from left */
  top: 4px;         /* Distance from top */
  background-color: #fff;
  border-radius: 50%;
  transition: transform 0.4s;
}

/* When the checkbox is checked, change background to green */
.toggle-container input[type="checkbox"]:checked + .slider {
  background-color: green;      /* Color when toggled (green) */
}

/* Move the knob to the right when checked */
.toggle-container input[type="checkbox"]:checked + .slider::before {
  transform: translateX(30px);  /* Adjust based on your width */
}



