/* ===== Base Styles ===== */
:root {
  --primary-color: #1E40AF;
  --primary-light: #3B82F6;
  --primary-dark: #1E3A8A;
  --accent-color: #D97706;
  --accent-light: #F59E0B;
  --success-color: #059669;
  --warning-color: #D97706;
  --error-color: #DC2626;
  --light-color: #F3F4F6;
  --dark-color: #1F2937;
  --gray-100: #F9FAFB;
  --gray-200: #E5E7EB;
  --gray-300: #D1D5DB;
  --gray-400: #9CA3AF;
  --gray-500: #6B7280;
  --gray-600: #4B5563;
  --gray-700: #374151;
  --gray-800: #1F2937;
  --gray-900: #111827;
  --border-radius: 8px;
  --box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  --transition: all 0.3s ease;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
}

body {
  font-family: 'Tajawal', sans-serif;
  line-height: 1.5;
  color: var(--gray-800);
  background-color: var(--gray-100);
  direction: rtl;
}

.container {
  width: 100%;
  max-width: 1000px;
  margin: 0 auto;
  padding: 2rem 1rem;
}

/* ===== Certificate Container ===== */
.certificate-container {
  background-color: white;
  border-radius: var(--border-radius);
  box-shadow: var(--box-shadow);
  overflow: hidden;
}

/* ===== Print Controls ===== */
.print-controls {
  display: flex;
  justify-content: center;
  gap: 1rem;
  padding: 1rem;
  background-color: var(--gray-100);
  border-bottom: 1px solid var(--gray-200);
}

.btn {
  padding: 0.5rem 1rem;
  border-radius: var(--border-radius);
  font-family: 'Tajawal', sans-serif;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  border: none;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.print-btn {
  background-color: var(--primary-color);
  color: white;
}

.print-btn:hover {
  background-color: var(--primary-dark);
}

.pdf-btn {
  background-color: var(--accent-color);
  color: white;
}

.pdf-btn:hover {
  background-color: var(--accent-light);
}

.home-btn {
  background-color: var(--gray-600);
  color: white;
}

.home-btn:hover {
  background-color: var(--gray-700);
}

/* ===== Certificate ===== */
.certificate {
  padding: 2rem;
  background-color: white;
  position: relative;
}

.certificate:before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image: url('../img/logo.png');
  background-repeat: no-repeat;
  background-position: center;
  background-size: 50%;
  opacity: 0.05;
  pointer-events: none;
}

/* ===== Certificate Header ===== */
.certificate-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 2px solid var(--primary-color);
}

.logo img {
  height: 80px;
  object-fit: contain;
}

.school-info {
  text-align: center;
  flex-grow: 1;
}

.school-info h1,
.school-info h2,
.school-info p {
  color: #ffffff;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.4);
}

.school-info h1 {
  font-size: 1.75rem;
  margin-bottom: 0.5rem;
}

.school-info h2 {
  font-size: 1.25rem;
  margin-bottom: 0.5rem;
}

.school-info p {
  font-size: 1rem;
}

/* ===== Student Info ===== */
.student-info {
  background-color: var(--gray-100);
  padding: 1rem;
  border-radius: var(--border-radius);
  margin-bottom: 2rem;
}

.info-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}

.info-row:last-child {
  margin-bottom: 0;
}

.info-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.label {
  font-weight: 700;
  color: var(--gray-700);
}

.value {
  color: var(--gray-800);
}

/* ===== Results Table ===== */
.results-table {
  margin-bottom: 2rem;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th, td {
  padding: 0.75rem;
  text-align: center;
  border: 1px solid var(--gray-300);
}

th {
  background-color: var(--primary-color);
  color: white;
  font-weight: 500;
}

tbody tr:nth-child(even) {
  background-color: var(--gray-100);
}

tfoot {
  font-weight: 700;
  background-color: var(--gray-200);
}

/* ===== Assessment ===== */
.assessment {
  background-color: var(--gray-100);
  padding: 1rem;
  border-radius: var(--border-radius);
  margin-bottom: 2rem;
}

.assessment h3 {
  color: var(--primary-color);
  margin-bottom: 0.5rem;
  font-size: 1.25rem;
}

/* ===== Certificate Footer ===== */
.certificate-footer {
  display: flex;
  justify-content: space-between;
  margin-top: 3rem;
  padding-top: 1rem;
  border-top: 1px dashed var(--gray-300);
}

.signature, .school-stamp {
  text-align: center;
  width: 40%;
}

.signature p, .school-stamp p {
  margin-bottom: 0.5rem;
  font-weight: 500;
}

.signature-placeholder, .stamp-placeholder {
  height: 60px;
  border: 1px dashed var(--gray-400);
  border-radius: var(--border-radius);
}

/* ===== Print Styles ===== */
@media print {
  body {
    background-color: white;
  }

  .container {
    width: 100%;
    max-width: none;
    padding: 0;
  }

  .certificate-container {
    box-shadow: none;
  }

  .print-controls {
    display: none;
  }

  .certificate {
    padding: 0;
  }
}

/* ===== Responsive Styles ===== */
@media (max-width: 768px) {
  html {
    font-size: 14px;
  }

  .container {
    padding: 1rem 0.5rem;
  }

  .certificate {
    padding: 1rem;
  }

  .certificate-header {
    flex-direction: column;
    gap: 1rem;
  }

  .school-info h1 {
    font-size: 1.5rem;
  }

  .school-info h2 {
    font-size: 1.2rem;
  }

  .info-row {
    flex-direction: column;
    gap: 0.5rem;
  }

  .certificate-footer {
    flex-direction: column;
    align-items: center;
    gap: 2rem;
  }

  .signature, .school-stamp {
    width: 80%;
  }
}
