﻿html {
  direction: rtl;
  height: 100%;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;

  background: var(--background);
  color: var(--text);

  font-family: IRANSans, Tahoma, sans-serif;
  line-height: 1.8;
}

/* ===========================
   Main Layout
=========================== */

#layout-main-container {
  display: flex;
  flex-direction: column;
  flex: 1;
  width: 100%;
}

#body-main-container {
  flex: 1;
  width: 100%;
  padding: 0;
}

/* ===========================
   Shared Container
=========================== */

.general-margin {
  width: min(100%, 1200px);
  margin-inline: auto;
  padding-inline: 20px;
}

/* ===========================
   Brand name (mobile only)
=========================== */

#brand-name {
  display: none;
}

/* ===========================
   Nav bar (mobile only)
   .nav becomes the fixed top strip
   containing brand-name + hamburger
=========================== */

@media (max-width: 1023px) {
  .nav {
    position: fixed;
    top: 0;
    inset-inline-start: 0;
    inset-inline-end: 0;
    height: 68px;
    z-index: 1002;

    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;

    background: var(--surface);
    border-bottom: 1px solid var(--border);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
    box-sizing: border-box;
  }

  #brand-name {
    display: flex;
    align-items: center;
    position: static;
    height: auto;
    margin: 0;
    font-size: 1.15rem;
    font-weight: 800;
    color: var(--primary);
    z-index: auto;
  }
}

/* ===========================
   Menu
=========================== */

#menu-bar {
  width: 100%;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-evenly;
  gap: 6px;
  padding: 14px 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  box-sizing: border-box;
}

#menu-bar a {
  display: inline-flex;
  align-items: center;
  padding: 8px 14px;
  font-size: 17px;
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
  border-radius: 8px;
  transition:
    background 0.15s ease,
    color 0.15s ease;
}

#menu-bar a:hover {
  background: rgba(var(--primary-rgb, 37, 99, 235), 0.08);
  color: var(--primary);
}

#menu-bar a:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: -2px;
}

#membershipFeePayment_Menu {
  color: var(--success, #16a34a);
}

#membershipFeePayment_Menu:hover {
  background: rgba(22, 163, 74, 0.08);
}

.desktop #menu-bar {
  justify-content: center;
}

/* ===========================
   User actions — styled as one
   unified button group, pushed
   to the far end of the bar
   (like a "Sign In" button)
=========================== */

#menu-user-actions {
  margin-right: auto;

  display: flex;
  align-items: center;
  gap: 14px;
}

.desktop #menu-user-actions {
  margin-inline-start: auto;
}

#name-of-user {
  padding: 8px 16px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
  background: transparent;
  border-radius: 999px;
  cursor: default;
  pointer-events: none;
}

#logout {
  padding: 8px 20px;
  font-size: 0.85rem;
  font-weight: 700;
  color: #fff;
  background: rgb(53, 160, 196);
  border-radius: 999px;
}

#logout:hover {
  background: var(--primary-hover);
  color: #fff;
}

/* ===========================
   Hamburger toggle (mobile/tablet)
=========================== */

#menu-toggle-checkbox {
  display: none;
}

#menu-toggle-label {
  display: none;
  flex-direction: column;
  justify-content: start;
  gap: 5px;
  width: 40px;
  height: 40px;
  padding: 8px;
  cursor: pointer;
  border-radius: 8px;
  transition: background 0.15s ease;
  box-sizing: border-box;
}

#menu-toggle-label:hover {
  background: rgba(var(--primary-rgb, 37, 99, 235), 0.08);
}

#menu-toggle-label span {
  display: block;
  height: 2px;
  width: 100%;
  background: var(--text);
  border-radius: 2px;
  transition:
    transform 0.25s ease,
    opacity 0.25s ease;
}

#menu-overlay {
  display: none;
}

@media (max-width: 1023px) {
  #menu-toggle-label {
    display: flex;
    position: static;
    z-index: auto;
    background: transparent;
    box-shadow: none;
  }

  #menu-bar {
    position: fixed;
    top: 0;
    inset-inline-end: 0;
    height: 100vh;
    width: 78%;
    max-width: 300px;

    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    gap: 2px;

    padding: 72px 16px 24px;
    background: var(--surface);
    border-bottom: none;
    border-inline-start: 1px solid var(--border);
    box-shadow: -8px 0 24px rgba(0, 0, 0, 0.08);

    transform: translateX(100%);
    transition: transform 0.3s ease;
    z-index: 1001;
    overflow-y: auto;
  }

  #menu-bar a {
    justify-content: flex-start;
    padding: 12px 14px;
    border-radius: 10px;
  }

  #menu-user-actions {
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
    margin-top: auto;
    padding: 10px;
    background: rgba(var(--primary-rgb, 37, 99, 235), 0.06);
    border-radius: 14px;
  }

  #menu-user-actions a {
    justify-content: center;
  }

  #logout {
    order: -1;
  }

  #menu-toggle-checkbox:checked ~ #layout-main-container #menu-bar {
    transform: translateX(0);
  }

  #menu-toggle-checkbox:checked
    ~ #layout-main-container
    #menu-toggle-label
    span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
  }

  #menu-toggle-checkbox:checked
    ~ #layout-main-container
    #menu-toggle-label
    span:nth-child(2) {
    opacity: 0;
  }

  #menu-toggle-checkbox:checked
    ~ #layout-main-container
    #menu-toggle-label
    span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
  }

  #menu-toggle-checkbox:checked ~ #layout-main-container #menu-overlay {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.35);
    z-index: 1000;
    cursor: pointer;
  }

  #body-main-container {
    padding-top: 76px;
  }
}

/* ===========================
   Footer
=========================== */

footer {
  margin-top: auto;
  text-align: left;
  flex-shrink: 0;
  padding: 16px 20px;
  border-top: 1px solid var(--border);
}

footer > div {
  display: inline-block;
  vertical-align: top;
}

#enamad img {
  width: 60px;
  height: 60px;
}

/* ===========================
   Helpers
=========================== */

.en {
  font-family: "Times New Roman";
}

#continue-open-exam-taking-container {
  text-align: center;
  padding: 10px 12px;
  background: rgba(var(--primary-rgb, 37, 99, 235), 0.06);
  border-bottom: 1px solid var(--border);
  box-sizing: border-box;
}

#continue-open-exam-taking {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;

  padding: 9px 20px;
  max-width: 100%;

  font-size: 0.85rem;
  font-weight: 700;
  color: var(--primary);
  text-decoration: none;

  background: var(--surface);
  border: 1px solid var(--primary);
  border-radius: 999px;

  box-sizing: border-box;
  transition:
    background 0.15s ease,
    color 0.15s ease,
    transform 0.1s ease;
}

#continue-open-exam-taking:hover {
  background: var(--primary);
  color: #fff;
}

#continue-open-exam-taking:active {
  transform: scale(0.97);
}

#continue-open-exam-taking:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* ===========================
   Forms
=========================== */

.mobile input,
.mobile select,
.mobile textarea,
.mobile button {
  width: 100%;
}

/* ===========================
   Responsive
=========================== */

@media (max-width: 768px) {
  #body-main-container {
    padding: 20px 0 32px;
  }

  .general-margin {
    padding-inline: 12px;
  }

  #continue-open-exam-taking-container {
    padding: 10px;
  }

  #continue-open-exam-taking {
    display: flex;
    width: 100%;
    padding: 11px 16px;
    font-size: 0.85rem;
  }

  footer {
    text-align: center;
  }
}
.bottom-links {
  margin-top: 5px;
  display: flex;
  align-items: center;
  gap: 25px;
}

.bottom-links a {
  background-color: lightblue;
  padding: 5px 8px;
  border-radius: 10px;
}

/* ---------- Last Page URL ---------- */

#last-page-url-container {
  max-width: 850px;
  margin: 24px auto 32px;
  padding: 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
}

.url-title {
  display: block;
  margin-bottom: 10px;
  font-weight: 700;
  color: var(--text);
}

#last-page-url {
  direction: ltr;
  text-align: left;
  word-break: break-all;
  font-family: Consolas, monospace;
  font-size: 0.85rem;
  color: var(--primary);
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
}

