/* Общие стили */
body {
  background-color: #111827;
  color: #f3f4f6;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen,
    Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif;
  min-height: 100vh;
  margin: 0;
  padding: 0;
}

/* Анимация появления */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeInUpScale {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Контейнеры */
main {
  padding: 2rem 1rem;
  max-width: 1280px;
  margin: 0 auto;
}

.container {
  background-color: #1f2937;
  border: 1px solid #374151;
  border-radius: 1.5rem;
  padding: 2rem;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
  animation: fadeInUp 0.8s ease-out;
}

/* Заголовки */
h2 {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 2rem;
  color: #f3f4f6;
  text-align: center;
  letter-spacing: -0.025em;
}

h3 {
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 1rem;
  color: #f3f4f6;
}

/* Формы */
form {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

label {
  color: #9ca3af;
  font-size: 0.875rem;
  margin-bottom: 0.5rem;
  display: block;
  font-weight: 500;
}

input,
textarea {
  width: 100%;
  padding: 0.75rem;
  background-color: #111827;
  border: 1px solid #374151;
  border-radius: 0.75rem;
  color: #f3f4f6;
  font-size: 1rem;
  transition: border-color 0.3s, box-shadow 0.3s;
}

input:focus,
textarea:focus {
  outline: none;
  border-color: #6366f1;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

button {
  width: 100%;
  padding: 0.75rem;
  background: linear-gradient(90deg, #6366f1 0%, #4f46e5 100%);
  color: #ffffff;
  border: none;
  border-radius: 0.75rem;
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s, background 0.3s;
}

button:hover {
  background: linear-gradient(90deg, #4f46e5 0%, #4338ca 100%);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.error {
  color: #ef4444;
  margin-bottom: 1.5rem;
  text-align: center;
  font-size: 0.875rem;
}

.success {
  color: #22c55e;
  margin-bottom: 1.5rem;
  text-align: center;
  font-size: 0.875rem;
}

/* Сетка для проектов и скриншотов */
.grid {
  display: grid;
  gap: 2rem;
}

@media (min-width: 640px) {
  .grid.sm\:cols-2 {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 768px) {
  .grid.md\:cols-3 {
    grid-template-columns: repeat(3, 1fr);
  }
  .grid.md\:cols-4 {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* Карточки проектов */
.card {
  background-color: #1f2937;
  border: 1px solid #374151;
  border-radius: 1.25rem;
  overflow: hidden;
  transition: border-color 0.3s, box-shadow 0.3s;
  animation: fadeInUpScale 0.8s ease-out;
}

.card:hover {
  border-color: #6366f1;
  box-shadow: 0 8px 24px rgba(99, 102, 241, 0.3);
}

.card img {
  width: 100%;
  height: 12rem;
  object-fit: cover;
  transition: transform 0.3s;
}

.card:hover img {
  transform: scale(1.05);
}

.card-content {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  min-height: 12rem;
}

.card-icon {
  width: 1.5rem;
  height: 1.5rem;
  margin-right: 0.75rem;
}

.card-title {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
}

.card-description {
  color: #9ca3af;
  font-size: 0.875rem;
  margin-bottom: 1.5rem;
  flex-grow: 1;
}

.card-link {
  color: #6366f1;
  font-size: 0.875rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: color 0.3s;
}

.card-link:hover {
  color: #a5b4fc;
}

/* Список приложений в админке */
.app-list {
  list-style: none;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.app-list li {
  background-color: #111827;
  border-radius: 0.75rem;
  padding: 0.75rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: background-color 0.3s;
  cursor: pointer;
}

.app-list li:hover {
  background-color: #374151;
}

.app-list button {
  background: none;
  border: none;
  color: #6366f1;
  font-size: 0.875rem;
  cursor: pointer;
  transition: color 0.3s;
}

.app-list button:hover {
  color: #a5b4fc;
}

.app-list .delete {
  color: #ef4444;
}

.app-list .delete:hover {
  color: #f87171;
}

/* Скриншоты */
.screenshot-container {
  position: relative;
  overflow: hidden;
  border-radius: 0.75rem;
  transition: transform 0.3s, box-shadow 0.3s;
}

.screenshot-container:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}

.screenshot-container img {
  width: 100%;
  aspect-ratio: 9 / 16; /* Соотношение сторон 9:16 */
  object-fit: cover; /* Сохраняет пропорции, обрезая излишки */
  border-radius: 0.75rem;
  border: 1px solid #374151;
  transition: transform 0.3s;
}

.screenshot-container:hover img {
  transform: scale(1.05);
}

.screenshot-container .index {
  position: absolute;
  top: 0.5rem;
  left: 0.5rem;
  background-color: rgba(17, 24, 39, 0.8);
  color: #f3f4f6;
  font-size: 0.75rem;
  padding: 0.5rem 0.75rem;
  border-radius: 0.5rem;
}

.screenshot-container .remove {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  background-color: #ef4444;
  border-radius: 9999px;
  padding: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background-color 0.3s, transform 0.2s;
}

.screenshot-container .remove:hover {
  background-color: #dc2626;
  transform: scale(1.1);
}

@media (max-width: 640px) {
  .screenshot-container img {
    aspect-ratio: 9 / 16; /* Сохраняем пропорции 9:16 */
    max-height: 14rem; /* Ограничиваем высоту для мобильных */
  }
}

/* Предварительный просмотр PDF */
#pdf-preview .relative {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem;
  background-color: #111827;
  border: 1px solid #374151;
  border-radius: 0.75rem;
}

#pdf-preview .remove {
  background-color: #ef4444;
  border-radius: 9999px;
  padding: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background-color 0.3s, transform 0.2s;
}

#pdf-preview .remove:hover {
  background-color: #dc2626;
  transform: scale(1.1);
}

/* Адаптивность для страницы логина */
.login-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-form {
  width: 100%;
  max-width: 32rem;
}

/* Адаптивность для страницы админ-панели */
@media (min-width: 768px) {
  main.admin {
    padding-top: 6rem;
    padding-bottom: 4rem;
  }
}

/* Адаптивность для страницы проектов */
@media (min-width: 1024px) {
  .grid.lg\:cols-3 {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* SVG иконки */
svg.icon {
  width: 1.25rem;
  height: 1.25rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

svg.icon.large {
  width: 2.5rem;
  height: 2.5rem;
}

/* Анимация для кнопок */
@keyframes buttonHover {
  from {
    background: linear-gradient(90deg, #6366f1 0%, #4f46e5 100%);
  }
  to {
    background: linear-gradient(90deg, #4f46e5 0%, #4338ca 100%);
  }
}

/* Стили для страницы отдельного проекта */
.project-detail .main-image {
  width: 100%;
  max-width: 300px;
  height: auto;
  aspect-ratio: 1/1;
  object-fit: contain;
  border-radius: 1.25rem;
  margin: 0 auto 2rem;
  display: block;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
  animation: fadeInUpScale 0.8s ease-out;
}

.project-detail .screenshots-grid img {
  width: 100%;
  height: 14rem;
  object-fit: cover;
  border-radius: 1rem;
  border: 1px solid #374151;
  transition: transform 0.3s, box-shadow 0.3s;
}

.project-detail .screenshots-grid img:hover {
  transform: scale(1.05);
  box-shadow: 0 8px 24px rgba(99, 102, 241, 0.3);
}

/* Стили для кнопок Google Play, RuStore и PDF */
.project-detail .action-buttons a {
  padding: 0.75rem 1.5rem;
  border-radius: 0.75rem;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  transition: transform 0.2s, box-shadow 0.2s, background 0.3s;
  text-decoration: none;
}

.project-detail .action-buttons a:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.project-detail .action-buttons .rustore {
  background: linear-gradient(90deg, #6366f1 0%, #4f46e5 100%);
}

.project-detail .action-buttons .rustore:hover {
  background: linear-gradient(90deg, #4f46e5 0%, #4338ca 100%);
}

.project-detail .action-buttons .googleplay {
  background: linear-gradient(90deg, #16a34a 0%, #15803d 100%);
}

.project-detail .action-buttons .googleplay:hover {
  background: linear-gradient(90deg, #15803d 0%, #166534 100%);
}

.project-detail .action-buttons .pdf {
  background: linear-gradient(90deg, #6b7280 0%, #4b5563 100%);
}

.project-detail .action-buttons .pdf:hover {
  background: linear-gradient(90deg, #4b5563 0%, #374151 100%);
}

.project-detail .action-buttons .back {
  background: none;
  color: #6366f1;
  padding: 0.75rem 1rem;
}

.project-detail .action-buttons .back:hover {
  color: #a5b4fc;
}

/* Медиа-запросы для мобильных устройств */
@media (max-width: 640px) {
  h2 {
    font-size: 1.5rem;
  }

  .project-detail .main-image {
    max-width: 200px;
    margin-bottom: 1.5rem;
  }

  .project-detail .screenshots-grid img {
    height: 8rem;
  }

  .project-detail .action-buttons a {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
  }
}
