:root {
  --primary-color: #1a1a1a;
  --secondary-color: #3498db;
  --background-color: #121212;
  --text-color: #ffffff;
  --spacing: 20px;
}

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

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background-color: var(--background-color);
  color: var(--text-color);
  line-height: 1.6;
}

header {
  background-color: var(--primary-color);
  color: white;
  padding: var(--spacing);
  box-shadow: 0 2px 10px rgba(0,0,0,0.3);
}

nav {
  margin-top: 10px;
  display: flex;
  gap: 10px;
}

button {
  padding: 8px 16px;
  background-color: var(--secondary-color);
  color: white;
  border: none;
  border-radius: 0;
  cursor: pointer;
  transition: background-color 0.3s;
}

button:hover {
  background-color: #2980b9;
}

main {
  padding: var(--spacing);
}

.gallery {
  display: flex;
  flex-wrap: wrap;
  gap: 15px;
}

.gallery-item {
  position: relative;
  overflow: hidden;
  box-shadow: 0 4px 8px rgba(0,0,0,0.5);
  transition: transform 0.3s, opacity 0.5s;
  opacity: 0;
  transform: translateY(20px);
  background-color: var(--primary-color);
}

.gallery-item.visible {
  opacity: 1;
  transform: translateY(0);
}

.gallery-item.landscape {
  flex: 0 0 calc(33.333% - 10px);
  height: 200px;
}

.gallery-item.portrait {
  flex: 0 0 calc(25% - 11.25px);
  height: 300px;
}

.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s;
  cursor: pointer;
  padding: 0;
  border-radius: 0;
}

.gallery-item:hover img {
  transform: scale(1.05);
}

.gallery-item .delete-btn {
  position: absolute;
  top: 5px;
  right: 5px;
  background: rgba(255,0,0,0.7);
  color: white;
  border: none;
  border-radius: 50%;
  width: 24px;
  height: 24px;
  cursor: pointer;
  display: none;
  z-index: 2;
}

.gallery-item:hover .delete-btn {
  display: block;
}

.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.95);
  z-index: 1000;
  padding: 40px;
  cursor: pointer;
}

.modal.active {
  display: flex;
  justify-content: center;
  align-items: center;
}

.modal img {
  max-width: 90%;
  max-height: 90vh;
  object-fit: contain;
  cursor: default;
  animation: modalZoomIn 0.3s ease-out;
  box-shadow: 0 0 30px rgba(0,0,0,0.8);
}

@keyframes modalZoomIn {
  from {
    opacity: 0;
    transform: scale(0.9);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.fade-in {
  animation: fadeIn 0.5s ease-out forwards;
}

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

@media (max-width: 1200px) {
  .gallery-item.landscape {
    flex: 0 0 calc(50% - 7.5px);
  }
  
  .gallery-item.portrait {
    flex: 0 0 calc(33.333% - 10px);
  }
}

@media (max-width: 768px) {
  .gallery-item.landscape,
  .gallery-item.portrait {
    flex: 0 0 calc(50% - 7.5px);
    height: 200px;
  }
}

@media (max-width: 480px) {
  .gallery-item.landscape,
  .gallery-item.portrait {
    flex: 0 0 100%;
    height: 250px;
  }
}