@font-face {
  font-family: "Vazirmatn";
  src: url("fonts/Vazirmatn-Regular.ttf") format("truetype");
  font-weight: 400; font-display: swap;
}
@font-face {
  font-family: "Vazirmatn";
  src: url("fonts/Vazirmatn-Medium.ttf") format("truetype");
  font-weight: 500; font-display: swap;
}
@font-face {
  font-family: "Vazirmatn";
  src: url("fonts/Vazirmatn-Bold.ttf") format("truetype");
  font-weight: 700; font-display: swap;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  background-image: url("images/background.jpg");
  background-repeat: no-repeat;
  background-position: center center;
  background-size: cover;
  background-attachment: fixed;


  font-family: "Vazirmatn", sans-serif;
  min-height: 100vh;
  direction: rtl;
}

nav {
  direction: ltr;
  background: rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
  padding: 0;
  height: auto;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  width: 100%;
}

.nav-title-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 10px 30px 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.15);
  position: relative;
}

.nav-brand {
  font-size: 20px;
  font-weight: 700;
  color: white;
  text-decoration: none;
  position: absolute;
  right: 30px;
}

.app-title {
  color: #FFD166;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  font-weight: 700;

  display: block;
  width: 100%;
  font-size: clamp(9px, 2.3vw, 18px);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: center;
  line-height: 1.3;
}

.nav-actions-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 30px;
  min-height: 64px;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.nav-link {
  color: rgba(255, 255, 255, 0.9);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  padding: 8px 18px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  transition: background 0.2s, border-color 0.2s;
  background: none;
  cursor: pointer;
  font-family: "Vazirmatn", sans-serif;
}

.nav-link:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.6);
}

.nav-link.primary {
  background: white;
  color: #667eea;
  border-color: white;
  font-weight: 700;
}

.nav-link.primary:hover { background: #f0f4ff; }

.logout-btn {
  background: rgba(255, 255, 255, 0.15);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.35);
  padding: 8px 18px;
  border-radius: 8px;
  font-family: "Vazirmatn", sans-serif;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
}

.logout-btn:hover {
  background: rgba(255, 80, 80, 0.35);
  border-color: rgba(255, 150, 150, 0.6);
}

.help-btn {
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 8px;
  padding: 6px 14px;
  color: white;
  background: rgba(255, 255, 255, 0.1);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
  font-family: "Vazirmatn", sans-serif;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.help-btn:hover {
  background: rgba(255, 255, 255, 0.18);
  border-color: rgba(255, 255, 255, 0.5);
}

.page-wrapper {
  padding: 130px 20px 40px;
  min-height: calc(100vh - 64px);
}

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-box {
  background: white;
  border-radius: 12px;
  padding: 36px 32px 28px;
  width: 390px;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 14px;
  direction: rtl;
  font-family: "Vazirmatn", sans-serif;
}

.modal-title {
  font-size: 16px;
  font-weight: 700;
  color: #333;
  margin-bottom: 2px;
}

.modal-close {
  position: absolute;
  top: 12px;
  left: 14px;
  background: none;
  border: none;
  font-size: 16px;
  cursor: pointer;
  color: #888;
}

.modal-close:hover { color: #333; }

.modal-input {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid #ccc;
  border-radius: 8px;
  font-family: "Vazirmatn", sans-serif;
  font-size: 14px;
  direction: ltr;
  text-align: center;
}

.modal-hint {
  font-size: 13px;
  color: #555;
  line-height: 1.6;
}

.modal-error {
  font-size: 13px;
  color: #e00;
}

.modal-submit {
  width: 100%;
  padding: 11px;
  background: #667eea;
  color: white;
  border: none;
  border-radius: 8px;
  font-family: "Vazirmatn", sans-serif;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s;
}

/* ------------------------------------------------ */
/* NAV BUTTONS - UNIFIED DESKTOP/MOBILE */
/* ------------------------------------------------ */

.nav-link,
.logout-btn {
  width: 132px;
  min-height: 54px;

  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;

  padding: 7px 10px;
  text-align: center;
  line-height: 1.3;

  background: rgba(255,255,255,0.92);
  color: #2563eb;
  border: 1px solid #93c5fd;
  border-radius: 8px;
}

.nav-link.primary {
  background: rgba(255,255,255,0.92);
  color: #16a34a;
  border-color: #86efac;
}

.logout-btn {
  color: #ef4444;
  border-color: #fca5a5;
}

.help-btn {
  color: #2563eb;
  border-color: #93c5fd;
  background: rgba(255,255,255,0.92);
}

.nav-link::before,
.logout-btn::before {
  font-size: 20px;
  line-height: 1;
  display: block;
}

.icon-logout::before {
  content: "↪";
  color: #ef4444;
  font-weight: 700;
}

.icon-user::before {
  content: "👤";
}

.icon-help::before {
  content: "؟";
  color: #2563eb;
  font-size: 26px;
  font-weight: 700;
}

.icon-dashboard::before {
  content: "🏠";
  color: #16a34a;
}

.icon-login::before {
  content: "🔑";
  color: #2563eb;
}

.icon-signup::before {
  content: "✍️";
  color: #16a34a;
}

.icon-guest-results::before {
  content: "📄";
  color: #7c3aed;
}

.nav-user-name {
  max-width: 132px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

/* ------------------------------------------------ */
/* MOBILE NAV */
/* ------------------------------------------------ */

@media (max-width: 768px) {
  .nav-title-row {
    width: 100%;
    padding: 8px 12px;
    justify-content: center;
  }

  .app-title {
    width: 100%;
    max-width: 100%;
    margin: 0;

    font-size: clamp(12px, 2.8vw, 18px);
    font-weight: 700;
    line-height: 1.35;
    text-align: center;

    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
  }

  .nav-brand {
    right: 14px;
    font-size: 18px;
  }

  .nav-actions-row {
    padding: 8px 10px;
    gap: 8px;
  }

  .nav-actions {
    gap: 8px;
  }

  .nav-link,
  .logout-btn {
    width: 44px;
    height: 42px;
    min-height: 42px;
    padding: 0;
    font-size: 0;
    flex-direction: row;
  }

  .nav-link::before,
  .logout-btn::before {
    font-size: 22px;
  }

  .icon-help::before {
    font-size: 28px;
  }
}

.modal-submit:hover { background: #5568d4; }
