/* Toast notifications */
.toast {
  position: fixed;
  bottom: -100px;
  left: 50%;
  transform: translateX(-50%);
  
  background: var(--bg1);
  color: var(--txt0);
  padding: var(--sz3) var(--sz5);
  border-radius: var(--sz2);
  
  font-size: var(--sz3);
  font-weight: 600;
  
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  
  transition: bottom 0.3s ease;
  z-index: 10000;
}

.toast.show {
  bottom: var(--sz5);
}

.toast.toast-success {
  background: var(--cnf);
  color: var(--black);
}

.toast.toast-error {
  background: var(--err);
  color: var(--black);
}

/* Search input */
.search-container {
  padding: 0 var(--sz5);
  margin-bottom: var(--sz3);
}

.search-container input[type="search"] {
  width: 100%;
  padding: var(--sz3) var(--sz4);
  font-size: var(--sz4);
  
  background: rgba(255, 255, 255, 0.05);
  border: 2px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--sz2);
  
  color: var(--txt0);
  
  transition: all 0.2s ease;
}

.search-container input[type="search"]:focus {
  outline: none;
  border-color: var(--accent0);
  background: rgba(255, 255, 255, 0.08);
}

.search-container input[type="search"]::placeholder {
  color: var(--txt1);
}

/* Loading skeletons */
.skeleton {
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.05) 25%,
    rgba(255, 255, 255, 0.1) 50%,
    rgba(255, 255, 255, 0.05) 75%
  );
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s ease-in-out infinite;
  border-radius: var(--sz1);
}

.skeleton-text {
  height: 1.2em;
  margin-bottom: 0.8em;
  width: 100%;
}

.skeleton-text:last-child {
  width: 70%;
}

@keyframes skeleton-loading {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

/* Fade in animation for ayat */
#ayat {
  opacity: 1;
  transition: opacity 0.3s ease;
}

#ayat.fade-in {
  animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Improved button styles for mobile */
button {
  font-size: var(--sz4);
  font-weight: 600;
  
  padding: var(--sz3) var(--sz5);
  min-height: 44px;
  min-width: 44px;
  
  border-radius: var(--sz3);
  
  background: var(--txt0);
  color: var(--bg1);
  
  cursor: pointer;
  
  transition: all 0.2s ease;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

button:active {
  transform: scale(0.95);
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

button:disabled:active {
  transform: none;
}

/* Improved chapters overlay */
#chapters {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  
  background: rgba(0, 0, 0, 0.9);
  backdrop-filter: blur(10px);
  
  z-index: 1000;
  
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

#chapters.hide {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

#chapters .section_content {
  max-height: calc(100vh - 200px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

/* Better table for mobile */
table {
  width: 100%;
  border-collapse: collapse;
}

table tr {
  cursor: pointer;
  transition: background 0.2s ease;
  min-height: 48px;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

table tbody tr:hover,
table tbody tr:focus {
  background: rgba(255, 255, 255, 0.05);
  outline: 2px solid var(--accent0);
  outline-offset: -2px;
}

table tbody tr:active {
  background: rgba(255, 255, 255, 0.1);
}

table tbody tr.hidden {
  display: none;
}

table td {
  padding: var(--sz3);
  text-align: center;
}

/* Touch-friendly IDs click area */
#IDS {
  cursor: pointer;
  padding: var(--sz2);
  margin: calc(-1 * var(--sz2));
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

/* Surah name click area */
#surah {
  cursor: pointer;
  padding: var(--sz2);
  margin: calc(-1 * var(--sz2));
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

/* Better mobile spacing */
@media only screen and (max-width: 1100px) {
  button {
    padding: var(--sz3) var(--sz6);
    font-size: var(--sz5);
  }
  
  #buttons {
    gap: var(--sz3);
  }
  
  table td {
    font-size: var(--sz4);
  }
  
  .search-container input[type="search"] {
    font-size: var(--sz5);
    padding: var(--sz4) var(--sz5);
  }
}

/* Smooth transitions */
* {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Focus visible for accessibility */
:focus-visible {
  outline: 2px solid var(--accent0);
  outline-offset: 2px;
}

/* Remove default focus for mouse users */
:focus:not(:focus-visible) {
  outline: none;
}
