/* ========================================================= */
/* 1. ГЛОБАЛЬНЫЕ СТИЛИ                                       */
/* ========================================================= */

html,
body {
  height: 100%;
  margin: 0;
  padding: 0;
  overflow: hidden;
}

body {
  background-color: var(--bg-color);
  font-family: "Cuprum", sans-serif;
  color: #2c3e50;
  position: relative;
  padding-top: env(safe-area-inset-top);
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
  display: flex;
  justify-content: center;
}

/* ========================================================= */
/* 2. СТИЛИ НАВИГАЦИИ И МАКЕТА                               */
/* ========================================================= */

.app-header {
  background-color: var(--bg-color);
  color: var(--text-color);
  padding: 15px;
  text-align: left;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  height: 60px;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 2;
  transition: background-color 0.3s, color 0.3s;
}

.app-header h1 {
  margin: 0;
  font-size: 1.8em;
  font-weight: 600;
  color: var(--text-color);
}

.app-footer-nav {
  background-color: var(--bg-color);
  display: flex;
  justify-content: space-around;
  align-items: center;
  padding: 10px 5px;
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.08);
  height: 70px;
  gap: 3px;
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  z-index: 2;
  padding-bottom: calc(10px + env(safe-area-inset-bottom));
  transition: background-color 0.3s;
}

/* ========================================================= */
/* 3. СТИЛИ ОСНОВНОГО КОНТЕНТА                               */
/* ========================================================= */

.app-content {
  position: absolute;
  top: 60px;
  bottom: calc(70px + env(safe-area-inset-bottom));
  left: 0;
  right: 0;
  overflow-y: auto;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  background-color: var(--dynamic-content-bg);
  transition: background-color 0.3s, color 0.3s;
  display: flex;
  flex-direction: column;
}

.app-content::-webkit-scrollbar {
  width: 0;
  height: 0;
}

#dynamic-content-container {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  gap: 15px;
  padding: 15px;
}

#links-container {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.content-section {
  display: none;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
  flex-grow: 1;
}

.content-section.active {
  display: flex;
  flex-direction: column;
}

/* ========================================================= */
/* 4. СТИЛИ КАРТОЧЕК                                         */
/* ========================================================= */

.card {
  position: relative;
  background-color: white;
  padding: 20px 24px;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  display: flex;
  align-items: flex-start;
  transition: opacity 0.2s ease-in-out;
}

.card-content {
  flex-grow: 1;
  width: 100%;
}

.card-content > img {
  width: 100%;
  height: auto;
  max-width: 100%;
  display: block;
  margin: 15px 0;
}

.card-content > p:not(:last-child) {
  margin-bottom: 10px;
}

.card-content > ol > li {
  margin-left: 25px;
}

.card-content > ol > li::marker {
  font-weight: bold;
}

.card-title {
  margin-bottom: 15px;
  font-size: 1.5em;
  font-weight: 600;
  text-align: left;
  color: #4a5a70;
}

.card-text {
  line-height: 1.6;
  color: #666;
  font-size: 1em;
}

/* ========================================================= */
/* 5. СТИЛИ ИНТЕРАКТИВНЫХ ЭЛЕМЕНТОВ                          */
/* ========================================================= */

#changeThemeIcon {
  font-size: 1.8em;
  color: var(--text-color);
}

.nav-button {
  background: none;
  border: none;
  color: var(--nav-icon);
  padding: 5px 12px;
  font-size: 0.8em;
  cursor: pointer;
  transition: color 0.3s ease, background-color 0.3s ease;
  flex: 1 1 0px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  border-radius: 10px;
  -webkit-tap-highlight-color: transparent;
  outline: none;
}

.nav-button.active {
  color: var(--accent);
  font-weight: 500;
  background-color: #ede7f6;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

.nav-button .material-symbols-outlined {
  font-size: 26px;
  margin-bottom: 5px;
  font-variation-settings: "wght" 100;
  opacity: 0;
  transition: all 0.5s ease;
}

.nav-button.active .material-symbols-outlined {
  font-variation-settings: "wght" 500;
  font-variation-settings: "FILL" 1;
  animation: iconFillAnimation 0.5s ease;
}

.icons-loaded .material-symbols-outlined {
  opacity: 1;
}

.sortable-chosen {
  cursor: grabbing;
}

.sortable-dragged .card {
  opacity: 0.7;
}

.sortable-dragged .sortable-chosen {
  opacity: 1;
}

.card-item {
  margin-bottom: 7px;
}

.card-item > a,
.card-item > a:active {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
}

.card-item > .material-symbols-outlined {
  color: var(--card-content-icon);
  margin-right: 7px;
  font-size: 22px;
  font-variation-settings: "wght" 300;
}

.news-actions {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 10;
}

.news-actions .delete-news-icon {
  font-size: 26px;
  font-variation-settings: 'wght' 200, 'FILL' 0;
  color: var(--accent);
  cursor: pointer;
}

.news-actions .delete-news-icon:hover {
  font-variation-settings: 'wght' 300, 'FILL' 1;
}

/* ========================================================= */
/* 6. СТИЛИ МОДАЛЬНОГО ОКНА                                  */
/* ========================================================= */

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.8);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1001;
  opacity: 1;
  transition: opacity 0.3s ease-in-out;
}

.modal-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

.modal-content {
  background-color: #fff;
  padding: 30px;
  border-radius: 12px;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
  text-align: center;
  max-width: 350px;
  width: 90%;
  transform: scale(1);
  transition: transform 0.3s ease-in-out;
}

.modal-overlay.hidden .modal-content {
  transform: scale(0.9);
}

#modal-message {
  font-size: 1.1em;
  color: #333;
  margin-bottom: 25px;
}

.modal-buttons {
  display: flex;
  justify-content: space-around;
  gap: 15px;
}

.modal-buttons button {
  padding: 10px 20px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 1em;
  font-weight: 500;
  transition: background-color 0.2s;
  flex: 1;
}

#modal-cancel-btn {
  background-color: #f0f0f0;
  color: #555;
}

#modal-cancel-btn:hover {
  background-color: #e0e0e0;
}

#modal-confirm-btn {
  background-color: #f44336;
  color: #fff;
}

#modal-confirm-btn:hover {
  background-color: #d32f2f;
}

/* ========================================================= */
/* 7. СТИЛИ АНИМАЦИЙ И ЗАГРУЗКИ                              */
/* ========================================================= */

.loading-animation {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--text-color);
  animation: loadContentAnimation 0.3s ease;
}

@keyframes loadContentAnimation {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid rgba(0, 0, 0, 0.15);
  border-radius: 50%;
  border-top-color: var(--text-color);
  animation: spinnerAnimation 1.2s ease-in-out infinite;
  margin-bottom: 30px;
}

@keyframes spinnerAnimation {
  to {
    transform: rotate(360deg);
  }
}

@keyframes iconFillAnimation {
  from {
    font-variation-settings: "FILL" 0;
  }
  to {
    font-variation-settings: "FILL" 1;
  }
}

/* ========================================================= */
/* 8. СТИЛИ УВЕДОМЛЕНИЙ (TOAST)                              */
/* ========================================================= */

#toast-container {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  max-width: 90%;
}

.toast {
  padding: 10px 15px;
  border-radius: 8px;
  color: white;
  text-align: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  transition: transform 0.3s ease-in-out, opacity 0.3s ease-in-out;
  opacity: 1;
  transform: translateY(0);
  width: fit-content;
  max-width: 100%;
}

.toast.toast-success {
  background-color: #4caf50;
}

.toast.toast-error {
  background-color: #f44336;
}

.toast.hide {
  opacity: 0;
  transform: translateY(-20px);
}

/* ========================================================= */
/* 9. АДАПТИВНОСТЬ                                           */
/* ========================================================= */

@media (min-width: 840px) {
  .app-header,
  .app-content,
  .app-footer-nav {
    width: 500px;
    margin: 0 auto;
    left: auto;
    right: auto;
  }
}
