@font-face {
  font-family: 'Cairo';
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url('/fonts/cairo-arabic.woff2') format('woff2');
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC, U+102E0-102FB, U+10E60-10E7E, U+10EC2-10EC4, U+10EFC-10EFF, U+1EE00-1EE03, U+1EE05-1EE1F, U+1EE21-1EE22, U+1EE24, U+1EE27, U+1EE29-1EE32, U+1EE34-1EE37, U+1EE39, U+1EE3B, U+1EE42, U+1EE47, U+1EE49, U+1EE4B, U+1EE4D-1EE4F, U+1EE51-1EE52, U+1EE54, U+1EE57, U+1EE59, U+1EE5B, U+1EE5D, U+1EE5F, U+1EE61-1EE62, U+1EE64, U+1EE67-1EE6A, U+1EE6C-1EE72, U+1EE74-1EE77, U+1EE79-1EE7C, U+1EE7E, U+1EE80-1EE89, U+1EE8B-1EE9B, U+1EEA1-1EEA3, U+1EEA5-1EEA9, U+1EEAB-1EEBB, U+1EEF0-1EEF1;
}

@font-face {
  font-family: 'Cairo';
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url('/fonts/cairo-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: 'Cairo';
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url('/fonts/cairo-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Cairo', 'Segoe UI', Tahoma, sans-serif;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  direction: rtl;
}

input,
textarea,
select,
button {
  font-family: inherit;
}

.container {
  background: white;
  border-radius: 20px;
  padding: 50px 40px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.15);
  width: 90%;
  max-width: 700px;
  text-align: center;
  transition: all 0.4s ease;
}

.school-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 15px;
  margin-bottom: 5px;
}

.school-icon-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.school-date {
  font-size: 14px;
  color: #000;
  white-space: nowrap;
}

.school-icon {
  width: 50px;
  height: 50px;
  border-radius: 8px;
  object-fit: contain;
}

.school-name {
  font-size: 44px;
  font-weight: bold;
  color: #764ba2;
}

h1 {
  color: #333;
  font-size: 28px;
  margin-bottom: 10px;
}

.subtitle {
  color: #666;
  font-size: 18px;
  margin-bottom: 30px;
}

.search-box {
  width: 100%;
  padding: 22px 25px 22px 60px;
  font-size: 26px;
  border: 3px solid #d0d0d0;
  border-radius: 16px;
  outline: none;
  transition: all 0.3s ease;
  text-align: center;
  letter-spacing: 3px;
  background: #fafafa;
  box-shadow: inset 0 2px 8px rgba(0,0,0,0.06), 0 4px 20px rgba(102, 126, 234, 0.1);
}

.search-box:focus {
  border-color: #667eea;
  background: #fff;
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.02), 0 0 0 4px rgba(102, 126, 234, 0.15), 0 8px 30px rgba(102, 126, 234, 0.2);
}

.search-box::placeholder {
  color: #bbb;
  letter-spacing: 1px;
}

.search-wrapper {
  position: relative;
  width: 100%;
}

.search-icon {
  position: absolute;
  left: 22px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 22px;
  color: #667eea;
  pointer-events: none;
  transition: transform 0.3s;
}

.search-box:focus ~ .search-icon {
  transform: translateY(-50%) scale(1.15);
}

.search-hint {
  margin-top: 8px;
  color: #aaa;
  font-size: 12px;
  text-align: center;
}

.total-certificates {
  margin-top: 10px;
  color: #888;
  font-size: 14px;
  text-align: center;
}

.update-notification {
  margin-top: 10px;
  padding: 10px;
  background: #d4edda;
  color: #155724;
  border-radius: 8px;
  font-size: 14px;
  text-align: center;
}

.update-notification a {
  color: #155724;
  font-weight: bold;
}

.btn {
  display: inline-block;
  padding: 18px 50px;
  font-size: 22px;
  border: none;
  border-radius: 15px;
  cursor: pointer;
  font-weight: bold;
  transition: all 0.3s;
  margin-top: 20px;
  min-width: 250px;
}

.btn-primary {
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: white;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 30px rgba(102, 126, 234, 0.4);
}

.btn-danger {
  background: #e74c3c;
  color: white;
}

.btn-danger:hover {
  background: #c0392b;
}

.admin-link {
  display: inline-block;
  margin-top: 40px;
  color: #000;
  text-decoration: none;
  font-size: 14px;
  font-weight: bold;
  transition: color 0.3s;
}

.admin-link:hover {
  color: #667eea;
}

.visitor-count {
  margin-top: 5px;
  color: #aaa;
  font-size: 16px;
  text-align: center;
}

.home-links {
  display: flex;
  flex-direction: column;
  gap: 20px;
  margin-bottom: 25px;
}

.home-links-row {
  display: flex;
  gap: 15px;
}

.home-links-row .home-link {
  flex: 1;
  font-size: 17px;
  padding: 15px 14px;
  gap: 10px;
}

.home-links-row .home-link-icon {
  font-size: 26px;
}

.stats-grid {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  justify-content: space-between;
  gap: 12px;
  margin: 30px 0 10px;
}

.stat-card {
  flex: 1;
  min-width: 0;
  background: #f8f9ff;
  border: 2px solid #e3e6f5;
  border-radius: 15px;
  padding: 18px 10px;
  text-align: center;
  transition: all 0.3s ease;
}

.stat-card:hover {
  border-color: #667eea;
  transform: translateY(-3px);
  box-shadow: 0 8px 20px rgba(102, 126, 234, 0.2);
}

.stat-icon {
  font-size: 36px;
  margin-bottom: 8px;
}

.stat-number {
  font-size: 30px;
  font-weight: 800;
  color: #667eea;
  line-height: 1.2;
}

.stat-label {
  font-size: 13px;
  color: #777;
  margin-top: 4px;
}

@media (max-width: 600px) {
  .stats-grid {
    gap: 8px;
  }
  .stat-card {
    padding: 14px 6px;
  }
  .stat-number {
    font-size: 22px;
  }
  .stat-icon {
    font-size: 28px;
  }
  .stat-label {
    font-size: 12px;
  }
}

.home-link {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 15px;
  padding: 22px 20px;
  background: linear-gradient(135deg, #f8f9ff, #eef0fb);
  border: 2px solid #e3e6f5;
  border-radius: 15px;
  text-decoration: none;
  color: #333;
  font-size: 22px;
  font-weight: bold;
  transition: all 0.3s ease;
}

.home-link:hover {
  transform: translateY(-3px);
  border-color: #667eea;
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: white;
  box-shadow: 0 12px 30px rgba(102, 126, 234, 0.35);
}

.home-link-icon {
  font-size: 34px;
}

.home-link-text {
  flex: 1;
  text-align: right;
}

.social-icons {
  display: flex;
  justify-content: center;
  gap: 15px;
  margin-top: 25px;
}

.social-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.social-icon:hover {
  transform: translateY(-3px) scale(1.05);
}

.social-facebook {
  background: #1877f2;
}

.social-facebook:hover {
  box-shadow: 0 10px 20px rgba(24, 119, 242, 0.4);
}

.social-whatsapp {
  background: #25d366;
}

.social-whatsapp:hover {
  box-shadow: 0 10px 20px rgba(37, 211, 102, 0.4);
}

.about-card {
  background: #fff;
  border: 2px solid #e3e6f5;
  border-radius: 15px;
  padding: 25px;
  margin-top: 10px;
  text-align: right;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
}

.about-text {
  font-size: 17px;
  line-height: 2;
  color: #444;
  margin: 0 0 15px 0;
}

.about-info {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 10px;
}

.about-info-item {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #f8f9ff;
  border-radius: 10px;
  padding: 12px 15px;
}

.about-info-icon {
  font-size: 24px;
}

.about-info-label {
  font-size: 13px;
  color: #999;
}

.about-info-value {
  font-size: 16px;
  color: #333;
  font-weight: bold;
}

@media (max-width: 600px) {
  .home-link {
    font-size: 18px;
    padding: 18px 15px;
  }
  .home-link-icon {
    font-size: 26px;
  }
}

.excellence-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 15px;
  margin: 20px 0;
}

.excellence-card {
  background: #fff;
  border: 2px solid #e3e6f5;
  border-radius: 15px;
  overflow: hidden;
  text-align: center;
  transition: all 0.3s ease;
  box-shadow: 0 4px 12px rgba(0,0,0,0.06);
}

.excellence-card:hover {
  transform: translateY(-4px);
  border-color: #667eea;
  box-shadow: 0 12px 30px rgba(102, 126, 234, 0.25);
}

.excellence-card-img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: contain;
  display: block;
  background: #f0f1fa;
}

.excellence-card-name {
  padding: 12px 10px;
  font-size: 15px;
  font-weight: bold;
  color: #333;
  line-height: 1.5;
}

@media (max-width: 600px) {
  .excellence-grid {
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 10px;
  }
  .excellence-card-name {
    font-size: 13px;
    padding: 10px 6px;
  }
}

.excellence-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 10px;
}

.file-upload-area.small {
  padding: 12px;
}

.img-preview {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #f8f9ff;
  border: 1px solid #e3e6f5;
  border-radius: 10px;
  padding: 8px;
}

.img-preview img {
  width: 50px;
  height: 50px;
  object-fit: contain;
  border-radius: 8px;
}

.img-preview-clear {
  cursor: pointer;
  color: #e74c3c;
  font-size: 18px;
  font-weight: bold;
}

.excellence-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 5px;
}

.excellence-item {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #f9f9fb;
  border: 1px solid #eee;
  border-radius: 10px;
  padding: 8px 12px;
}

.excellence-item-img {
  width: 40px;
  height: 40px;
  object-fit: contain;
  border-radius: 8px;
  background: #f0f1fa;
}

.excellence-item-name {
  flex: 1;
  font-size: 14px;
  font-weight: bold;
  color: #333;
  text-align: right;
}

.btn.small {
  padding: 6px 14px;
  font-size: 13px;
}

.excellence-empty {
  color: #999;
  text-align: center;
  padding: 15px;
  font-size: 14px;
}


.error-msg {
  color: #e74c3c;
  margin-top: 15px;
  font-size: 16px;
  display: none;
}

.student-name-box {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 15px;
  padding: 12px 18px;
  background: linear-gradient(135deg, #fce4ec, #f8bbd0);
  border: 1px solid #f48fb1;
  border-radius: 10px;
  direction: rtl;
}

.student-name-label {
  font-size: 16px;
  color: #c2185b;
  font-weight: bold;
}

.student-name-value {
  font-size: 18px;
  color: #880e4f;
  font-weight: bold;
}

.success-msg {
  color: #27ae60;
  margin-top: 15px;
  font-size: 16px;
  display: none;
}

.pdf-container {
  margin-top: 30px;
  display: none;
  text-align: center;
  animation: fadeInUp 0.5s ease;
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

.certificate-wrapper {
  width: 100%;
  border: 2px solid #e0e0e0;
  border-radius: 10px;
  background: white;
  padding: 10px;
  text-align: center;
  position: relative;
  min-height: 200px;
}

.iframe-loading {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  color: #999;
  font-size: 14px;
  z-index: 1;
}

.iframe-loading .spinner {
  margin: 0 auto 10px;
}

.separator {
  width: 80%;
  height: 1px;
  background: linear-gradient(to right, transparent, #ddd, transparent);
  margin: 0 auto 15px;
}

.page-number {
  font-size: 12px;
  color: #999;
  text-align: center;
  margin-top: 8px;
}

.certificate-wrapper canvas {
  display: block;
  margin: 0 auto;
  max-width: 100%;
  height: auto;
}

.action-buttons {
  display: none;
  gap: 10px;
  justify-content: center;
  margin-bottom: 15px;
  flex-wrap: wrap;
}

.action-buttons .btn {
  min-width: auto;
  padding: 12px 25px;
  font-size: 16px;
  flex: 1;
  max-width: 200px;
}

.btn-download {
  background: #27ae60;
  color: white;
}

.btn-download:hover {
  background: #219a52;
  transform: translateY(-2px);
  box-shadow: 0 10px 30px rgba(39, 174, 96, 0.4);
}

.btn-image {
  background: #2980b9;
  color: white;
}

.btn-image:hover {
  background: #2472a4;
  transform: translateY(-2px);
  box-shadow: 0 10px 30px rgba(41, 128, 185, 0.4);
}

.btn-whatsapp {
  background: #25D366;
  color: white;
}

.btn-whatsapp:hover {
  background: #1da851;
  transform: translateY(-2px);
  box-shadow: 0 10px 30px rgba(37, 211, 102, 0.4);
}

.overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.9);
  z-index: 9999;
  justify-content: center;
  align-items: center;
  cursor: pointer;
}

.overlay img {
  max-width: 95%;
  max-height: 95%;
  object-fit: contain;
}

.loading {
  display: none;
  margin: 20px 0;
}

.spinner {
  border: 4px solid #f3f3f3;
  border-top: 4px solid #667eea;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  animation: spin 1s linear infinite;
  margin: 0 auto;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.login-form {
  max-width: 400px;
  margin: 0 auto;
}

.login-form input {
  width: 100%;
  padding: 15px;
  margin: 10px 0;
  border: 2px solid #e0e0e0;
  border-radius: 10px;
  font-size: 18px;
  text-align: center;
}

.login-form input:focus {
  border-color: #667eea;
  outline: none;
}

.admin-panel {
  display: none;
}

.admin-panel.active {
  display: block;
}

.file-upload-area {
  border: 3px dashed #ccc;
  border-radius: 15px;
  padding: 40px;
  margin: 20px 0;
  cursor: pointer;
  transition: all 0.3s;
}

.file-upload-area:hover {
  border-color: #667eea;
  background: #f8f9ff;
}

.file-upload-area input[type="file"] {
  display: none;
}

.file-upload-label {
  font-size: 18px;
  color: #666;
  cursor: pointer;
}

.file-upload-label strong {
  color: #667eea;
}

.upload-status {
  margin-top: 15px;
  padding: 15px;
  border-radius: 10px;
  display: none;
}

.upload-status.success {
  display: block;
  background: #d4edda;
  color: #155724;
}

.upload-status.error {
  display: block;
  background: #f8d7da;
  color: #721c24;
}

button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.news-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  background: linear-gradient(135deg, #e8eaf6, #c5cae9);
  border: 1px solid #9fa8da;
  border-radius: 12px;
  padding: 10px 15px;
  margin: 10px 0 20px;
  overflow: hidden;
}

.banner-icon {
  font-size: 20px;
  flex-shrink: 0;
}

.banner-text-wrap {
  overflow: hidden;
  flex: 1;
}

.banner-text {
  display: inline-block;
  white-space: nowrap;
  font-size: 25px;
  color: #1a237e;
  transition: opacity 0.3s ease;
  animation: scrollBanner 20s linear infinite;
}

@keyframes scrollBanner {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

@media (max-width: 600px) {
  .container {
    padding: 30px 20px;
    width: 95%;
  }
  .school-icon {
    width: 30px;
    height: 30px;
  }
  .school-header {
    gap: 8px;
  }
  .school-name {
    font-size: 20px;
    line-height: 1.3;
    max-width: 65%;
  }
  .school-date {
    font-size: 12px;
    color: #000;
  }
  .search-box {
    font-size: 20px;
    padding: 16px 15px 16px 50px;
    letter-spacing: 2px;
  }
  .btn {
    font-size: 18px;
    padding: 14px 30px;
    min-width: auto;
    width: 100%;
  }
  h1 {
    font-size: 22px;
  }
  .action-buttons .btn {
    max-width: none;
  }
  .certificate-wrapper iframe {
    height: 60vh !important;
  }
}

.install-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 9999;
  display: none;
  align-items: center;
  gap: 10px;
  padding: 12px 15px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: #fff;
  font-size: 14px;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.2);
  transform: translateY(100%);
  transition: transform 0.35s ease;
}

.install-banner.show {
  display: flex;
  transform: translateY(0);
}

.install-icon {
  font-size: 22px;
}

.install-text {
  flex: 1;
  line-height: 1.4;
}

.install-btn {
  background: #fff;
  color: #764ba2;
  border: none;
  border-radius: 8px;
  padding: 8px 16px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}

.install-btn:hover {
  background: #f0ecff;
}

.install-close {
  background: transparent;
  color: rgba(255, 255, 255, 0.85);
  border: none;
  font-size: 18px;
  cursor: pointer;
  padding: 4px 6px;
  line-height: 1;
}
