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

:root {
  --primary: #2d5a3d;
  --primary-dark: #1e3d29;
  --danger: #dc3545;
  --danger-dark: #c82333;
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --gray-900: #111827;
  --white: #ffffff;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.15);
  --radius: 8px;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--gray-100);
  color: var(--gray-800);
  min-height: 100vh;
}

.hidden {
  display: none !important;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.625rem 1.25rem;
  border: none;
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-primary {
  background: var(--primary);
  color: var(--white);
}

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

.btn-outline {
  background: transparent;
  border: 1px solid var(--gray-300);
  color: var(--gray-700);
}

.btn-outline:hover {
  background: var(--gray-100);
}

.btn-danger {
  background: var(--danger);
  color: var(--white);
}

.btn-danger:hover {
  background: var(--danger-dark);
}

.btn-icon {
  padding: 0.5rem;
  background: transparent;
  border: none;
  color: var(--gray-600);
}

.btn-icon:hover {
  background: var(--gray-200);
  border-radius: var(--radius);
}

/* Login */
.login-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
}

.login-card {
  background: var(--white);
  padding: 2.5rem;
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 400px;
}

.login-card h1 {
  font-size: 1.75rem;
  color: var(--primary);
  margin-bottom: 0.25rem;
}

.login-card p {
  color: var(--gray-500);
  margin-bottom: 2rem;
}

.form-group {
  margin-bottom: 1.25rem;
}

.form-group label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--gray-700);
  margin-bottom: 0.5rem;
}

.form-group input,
.form-group textarea {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius);
  font-size: 1rem;
  transition: border-color 0.2s;
}

.form-group input:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--primary);
}

.form-group textarea {
  resize: vertical;
  min-height: 60px;
}

.checkbox-group {
  margin-bottom: 1.5rem;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  font-weight: 400;
}

.checkbox-label input[type="checkbox"] {
  width: 1rem;
  height: 1rem;
  accent-color: var(--primary);
  cursor: pointer;
}

.checkbox-label span {
  font-size: 0.875rem;
  color: var(--gray-600);
}

.login-card .btn {
  width: 100%;
  justify-content: center;
  padding: 0.875rem;
  margin-top: 0.5rem;
}

.error-message {
  color: var(--danger);
  font-size: 0.875rem;
  margin-bottom: 1rem;
  padding: 0.75rem;
  background: #fef2f2;
  border-radius: var(--radius);
}

/* Admin Layout */
.admin-container {
  min-height: 100vh;
}

.admin-header {
  background: var(--white);
  padding: 1rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: var(--shadow);
  position: sticky;
  top: 0;
  z-index: 100;
}

.admin-header h1 {
  font-size: 1.25rem;
  color: var(--primary);
}

.header-right {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.header-right span {
  color: var(--gray-600);
  font-size: 0.875rem;
}

.admin-main {
  padding: 2rem;
  max-width: 1400px;
  margin: 0 auto;
}

/* Sections */
.section {
  background: var(--white);
  border-radius: 12px;
  padding: 1.5rem;
  box-shadow: var(--shadow);
}

.section h2 {
  font-size: 1.125rem;
  margin-bottom: 1.5rem;
  color: var(--gray-800);
}

.section-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.section-header h2 {
  margin-bottom: 0;
  flex: 1;
}

.header-actions {
  display: flex;
  gap: 0.75rem;
}

/* Albums Grid */
.albums-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
}

.album-card {
  background: var(--gray-50);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  border: 1px solid var(--gray-200);
}

.album-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.album-card-image {
  height: 180px;
  background: var(--gray-200);
  position: relative;
}

.album-card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.album-card-content {
  padding: 1rem;
}

.album-card-content h3 {
  font-size: 1rem;
  margin-bottom: 0.25rem;
}

.album-card-content span {
  font-size: 0.875rem;
  color: var(--gray-500);
}

/* Images Grid */
.images-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
}

.image-card {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  aspect-ratio: 1;
  background: var(--gray-200);
}

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

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

.image-card-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.6) 0%, transparent 50%);
  opacity: 0;
  transition: opacity 0.2s;
  display: flex;
  align-items: flex-end;
  padding: 0.75rem;
}

.image-card:hover .image-card-overlay {
  opacity: 1;
}

.image-card-overlay span {
  color: var(--white);
  font-size: 0.75rem;
}

.image-card .edit-badge {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  background: var(--primary);
  color: var(--white);
  padding: 0.25rem;
  border-radius: 4px;
  opacity: 0;
  transition: opacity 0.2s;
}

.image-card:hover .edit-badge {
  opacity: 1;
}

.image-card .edit-badge .material-icons {
  font-size: 1rem;
}

/* Modal */
.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
}

.modal-content {
  position: relative;
  background: var(--white);
  border-radius: 12px;
  width: 100%;
  max-width: 600px;
  max-height: 90vh;
  overflow: auto;
  box-shadow: var(--shadow-lg);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--gray-200);
}

.modal-header h3 {
  font-size: 1.125rem;
}

.modal-body {
  padding: 1.5rem;
}

.modal-footer {
  display: flex;
  justify-content: space-between;
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--gray-200);
  background: var(--gray-50);
}

.image-preview {
  margin-bottom: 1.5rem;
  border-radius: var(--radius);
  overflow: hidden;
  max-height: 300px;
}

.image-preview img {
  width: 100%;
  height: auto;
  max-height: 300px;
  object-fit: contain;
  background: var(--gray-100);
}

/* Loading */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(255, 255, 255, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--gray-200);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* Toast */
.toast {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  background: var(--gray-800);
  color: var(--white);
  padding: 1rem 1.5rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  z-index: 3000;
  animation: slideIn 0.3s ease;
}

.toast.success {
  background: var(--primary);
}

.toast.error {
  background: var(--danger);
}

@keyframes slideIn {
  from {
    transform: translateY(100%);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

/* Tabs */
.admin-tabs {
  display: flex;
  background: var(--white);
  border-bottom: 1px solid var(--gray-200);
  padding: 0 2rem;
}

.tab-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 1rem 1.5rem;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--gray-500);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.tab-btn:hover {
  color: var(--gray-700);
  background: var(--gray-50);
}

.tab-btn.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

.tab-btn .material-icons {
  font-size: 1.25rem;
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

/* Content Management */
.content-sections {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.content-section {
  background: var(--white);
  border-radius: 12px;
  padding: 1.5rem;
  box-shadow: var(--shadow);
}

.content-section h3 {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1rem;
  color: var(--primary);
  margin-bottom: 1.25rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--gray-200);
}

.content-section h3 .material-icons {
  font-size: 1.25rem;
}

.content-fields {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.content-field {
  display: grid;
  gap: 0.5rem;
}

.content-field label {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--gray-700);
  margin-bottom: 0.25rem;
}

.content-field input,
.content-field textarea {
  width: 100%;
  padding: 0.625rem 0.875rem;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius);
  font-size: 0.875rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.content-field input:focus,
.content-field textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(45, 90, 61, 0.1);
}

.content-field textarea {
  resize: vertical;
  min-height: 60px;
}

.content-field .content-it {
  border-left: 3px solid #009246;
}

.content-field .content-de {
  border-left: 3px solid #000000;
}

.content-field .content-en {
  border-left: 3px solid #012169;
}

.content-actions {
  margin-top: 2rem;
  display: flex;
  justify-content: center;
}

.btn-large {
  padding: 1rem 2rem;
  font-size: 1rem;
}

/* Responsive */
@media (max-width: 768px) {
  .admin-header {
    padding: 1rem;
  }

  .admin-tabs {
    padding: 0 1rem;
  }

  .tab-btn {
    flex: 1;
    justify-content: center;
    padding: 0.75rem 0.5rem;
    font-size: 0.8rem;
  }

  .admin-main {
    padding: 1rem;
  }

  .section-header {
    flex-wrap: wrap;
  }

  .header-actions {
    width: 100%;
    margin-top: 0.5rem;
  }

  .upload-btn {
    width: 100%;
    justify-content: center;
  }

  .images-grid {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  }

  .modal-footer {
    flex-direction: column-reverse;
    gap: 0.75rem;
  }

  .modal-footer .btn {
    width: 100%;
    justify-content: center;
  }

  .content-section h3 {
    font-size: 0.9rem;
  }

  .content-actions .btn {
    width: 100%;
  }
}
