/* Layout and General Structure */
.mushaf-section {
  padding: 1rem 0;
  background-color: var(--background-color);
}

.container {
  width: 100%;
  max-width: 1100px;
  margin: auto;
}

/* Navigation Components */
.mushaf-navigation {
  background-color: white;
  border-radius: 8px;
  box-shadow: 0 4px 6px var(--shadow-color);
  padding: 1rem;
  margin-bottom: 1rem;
}

.mushaf-nav-info {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem;
  border-bottom: 1px solid var(--border-color);
  flex-wrap: nowrap;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.mushaf-nav-info > div {
  background-color: var(--background-color);
  padding: 0.5rem;
  border-radius: 4px;
  font-weight: 500;
  white-space: nowrap;
}

.mushaf-nav-info span {
  font-weight: 700;
  color: var(--primary-color);
  margin-left: 0.5rem;
}

.mushaf-nav-controls {
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  text-align: center;
  margin: auto;
}

.page-navigation, .surah-navigation {
  display: ruby-text;
  justify-content: space-between;
  flex: 1;
  min-width: 300px;
}

.nav-btn {
  padding: 0.6rem 1rem;
  font-size: 0.9rem;
  align-items: center;
  gap: 0.5rem;
  background-color: var(--background-color);
  color: var(--primary-color);
  border: 1px solid var(--border-color);
  transition: all 0.3s ease;
  max-width: 120px;
}

.nav-btn:hover {
  background-color: var(--primary-color);
  color: white;
  transform: translateY(-3px);
  box-shadow: 0 4px 8px var(--shadow-color);
}

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

/* Form & Search Components */
.mushaf-search {

  border-top: 1px solid var(--border-color);
  text-align: center;
}

#mushaf-goto-form {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    width: 100%;
    margin: auto;
    align-content: center;
    justify-content: center;
}

.form-group-main {
  display: inline-flex;
  align-items: center;
  margin: 0 0.25rem;
  white-space: nowrap;
}

.form-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.25rem;
}

.form-group label {
  font-weight: 500;
  color: var(--primary-color);
  font-size: 0.9rem;
}

.form-group input, 
.form-group select {
  padding: 0.35rem;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  font-size: 0.9rem;
  width: auto;
  min-width: 60px;
}

.form-group input:focus, 
.form-group select:focus {
  outline: none;
  border-color: var(--secondary-color);
  box-shadow: 0 0 0 2px rgba(44, 82, 130, 0.1);
}

.form-group button {
  padding: 0.35rem 0.75rem;
  font-size: 0.9rem;
  background-color: var(--primary-color);
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  white-space: nowrap;
}

/* Content Display Areas */
.mushaf-content {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
}

.mushaf-image {
  background-color: #f9f7f1;
  border-radius: 8px;
  padding: 1rem;
  box-shadow: 0 4px 8px var(--shadow-color);
  text-align: center;
  overflow: hidden;
}

.mushaf-image img {
  max-width: 100%;
  height: auto;
  border-radius: 4px;
  display: block;
  margin: 0 auto;
}

.mushaf-text {
  background-color: white;
  border-radius: 8px;
  padding: 0.25rem;
  box-shadow: 0 4px 8px var(--shadow-color);
  max-height: 800px;
  overflow-y: auto;
}

/* Surah & Ayah Styling */
.sura-header {
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 2px solid var(--accent-color);
  text-align: center;
}

.sura-title {
  font-size: 1.8rem;
  color: var(--primary-color);
  margin: 0;
  padding: 0;
  font-weight: bold;
}

.ayat-container {
  margin-bottom: 2rem;
}

.ayah-container {
  margin-bottom: 1.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border-color);
  position: relative;
  transition: all 0.3s ease;
}

.ayah-container:last-child {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}

.highlighted {
  background-color: rgba(246, 173, 85, 0.1);
  padding: 1rem;
  border-right: 4px solid var(--accent-color);
  border-radius: 4px;
  animation: highlight-pulse 2s infinite;
}

@keyframes highlight-pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(246, 173, 85, 0.4);
  }
  70% {
    box-shadow: 0 0 0 10px rgba(246, 173, 85, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(246, 173, 85, 0);
  }
}

.ayah-text {
  color: inherit;
  text-decoration: none;
  font-family: 'UthmanicHafs', sans-serif;
  font-size: 20px;
  direction: rtl;
  text-align: justify;
}

.ayah-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--light-text-color);
  font-size: 0.9rem;
  margin-top: 0.5rem;
}

.sura-name {
  font-weight: 500;
}

.ayah-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  background-color: var(--accent-color);
  color: var(--primary-color);
  border-radius: 50%;
  font-size: 0.85rem;
  font-weight: bold;
  margin-right: 0.5rem;
  float: right;
}

/* Special typography */
@font-face {
  font-family: 'Quran Font';
  src: url('/static/fonts/quran.ttf') format('truetype');
  font-weight: normal;
  font-style: normal;
}

.quran-text {
  font-family: 'Quran Font', 'Traditional Arabic', 'Amiri', 'Scheherazade New', 'Noto Kufi Arabic', sans-serif;
}

/* View options */
.mushaf-view-options {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 1rem;
  flex-wrap: nowrap;
  overflow-x: auto;
}

.view-option {
  background-color: var(--background-color);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  padding: 0.35rem 0.75rem;
  cursor: pointer;
  transition: all 0.3s ease;
  font-size: 0.9rem;
  white-space: nowrap;
}

.view-option:hover,
.view-option.active {
  background-color: var(--primary-color);
  color: white;
}

/* Research Results Styling */
.results-container.researchs-results {
  margin: 2rem 0;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  box-shadow: 0 2px 5px var(--shadow-color);
  padding: 1.5rem;
  background-color: #fcfcfc;
}

.researchs-results .results-title {
  background-color: #f5f5f5;
  color: #333;
  padding: 0.75rem 1rem;
  border-radius: 6px 6px 0 0;
  font-weight: bold;
  border-bottom: 2px solid #e9e9e9;
  margin-bottom: 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.researchs-results .results-title span {
  font-size: 1.1rem;
}

.researchs-results table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 1rem;
  direction: rtl;
}

.researchs-results table th,
.researchs-results table td {
  padding: 0.8rem;
  border: 1px solid var(--border-color);
  text-align: right;
}

.researchs-results table th {
  font-weight: bold;
}

.researchs-results table tr:nth-child(even) {
  background-color: #f7fbff;
}

.researchs-results table tr:hover {
  background-color: #f0f7ff;
}

.researchs-results .ayahwordresult {
  margin-right: 0.25rem;
  display: inline-block;
}

.researchs-results .ayahwordresult a {
  text-decoration: none;
  color: #333;
}

.researchs-results .ayahwordresult a:hover {
  color: var(--primary-color);
  text-decoration: underline;
}

.researchs-results td.result-word a,
.researchs-results td.result-root a {
  color: var(--primary-color);
  text-decoration: none;
  font-weight: bold;
}

.researchs-results td.result-word a:hover,
.researchs-results td.result-root a:hover {
  text-decoration: underline;
}

/* Audio player styles */
.researchs-results audio {
  width: 150px;
  height: 30px;
}

/* Quran Search Results Table */
.curr-ayah-words {
  padding: 1.5rem;
  background-color: white;
  border-radius: 8px;
  box-shadow: 0 4px 6px var(--shadow-color);
  margin-bottom: 2rem;
  overflow-x: auto;
  max-width: 1100px;
  margin: auto;
}

.curr-ayah-words table {
  width: 100%;
  border-collapse: collapse;
  direction: rtl;
}

.curr-ayah-words thead {
  background-color: var(--primary-color);
  color: white;
}

.curr-ayah-words th {
  padding: 1rem;
  text-align: right;
  font-weight: 700;
  border-bottom: 2px solid var(--accent-color);
}

.curr-ayah-words td {
  padding: 0.8rem 1rem;
  border-bottom: 1px solid var(--border-color);
  vertical-align: top;
}

.curr-ayah-words tr:nth-child(even) {
  background-color: var(--background-color);
}

.curr-ayah-words tr:hover {
  background-color: rgba(246, 173, 85, 0.1);
}

.curr-ayah-words a {
  color: var(--primary-color);
  text-decoration: none;
  transition: color 0.3s ease;
}

.curr-ayah-words a:hover {
  color: var(--accent-color);
  text-decoration: underline;
}

/* Column widths for search results */
.curr-ayah-words th:nth-child(1),
.curr-ayah-words td:nth-child(1) {
  width: 5%;
  text-align: center;
}

.curr-ayah-words th:nth-child(2),
.curr-ayah-words td:nth-child(2) {
  width: 15%;
  font-size: 1.2rem;
}

.curr-ayah-words th:nth-child(3),
.curr-ayah-words td:nth-child(3) {
  width: 40%;
  font-size: 1.1rem;
}

.curr-ayah-words th:nth-child(4),
.curr-ayah-words td:nth-child(4) {
  width: 15%;
}

.curr-ayah-words th:nth-child(5),
.curr-ayah-words td:nth-child(5),
.curr-ayah-words th:nth-child(6),
.curr-ayah-words td:nth-child(6) {
  width: 12.5%;
}

/* RTL Specific Styles */
html[dir="rtl"] .mushaf-nav-info span {
  margin-left: 0;
  margin-right: 0.5rem;
}

html[dir="rtl"] .ayah-number {
  float: left;
  margin-right: 0;
  margin-left: 0.5rem;
}

html[dir="rtl"] .ayah-text {
  font-family: 'Traditional Arabic', 'Amiri', 'Scheherazade New', 'Noto Kufi Arabic', sans-serif;
}

html[dir="ltr"] .ayah-container.highlighted {
  border-right: none;
  border-left: 4px solid var(--accent-color);
}

/* Responsive Styles */
@media (min-width: 992px) {
  .mushaf-content {
    grid-template-columns: 1fr 1fr;
  }
}

@media (min-width: 769px) {
  .form-group {
    margin-left: 10px;
  }
  
  .form-group label {
    margin-left: 8px;
    white-space: nowrap;
  }
  
  .form-group input, 
  .form-group select {
    flex: 1;
    min-width: 80px;
  }
}

@media (max-width: 768px) {
  /* Navigation */
  .mushaf-navigation {
    padding: 0.5rem;
  }

  .mushaf-nav-info {
    padding: 0.25rem;
    gap: 0.25rem;
  }

  .mushaf-nav-info > div {
    padding: 0.25rem 0.5rem;
    font-size: 0.85rem;
  }

  .form-group-main {
    margin: 0 0.15rem;
  }

  .form-group {
    padding: 0.15rem;
    gap: 0.25rem;
  }

  .form-group label {
    font-size: 0.8rem;
  }

  .form-group input, 
  .form-group select {
    padding: 0.25rem;
    font-size: 0.8rem;
    min-width: 50px;
  }

  .form-group button {
    padding: 0.25rem 0.5rem;
    font-size: 0.8rem;
  }

  .view-option {
    padding: 0.25rem 0.5rem;
    font-size: 0.8rem;
  }

  .page-navigation, 
  .surah-navigation {
    display: ruby-text;
    justify-content: space-between;
    width: 100%;
  }
  
  /* Form */
  #mushaf-goto-form {
    flex-direction: row;
    overflow-x: auto;
    flex-wrap: nowrap;
    padding: 8px 0;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
  }
  
  .form-group {
    margin-right: 8px;
    margin-bottom: 0;
    background-color: #f7f7f7;
    border-radius: 20px;
    padding: 5px 10px;
    border: 1px solid #e0e0e0;
  }
  
  .form-group label {
    font-size: 12px;
    margin-left: 5px;
  }
  
  .form-group input,
  .form-group select {
    width: 100px;
    font-size: 12px;
    padding: 3px;
    border: 1px solid #ddd;
    border-radius: 4px;
    margin: 0 4px;
    display:block;
    
  }
  
  /* Content */
  .ayah-text {
    font-size: 1.4rem;
    line-height: 2.3;
  }
  
  .mushaf-text {
    padding: 1rem;
  }
  
  /* Research results */
  .researchs-results table {
    display: block;
    overflow-x: auto;
  }
  
  .researchs-results audio {
    width: 100px;
  }
  
  /* Search results */
  .curr-ayah-words {
    padding: 1rem;
  }
  
  .curr-ayah-words th, 
  .curr-ayah-words td {
    padding: 0.6rem;
    font-size: 0.9rem;
  }
  
  .curr-ayah-words th:nth-child(2),
  .curr-ayah-words td:nth-child(2) {
    font-size: 1rem;
  }
  
  .curr-ayah-words th:nth-child(3),
  .curr-ayah-words td:nth-child(3) {
    font-size: 0.95rem;
  }
}

@media (max-width: 480px) {
  /* Navigation */
  .mushaf-navigation {
    padding: 1rem;
  }
  
  .mushaf-nav-info > div {
    padding: 0.5rem;
    font-size: 0.9rem;
  }
  
  .nav-btn {
    padding: 0.5rem;
    font-size: 0.7rem;
    max-width: 85px;
    width:75px;
  }
  
  /* Form */
  .form-group {
    /* padding: 3px 6px;*/
  }
  
  .form-group label {
    /* font-size: 10px;*/
  }
  
  .form-group input,
  .form-group select {
   /* width: 45px;*/
     width: 100%;
  }
  
  .form-group button {
   /*    padding: 2px 4px;
    font-size: 10px;*/ 
  }
  
  #goto-ayah {
    width: 70px;
  }
  
  #goto-page {
    width: 70px;
  }
  
  #goto-surah, #goto-jozz {
    width: 70px;
  }
  
  /* Content */
  .mushaf-text {
    padding: 1rem;
  }
  
  .ayah-text {
    font-size: 1.2rem;
    line-height: 2;
  }
  
  .hero h1 {
    font-size: 1.8rem;
  }
  
  /* Search results */
  .curr-ayah-words {
    padding: 0.5rem;
  }
  
  .curr-ayah-words th, 
  .curr-ayah-words td {
    padding: 0.4rem;
    font-size: 0.8rem;
  }
  
  .curr-ayah-words th:nth-child(2),
  .curr-ayah-words td:nth-child(2) {
    font-size: 0.9rem;
  }
  
  .curr-ayah-words th:nth-child(3),
  .curr-ayah-words td:nth-child(3) {
    font-size: 0.85rem;
  }
}

/* Scrollbar styling */
#mushaf-goto-form::-webkit-scrollbar {
  height: 3px;
}

#mushaf-goto-form::-webkit-scrollbar-track {
  background: #f1f1f1;
}

#mushaf-goto-form::-webkit-scrollbar-thumb {
  background: var(--primary-color);
  border-radius: 4px;
}

/* Print styles */
@media print {
  header, 
  footer,
  .mushaf-navigation,
  .mushaf-view-options {
    display: none;
  }
  
  .container {
    width: 100%;
    max-width: none;
    padding: 0;
    margin: 0;
  }
  
  .mushaf-content {
    display: block;
  }
  
  .mushaf-image,
  .mushaf-text {
    box-shadow: none;
    border: none;
    padding: 0;
  }
  
  .ayah-container.highlighted {
    background-color: transparent;
    animation: none;
    border: none;
    box-shadow: none;
  }
  
  .ayah-text {
    font-size: 14pt;
    line-height: 1.5;
  }
  
  .curr-ayah-words {
    box-shadow: none;
    padding: 0;
  }
  
  .curr-ayah-words th {
    background-color: #f8fafc !important;
    color: #000 !important;
    border-bottom: 1px solid #000;
  }
  
  .curr-ayah-words a {
    color: #000;
    text-decoration: none;
  }
}

/* تنسيق select التفسير */
#tafseer-select {
  width: 100%;
  max-width: 300px;
  padding: 10px 15px;
  font-size: 16px;
  border: 2px solid #006400;
  border-radius: 8px;
  background-color: white;
  color: #333;
  cursor: pointer;
  margin: 15px auto;
  display: block;
  transition: all 0.3s ease;
  direction: rtl;
}

#tafseer-select:hover {
  border-color: #008000;
  box-shadow: 0 2px 5px rgba(0,100,0,0.2);
}

#tafseer-select:focus {
  outline: none;
  border-color: #008000;
  box-shadow: 0 0 0 2px rgba(0,100,0,0.1);
}

#tafseer-select option {
  padding: 10px;
  font-size: 16px;
  background-color: white;
  color: #333;
}
