/* === BASE STYLES === */
html, body {
  margin: 0; padding: 0;
  min-height: 100vh;
  box-sizing: border-box;
  font-family: 'Arial', sans-serif;
  background: linear-gradient(135deg, #181312 0%, #355a33 55%, #bfa14a 100%);
  background-attachment: fixed;
  color: #ffeecf;
}
body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* === HEADER & BRANDING === */
.app-header {
  width: 100%;
  padding: 0.5rem 0;
  background: rgba(28, 24, 19, 0.97);
  border-bottom: 3px solid #bfa14a;
  box-shadow: 0 6px 32px #0003;
  position: sticky;
  top: 0;
  z-index: 100;
}
.header-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 660px;
  margin: 0 auto;
  padding: 0.5rem 1.5rem;
  width: 100%;
}
.header-branding {
  display: flex;
  align-items: center;
  gap: 12px;
}
.logo {
  height: 54px; width: 54px;
  border-radius: 50%;
  background: #bfa14a11;
  border: 2.5px solid #bfa14a;
  box-shadow: 0 2px 16px #bfa14a44;
  margin-right: 8px;
}
.app-title {
  font-family: 'Scheherazade New', serif;
  font-size: 2.1rem;
  color: #bfa14a;
  letter-spacing: 2px;
  text-shadow: 2px 2px 10px #000, 0 0 2px #ffeecf;
  margin: 0;
}
/* Contact button top right */
.header-contact-btn {
  font-size: 2rem;
  color: #bfa14a;
  background: none;
  border: none;
  cursor: pointer;
  padding: 7px 14px;
  text-decoration: none;
  transition: color 0.16s;
  margin-left: 20px;
  margin-right: 0;
}
.header-contact-btn:hover,
.header-contact-btn:focus {
  color: #ffeecf;
}

/* === MAIN LAYOUT & SCREENS === */
main {
  flex: 1 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
}
.screen {
  display: none;
  width: 100%;
  min-height: calc(100vh - 120px);
  align-items: center;
  justify-content: center;
  padding-top: 30px;
  animation: fadeIn 0.8s;
}
.screen.active { display: flex; }
@keyframes fadeIn { from{opacity:0;transform:translateY(16px);} to{opacity:1;transform:translateY(0);} }

/* === CARD & GRID LAYOUTS === */
.card {
  background: rgba(32, 30, 26, 0.98);
  border-radius: 22px;
  box-shadow: 0 12px 48px #0006, 0 1.5px 8px #bfa14a55;
  padding: 36px 32px 26px 32px;
  max-width: 500px;
  width: 92vw;
  margin: 0 auto;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.home-card {
  margin-top: 40px;
  gap: 10px;
}
.quiz-card, .contact-card, .grid-card {
  margin-top: 36px;
  gap: 14px;
}
.grid-card form, .quiz-card form {
  width: 100%;
}
.input-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px 24px;
  width: 100%;
  margin-bottom: 15px;
}
.input-group {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 2px;
}
@media (max-width: 600px) {
  .card { padding: 18px 7px 13px 7px; }
  .input-grid { grid-template-columns: 1fr; gap: 10px 0; }
}

/* === HEADINGS & TEXT === */
.main-heading {
  font-family: 'Scheherazade New', serif;
  font-size: 2rem;
  color: #ffeecf;
  text-shadow: 1.5px 1.5px 10px #bfa14a;
  margin-bottom: 12px;
  margin-top: 0;
  outline: none;
}
.subtitle {
  color: #d1c48a;
  font-size: 1.15rem;
  margin-bottom: 18px;
  text-shadow: 0 1px 2px #18131288;
}

/* === BUTTONS === */
.btn, .start-button, .submit-button, .next-button {
  font-size: 1.15rem;
  font-family: inherit;
  padding: 14px 38px;
  border-radius: 13px;
  font-weight: bold;
  margin: 10px 0 0 0;
  border: none;
  cursor: pointer;
  box-shadow: 0 2px 12px #bfa14a66, 0 0.5px 2px #2229;
  transition: background 0.18s, color 0.18s, transform 0.15s, box-shadow 0.18s;
  outline: none;
  letter-spacing: 0.5px;
}
.btn-primary, .start-button {
  background: linear-gradient(92deg, #bfa14a 70%, #3d5931 100%);
  color: #181312;
  border: 2px solid #bfa14a;
}
.btn-secondary, .next-button {
  background: linear-gradient(92deg,#3d5931 60%, #bfa14a 100%);
  color: #ffeecf;
  border: 2px solid #355a33;
}
.btn-outline {
  background: transparent;
  color: #bfa14a;
  border: 2px solid #bfa14a;
  margin-left: 7px;
}
.btn:focus-visible {
  outline: 2.5px solid #d1c48a;
  outline-offset: 2.5px;
}
.btn:hover, .start-button:hover, .submit-button:hover, .next-button:hover, .btn-outline:hover {
  background: linear-gradient(92deg, #ffeecf 60%, #bfa14a 100%);
  color: #181312;
  box-shadow: 0 6px 24px #bfa14a88, 0 1px 8px #2227;
  transform: translateY(-2.5px) scale(1.035);
}
.btn:active, .start-button:active, .submit-button:active, .next-button:active {
      transform: translateY(0) scale(1); /* Reset transform on active */
      box-shadow: 0 1px 6px #bfa14a55; /* Smaller shadow on active */
      background: linear-gradient(92deg, #d1c48a 60%, #a38b3d 100%); /* Slightly different background */
    }
.btn-outline:hover {
  background: #ffeecf;
  color: #1a1a1a;
}

/* === INPUTS & FIELDS === */
input[type="number"], input[type="text"], input[type="email"], textarea {
  padding: 12px 14px;
  font-size: 1rem;
  border-radius: 8px;
  border: 2px solid #bfa14a;
  background: #232216;
  color: #ffeecf;
  margin-bottom: 2px;
  transition: border-color 0.18s, background 0.18s, box-shadow 0.18s;
  width: 100%;
  box-sizing: border-box;
  font-family: inherit;
  outline: none;
}
input[type="number"]:focus, input[type="text"]:focus, input[type="email"]:focus, textarea:focus {
  border-color: #ffeecf;
  background: #1e2a18;
  box-shadow: 0 0 12px #bfa14a88; /* Add a glow effect */
  outline: none; /* Remove the default outline */
}
.input-label {
  color: #bfa14a;
  font-weight: bold;
  margin-bottom: 4px;
  font-size: 1.08em;
  text-align: left;
}
textarea {
  resize: vertical;
  min-height: 70px;
  max-height: 200px;
}

/* === SEARCH SECTION === */
.search-section {
  margin-top: 24px;
  margin-bottom: 18px;
  width: 100%;
  max-width: 400px;
  text-align: center;
  background: rgba(32, 30, 26, 0.97);
  border-radius: 14px;
  box-shadow: 0 2px 18px #bfa14a44;
  padding: 16px 14px 12px 14px;
  animation: fadeIn 0.8s;
}
.search-section input[type="text"] {
  padding: 11px 10px;
  font-size: 1rem;
  border-radius: 8px;
  border: 2px solid #bfa14a;
  background: #f5f5e9;
  color: #3d5931;
  width: 68%;
  margin-right: 5px;
  transition: border-color 0.2s, background 0.2s;
}
.search-section input[type="text"]:focus {
  background: #fff;
  border-color: #3d5931;
}
#searchResults {
  margin-top: 13px;
}
.search-result {
  background: #232b1a;
  color: #ffeecf;
  margin: 12px auto;
  padding: 13px;
  border-radius: 7px;
  border: 1.5px solid #bfa14a;
  max-width: 95%;
  text-align: left;
}
.search-result:active {
      background: #2f3a26; /* Slightly darker background on active */
    }

/* === QURAN AYAT (TYPING EFFECT) === */
.ayat {
  font-family: 'Scheherazade New', serif;
  font-size: 1.28rem;
  font-weight: bold;
  color: #ffeecf;
  margin: 22px 0 15px 0;
  padding: 18px 11px;
  background: #181312;
  border-radius: 13px;
  border: 2.5px solid #bfa14a;
  min-height: 45px;
  transition: background 0.25s;
  word-break: break-word;
  box-shadow: 0 2px 10px #bfa14a22;
  text-align: center;
  letter-spacing: 0.09rem;
  /* For typing effect: use monospace fallback for animation */
  font-variant-ligatures: none;
}
.typing-effect {
  animation: ayatFadeIn 0.7s;
}
@keyframes ayatFadeIn { from{opacity:0;} to{opacity:1;} }

/* === RESULTS, ERRORS, FEEDBACK === */
.result, .error {
  margin: 18px 0 8px 0;
  font-size: 1.13rem;
  border-radius: 8px;
  padding: 12px 8px;
}
.result {
  color: #3d5931;
  background: #e8ffd7;
  border: 2px solid #bfa14a;
}
.error {
  color: #d9534f;
  background: #ffe3e3;
  border: 2px solid #d9534f;
}

/* === CONTACT FORM === */
.contact-card {
  margin-top: 36px;
  min-width: 285px;
  max-width: 450px;
}
.contact-form .input-group {
  margin-bottom: 12px;
}
.contact-form button[type="submit"] {
  margin-top: 6px;
}
.contact-form textarea {
  font-family: inherit;
}

/* === FOOTER === */
.app-footer {
  width: 100%;
  padding: 15px 0 7px 0;
  text-align: center;
  color: #bfa14a;
  background: rgba(32, 30, 26, 0.93);
  font-size: 1.08rem;
  border-top: 2px solid #bfa14a;
  box-shadow: 0 -2px 14px #bfa14a22;
  flex-shrink: 0;
}

/* === ACCESSIBILITY & MOBILE === */
@media (max-width: 600px) {
  .app-title { font-size: 1.2rem; }
  .main-heading { font-size: 1.13rem; }
  .logo { height: 38px; width: 38px; }
  .card { padding: 12px 2px 8px 2px; }
  .input-label { font-size: 1em; }
  .ayat { font-size: 0.98rem; padding: 10px 6px; }
  .btn, .start-button, .submit-button, .next-button { font-size: 0.98rem; padding: 10px 16px; }
  .header-content { padding: 0.5rem 0.2rem; }
}

@media (max-width: 400px) {
  .card { min-width: 95vw; }
}

.card:hover {
      box-shadow: 0 16px 60px #0008, 0 2px 10px #bfa14a77; /* Larger shadow on hover */
      transform: translateY(-3px); /* Subtle lift */
      transition: transform 0.3s ease-in-out, box-shadow 0.3s ease-in-out; /* Add transition */
    }

[aria-live] { outline: 0; }
input, textarea, button { font-size: 1rem; }
input:focus, textarea:focus, button:focus-visible {
  outline: 2.5px solid #bfa14a;
  outline-offset: 1.5px;
}
mark {
  background-color: yellow;
  padding: 0 2px;
  border-radius: 3px;
}
