/* ============================= */
/*          GLOBAL RESET         */
/* ============================= */
html {
  scroll-behavior: smooth;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* ============================= */
/*        ROOT VARIABLES         */
/* ============================= */
:root {
  --primary: #009bd6;
  --primary-dark: #009bdf;

  --bg-light: #ffffff;
  --bg-secondary-light: #f1f5fa;
  --bg-secondary-dark: #1e293b;

  --text-light: #1e293b;
  --text-secondary-light: #64748b;
  --text-secondary-dark: #94a3b8;

  --border-light: #e2e8f0;
  --border-dark: #334155;

  --hero-bg: var(--bg-secondary-light);
  --hero-text: var(--text-light);
}

.dark {
  --bg-light: #0f172a;
  --bg-secondary-light: var(--bg-secondary-dark);
  --text-light: #f1f5f9;
  --text-secondary-light: var(--text-secondary-dark);
  --border-light: var(--border-dark);

  --hero-bg: var(--bg-secondary-light);
  --hero-text: var(--text-light);
}

/* ============================= */
/*          BODY STYLES          */
/* ============================= */
body {
  background: var(--bg-light);
  color: var(--text-light);
  font-family:
    system-ui,
    -apple-system,
    sans-serif;
  transition: all 0.3s ease;
}

input,
textarea {
  border-color: var(--border-light);
  background: var(--bg-secondary-light);
}

/* ============================= */
/*       COMMON COMPONENTS       */
/* ============================= */
.card,
.accordion-button,
.file-item,
.folder-item {
  background: var(--bg-secondary-light);
  border: 1px solid var(--border-light);
  border-radius: 12px;
  transition: all 0.3s ease;
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: 0 10px 30px rgba(59, 130, 246, 0.2);
}

.file-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.file-item > div:first-child {
  cursor: pointer;
}

/* ============================= */
/*           BUTTONS             */
/* ============================= */
.btn-primary {
  background: var(--primary);
  color: white;
  padding: 0.75rem 1.5rem;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  transition: all 0.3s ease;
}

.btn-primary:hover {
  background: var(--primary-dark);
  transform: scale(1.05);
}

.hero-btn {
  background-color: var(--bg-light);
  color: var(--primary);
  cursor: pointer;
  transition: all 0.3s ease;
}

.hero-btn:hover {
  background-color: var(--primary);
  color: var(--bg-light);
  transform: scale(1.05);
}

.action-btn {
  padding: 0.5rem;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  border-radius: 0.375rem;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.action-btn:hover {
  background: var(--primary-color);
  color: white;
  transform: scale(1.1);
}

/* ============================= */
/*           ACCORDION           */
/* ============================= */
.accordion-button {
  padding: 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
}

.accordion-button:hover {
  background: var(--primary);
  color: white;
}

.accordion-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
}

.accordion-content.active {
  max-height: 2000px;
}

/* ============================= */
/*        FILE & FOLDER ITEMS    */
/* ============================= */
.file-item,
.folder-item {
  padding: 0.75rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  cursor: pointer;
  border-radius: 6px;
  width: 100%;
  max-width: 100%;
  overflow: hidden;
}

.file-item:hover,
.folder-item:hover {
  background: var(--primary);
  color: white;
  transform: translateX(4px);
}

.file-item span,
.folder-item span,
.breadcrumb-item {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

/* ============================= */
/*            MODALS             */
/* ============================= */
body.modal-open {
  overflow: hidden;
  touch-action: none;
}

.modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  z-index: 50;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  transition: background 0.35s ease-in-out;
}

.modal.active {
  display: flex;
}

.modal-content {
  background: var(--bg-light);
  width: 100%;
  max-width: 1100px;
  height: 90%;
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: all 0.35s ease-in-out;
}

#fileViewer {
  flex: 1;
  width: 100%;
  border: none;
}

#yearContent {
  flex: 1;
}

#yearModal {
  z-index: 1000;
}

#fileModal {
  z-index: 1100;
}

.modal.fullscreen {
  padding: 0;
  background: rgba(0, 0, 0, 0.85);
}

.modal.fullscreen .modal-content {
  width: 100% !important;
  height: 100% !important;
  max-width: none !important;
  max-height: none !important;
  border-radius: 0 !important;
}

.modal.fullscreen #fileViewer {
  height: 100%;
}

.nav-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(0, 0, 0, 0.4);
  color: white;
  border: none;
  font-size: 2rem;
  padding: 0.5rem 1rem;
  border-radius: 8px;
  cursor: pointer;
  z-index: 10;
  transition:
    background 0.2s,
    transform 0.2s;
}

.nav-btn:hover {
  background: rgba(0, 0, 0, 0.7);
  transform: translateY(-50%) scale(1.1);
}

.nav-btn.left {
  left: 10px;
}

.nav-btn.right {
  right: 10px;
}

/* ============================= */
/*           BREADCRUMB          */
/* ============================= */
.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 1rem;
  background: var(--bg-secondary-light);
  border-radius: 8px;
  margin-bottom: 1rem;
}

.breadcrumb-item {
  color: var(--text-secondary-light);
  cursor: pointer;
  transition: color 0.2s;
}

.breadcrumb-item:hover {
  color: var(--primary);
}

.breadcrumb-item.active {
  color: var(--text-light);
  font-weight: 600;
}

/* ============================= */
/*           LOADING             */
/* ============================= */
.loading {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 3px solid var(--border-light);
  border-radius: 50%;
  border-top-color: var(--primary);
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ============================= */
/*            DROPDOWN            */
/* ============================= */
.dropdown-link {
  color: var(--text-light);
  transition: all 0.3s ease;
}

.dropdown-link:hover {
  background-color: var(--primary);
  color: white;
}

/* ============================= */
/*          HERO SECTION          */
/* ============================= */
.hero {
  background: var(--hero-bg);
  color: var(--hero-text);
  padding: 4rem 2rem;
  margin-bottom: 3rem;
  transition: all 0.3s ease;
}

/* ============================= */
/*            NAVBAR             */
/* ============================= */
nav {
  background: var(--bg-secondary-light);
  border-bottom: 1px solid var(--border-light);
  position: sticky;
  top: 0;
  z-index: 100;
}

#yearsDropdown {
  background: var(--bg-secondary-light);
  border: 1px solid var(--border-light);
}

/* ============================= */
/*          EMPTY STATE           */
/* ============================= */
.empty-state {
  text-align: center;
  padding: 3rem;
  color: var(--text-secondary-light);
}

/* ============================= */
/*        DHIKR SYSTEM          */
/* ============================= */
#dhikrBox {
  background: #ffffff;
  color: #111;
  border: 1px solid #e5e7eb;
}

html.dark #dhikrBox {
  background: #1f2937;
  border-color: #374151;
  color: #f3f4f6;
  box-shadow: 0 4px 15px rgba(255, 255, 255, 0.08);
}

/* ============================= */
/*       LOADING SPINNER        */
/* ============================= */
.loading-small {
  width: 12px;
  height: 12px;
  border: 2px solid #f3f3f3;
  border-top: 2px solid #3498db;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  display: inline-block;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

/* ============================= */
/*       TAILWIND OVERRIDES       */
/* ============================= */
[class^='bg-blue-'],
[class*=' bg-blue-'] {
  background-color: var(--primary) !important;
}

[class^='text-blue-'],
[class*=' text-blue-'] {
  color: var(--primary) !important;
}

/* ============================= */
/*           RESPONSIVE           */
/* ============================= */
@media (max-width: 640px) {
  .file-item span,
  .folder-item span {
    white-space: normal;
    word-break: break-word;
  }

  .breadcrumb {
    flex-direction: column;
    align-items: flex-start;
    word-break: break-word;
  }

  .breadcrumb-item {
    max-width: 100%;
  }

  .nav-btn {
    font-size: 1.3rem;
    padding: 0.3rem 0.6rem;
    border-radius: 6px;
    background: rgba(0, 0, 0, 0.5);
  }

  .nav-btn.left {
    left: 6px;
  }

  .nav-btn.right {
    right: 6px;
  }
}
