/* ===============================================
   Unified Style Sheet – البرنامج القومي لتنمية اللغة العربية
   Responsive, RTL, Modern Design
   =============================================== */

/* ---------- CSS Variables ---------- */
:root {
  --primary: #0d6e6e;
  --primary-dark: #0a5555;
  --primary-light: #1b8a8a;
  --accent: #f0b429;
  --accent-dark: #d49f1a;
  --text-dark: #16324f;
  --text-muted: #4a627a;
  --bg-light: #f4f7f8;
  --white: #ffffff;
  --border: #dbe5e8;
  --shadow: 0 10px 25px rgba(0, 0, 0, 0.05);
  --shadow-hover: 0 15px 35px rgba(13, 110, 110, 0.15);
  --radius: 16px;
  --radius-sm: 12px;
}

/* ---------- Global Reset & Base ---------- */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Tajawal', 'Segoe UI', Arial, sans-serif;
  background-color: var(--bg-light);
  color: var(--text-dark);
  line-height: 1.6;
  direction: rtl;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ---------- Typography ---------- */
h1, h2, h3 {
  font-weight: 700;
  line-height: 1.3;
}

/* ---------- Header (unified across all pages) ---------- */
.program-header {
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: var(--white);
  padding: 0.8rem 0;
  border-bottom: 4px solid var(--accent);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.header-content {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  gap: 1rem;
  flex-wrap: wrap;
}

.logo-right, 
.logo-left {
  height: 70px;
  width: auto;
  max-width: 100%;
  object-fit: contain;
  display: inline-block;
}

.title-container {
  flex: 1;
  text-align: center;
}

.program-title {
  font-size: 1.4rem;
  font-weight: 700;
  margin: 0;
  color: var(--white);
}

/* ---------- Buttons ---------- */
.btn, 
.submit-button, 
button[type="submit"],
.save-btn {
  display: inline-block;
  background: var(--primary);
  color: var(--white);
  padding: 12px 32px;
  border: none;
  border-radius: 12px;          /* Square with subtle rounding */
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.25s ease;
  text-decoration: none;
  text-align: center;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.btn:hover, 
.submit-button:hover, 
button[type="submit"]:hover,
.save-btn:hover {
  background: var(--accent);
  color: var(--text-dark);
  transform: translateY(-2px);
  box-shadow: var(--shadow-hover);
}

/* Secondary / outline variant */
.btn-outline {
  background: transparent;
  border: 2px solid var(--primary);
  color: var(--primary);
  border-radius: 12px;
}

.btn-outline:hover {
  background: var(--primary);
  color: var(--white);
}


/* ---------- Cards & Containers ---------- */
.card, .welcome-card, .login-card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: transform 0.2s, box-shadow 0.2s;
}

.card:hover, .welcome-card:hover, .login-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-hover);
}

.card-header, .login-header {
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  padding: 1.2rem;
  text-align: center;
}

.card-header h2, .login-header h2 {
  color: var(--white);
  margin: 0;
  font-size: 1.5rem;
}

.card-body, .login-body {
  padding: 2rem;
}

/* ---------- Forms (unified) ---------- */
.form-group {
  margin-bottom: 1.5rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 600;
  color: var(--text-dark);
}

.form-control, select.form-control, input.form-control {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 1rem;
  transition: all 0.2s;
  background: var(--white);
  font-family: inherit;
}

.form-control:focus, select.form-control:focus {
  border-color: var(--primary);
  outline: none;
  box-shadow: 0 0 0 3px rgba(13, 110, 110, 0.2);
}

select.form-control {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2316324f' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: left 1rem center;
  background-size: 16px;
}

/* Error & helper texts */
.error-message {
  color: #dc3545;
  font-size: 0.8rem;
  margin-top: 5px;
  display: none;
}

.form-text {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 5px;
}

/* ---------- Top Bar (dashboard) ---------- */
.topbar {
  background: var(--white);
  width: 95%;
  margin: 20px auto;
  padding: 12px 25px;
  border-radius: 50px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  box-shadow: 0 5px 12px rgba(0, 0, 0, 0.05);
}

.topbar .welcome {
  font-weight: 700;
  color: var(--primary);
}

.topbar-links a {
  color: var(--primary);
  text-decoration: none;
  font-weight: 600;
  margin-right: 20px;
  transition: color 0.2s;
}

.topbar-links a:hover {
  color: var(--accent);
}

/* ---------- Filter Row (school/grade selectors) ---------- */
.form-row1 {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  background: var(--white);
  padding: 20px;
  border-radius: var(--radius);
  width: 95%;
  margin: 20px auto;
  box-shadow: 0 5px 12px rgba(0, 0, 0, 0.05);
}

.form-group1 {
  flex: 1;
  min-width: 180px;
}

.form-group1 label {
  font-weight: 600;
  margin-bottom: 8px;
  display: block;
}

/* Counters */
.counters {
  display: flex;
  justify-content: center;
  gap: 25px;
  flex-wrap: wrap;
  margin: 20px auto;
  font-weight: 600;
  background: var(--white);
  padding: 12px 20px;
  border-radius: 50px;
  width: fit-content;
  box-shadow: var(--shadow);
}

/* ---------- Table Styles (responsive) ---------- */
#studentsTableContainer {
  width: 95%;
  margin: 20px auto;
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: var(--white);
  border-radius: var(--radius-sm);
  overflow: hidden;
  box-shadow: var(--shadow);
}

th, td {
  border: 1px solid var(--border);
  padding: 12px 8px;
  text-align: center;
  vertical-align: middle;
}

th {
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: var(--white);
  font-weight: 700;
}

tr:nth-child(even) {
  background-color: #f9fbfc;
}

tr:hover {
  background-color: #f0f7f7;
}

/* Inputs inside table */
input[type="number"] {
  width: 65px;
  padding: 8px;
  text-align: center;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.9rem;
}

input[type="radio"], input[type="checkbox"] {
  margin: 0 5px;
  transform: scale(1.1);
}

.save-btn {
  background: var(--primary);
  color: white;
  border: none;
  padding: 8px 18px;
  border-radius: 30px;
  cursor: pointer;
  font-weight: 600;
  transition: 0.2s;
  font-size: 0.9rem;
}

.save-btn:hover {
  background: var(--accent);
  color: var(--text-dark);
}

/* Disability select within table */
.disability-type {
  margin-top: 8px;
  padding: 5px;
  border-radius: 8px;
  border: 1px solid var(--border);
  width: 100%;
}

/* ---------- Index Page (welcome card with background) ---------- */
body.index-page {
  background: linear-gradient(rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0.5)), url('read.jpg') center/cover fixed;
}

.main-container {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.welcome-card {
  max-width: 750px;
  width: 90%;
  text-align: center;
  padding: 40px 30px;
}

.welcome-card .program-title {
  color: var(--primary);
  margin-bottom: 30px;
  font-size: 2rem;
}

.buttons {
  display: flex;
  justify-content: center;
  gap: 25px;
  flex-wrap: wrap;
}

/* ---------- Responsive (Mobile first adjustments) ---------- */
@media (max-width: 768px) {
  .header-content {
    flex-direction: column;
    text-align: center;
  }
  .logo-right, .logo-left {
    height: 55px;
  }
  .program-title {
    font-size: 1.1rem;
  }
  .card-body, .login-body {
    padding: 1.2rem;
  }
  .form-row1 {
    flex-direction: column;
    gap: 12px;
  }
  .topbar {
    flex-direction: column;
    text-align: center;
    border-radius: 20px;
  }
  .topbar-links a {
    margin: 0 10px;
  }
  .counters {
    flex-direction: column;
    align-items: center;
    gap: 8px;
    border-radius: 20px;
  }
  th, td {
    padding: 8px 4px;
    font-size: 0.85rem;
  }
  input[type="number"] {
    -moz-appearance: textfield;
     appearance: textfield;
    width: 50px;
  }
  .save-btn {
    padding: 5px 12px;
    font-size: 0.8rem;
  }
  .welcome-card {
    padding: 25px;
  }
  .welcome-card .program-title {
    font-size: 1.4rem;
  }
  .btn {
    padding: 10px 20px;
    min-width: 160px;
  }
}

/* For very small devices */
@media (max-width: 480px) {
  .form-group1 {
    min-width: 100%;
  }
  table, .table-responsive {
    display: block;
    overflow-x: auto;
    white-space: nowrap;
  }

  @media (max-width: 768px) {
  .logo-right, .logo-left {
    height: 55px;
  }
}
}