/* Moderne Farbpalette */
:root {
  --bg-dark: #121212;
  --bg-card: #1e1e1e;
  --bg-light: #2d2d2d;
  --text-primary: #ffffff;
  --text-secondary: #b0b0b0;
  --accent-primary: #4f46e5;
  --accent-primary-hover: #4338ca;
  --accent-success: #10b981;
  --accent-danger: #ef4444;
  --accent-warning: #f59e0b;
  --border-color: rgba(255, 255, 255, 0.1);
  --shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --transition: all 0.2s ease;
}

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

body {
  font-family: "Inter", "Segoe UI", Arial, sans-serif;
  background: var(--bg-dark);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.5;
}

/* Navigation Bar */
.navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-card);
  padding: 0.75rem 1.5rem;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
  position: sticky;
  top: 0;
  z-index: 100;
}

.navbar-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.navbar-brand h1 {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

.logo {
  height: 2.5rem;
  width: auto;
}

.navbar-menu {
  display: flex;
  gap: 0.5rem;
}

.navbar-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  color: var(--text-secondary);
  text-decoration: none;
  border-radius: var(--radius-md);
  transition: var(--transition);
}

.navbar-item:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
}

.navbar-item.active {
  background: rgba(79, 70, 229, 0.1);
  color: var(--accent-primary);
}

.navbar-end {
  display: flex;
  align-items: center;
}

.logout-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition);
}

.logout-btn:hover {
  background: rgba(239, 68, 68, 0.1);
  color: var(--accent-danger);
  border-color: var(--accent-danger);
}

/* Hamburger Menu */
.hamburger {
  display: none;
  flex-direction: column;
  justify-content: space-between;
  width: 30px;
  height: 20px;
  cursor: pointer;
  z-index: 200;
}

.hamburger span {
  display: block;
  height: 3px;
  width: 100%;
  background-color: var(--text-primary);
  border-radius: 3px;
  transition: var(--transition);
}

/* Container */
.container {
  max-width: 1200px;
  margin: 2rem auto;
  padding: 0 1rem;
}

/* Dashboard Header */
.dashboard-header {
  background: var(--bg-card);
  padding: 1.5rem;
  border-radius: var(--radius-lg);
  margin-bottom: 2rem;
  border: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.header-content h1 {
  font-size: 1.75rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.header-content p {
  color: var(--text-secondary);
}

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

/* Search Bar */
.search-container {
  margin-bottom: 1.5rem;
  position: relative;
}

.search-input {
  width: 100%;
  padding: 0.75rem 1rem 0.75rem 2.5rem;
  background: var(--bg-light);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 1rem;
  transition: var(--transition);
}

.search-input:focus {
  border-color: var(--accent-primary);
  outline: none;
  box-shadow: 0 0 0 2px rgba(79, 70, 229, 0.2);
}

.search-icon {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-secondary);
}

/* Buttons */
button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.625rem 1.25rem;
  border: none;
  border-radius: var(--radius-md);
  font-weight: 500;
  font-size: 0.875rem;
  cursor: pointer;
  transition: var(--transition);
}

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

.primary-btn:hover {
  background: var(--accent-primary-hover);
  transform: translateY(-1px);
}

.secondary-btn {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

.secondary-btn:hover {
  background: rgba(255, 255, 255, 0.1);
}

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

.danger-btn:hover {
  background: #dc2626;
}

.edit-btn {
  color: white;
  background-color: var(--accent-warning);
}

.edit-btn:hover {
  background-color: #d97706;
}

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

.delete-btn:hover {
  background-color: #dc2626;
}

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

.product-card {
  background: var(--bg-card);
  border-radius: 12px; /* Abgerundete Ecken verbessert */
  box-shadow: var(--shadow);
  padding: 1.5em; /* Mehr Innenabstand für bessere Lesbarkeit */
  display: flex;
  flex-direction: column;
  gap: 1em; /* Mehr Abstand zwischen den Elementen */
  transition: transform 0.3s ease, box-shadow 0.3s ease; /* Sanfte Animationen */
  overflow: hidden; /* Inhalt bleibt innerhalb der Karte */
  position: relative; /* Für zusätzliche Inhalte wie Icons */
}

.product-card:hover {
  transform: translateY(-5px); /* Leichtes Anheben beim Hover */
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4); /* Stärkere Schatten beim Hover */
}

.product-card h3 {
  font-size: 1.4em;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

.product-card p {
  font-size: 1em;
  color: var(--text-secondary);
  margin: 0.5em 0;
}

.product-card button {
  margin-top: auto; /* Buttons bleiben unten */
  padding: 0.6em 1.2em;
  font-size: 0.9em;
  border-radius: 6px;
}

.product-card img {
  width: 100%;
  height: auto;
  border-radius: 8px;
  margin-bottom: 1em;
  object-fit: cover; /* Bild wird passend zugeschnitten */
  max-height: 200px; /* Begrenzung der Bildhöhe */
}

.product-card .status-icons {
  position: absolute;
  top: 10px;
  right: 10px;
  display: flex;
  gap: 0.5em;
  font-size: 1.2em;
  color: var(--accent-primary);
}

.product-card-header {
  padding: 1rem;
  border-bottom: 1px solid var(--border-color);
}

.product-card-header h3 {
  font-size: 1.125rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.product-category {
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.product-card-body {
  padding: 1rem;
}

.product-price {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--accent-primary);
  margin-bottom: 0.75rem;
}

.product-description {
  color: var(--text-secondary);
  margin-bottom: 1rem;
  font-size: 0.875rem;
}

.product-card-footer {
  display: flex;
  gap: 0.5rem;
  padding: 1rem;
  border-top: 1px solid var(--border-color);
}

.product-card-footer button {
  flex: 1;
}

.sale-price {
  color: red !important;
}

/* Modal */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.7);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
}

/* Login Modal */
.login-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: var(--bg-dark);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
}

.login-logo {
  margin-bottom: 2rem;
  text-align: center;
}

.login-logo h1 {
  font-size: 2rem;
  margin-top: 1rem;
  color: var(--text-primary);
}

.modal-content {
  background: var(--bg-card);
  padding: 1.5rem;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  min-width: 320px;
  max-width: 95vw;
  width: 500px;
  max-height: 90vh;
  overflow-y: auto;
}

.product-modal {
  width: 600px;
}

.modal-content h2 {
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 1.5rem;
  color: var(--text-primary);
}

.modal-actions {
  display: flex;
  gap: 1rem;
  justify-content: flex-end;
  margin-top: 1.5rem;
}

/* Forms */
form {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

label {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
}

input,
textarea,
select {
  background: var(--bg-light);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 0.75rem;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  width: 100%;
  transition: var(--transition);
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--accent-primary);
  outline: none;
  box-shadow: 0 0 0 2px rgba(79, 70, 229, 0.2);
}

textarea {
  resize: vertical;
  min-height: 100px;
}

select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23b0b0b0' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  padding-right: 2.5rem;
}

.help-text {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-top: -0.25rem;
}

/* Password Input */
.password-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.password-wrapper input {
  width: 100%;
  padding-right: 2.5rem;
}

.toggle-password {
  position: absolute;
  right: 0.75rem;
  cursor: pointer;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  height: 100%;
}

/* Tabs */
.tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 0.5rem;
}

.tab-btn {
  background: transparent;
  color: var(--text-secondary);
  border: none;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  cursor: pointer;
  transition: var(--transition);
}

.tab-btn:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
}

.tab-btn.active {
  background: rgba(79, 70, 229, 0.1);
  color: var(--accent-primary);
}

.tab-content {
  display: none;
}

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

/* Collapsible Sections */
.collapsible-section {
  margin-bottom: 1em;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.collapsible-toggle {
  width: 100%;
  text-align: left;
  padding: 1em;
  background: var(--bg-light);
  border: none;
  color: var(--text-primary);
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
}

.collapsible-content {
  padding: 1em;
  border-top: 1px solid var(--border-color);
}

.collapsible-toggle[aria-expanded="true"] {
  background-color: rgba(16, 185, 129, 0.1);
}

.collapsible-toggle[aria-expanded="false"] {
  background-color: rgba(239, 68, 68, 0.1);
}

/* Radio Buttons */
.radio-group {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.radio-label {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  cursor: pointer;
}

.radio-label input[type="radio"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.radio-custom {
  display: inline-block;
  width: 1.25rem;
  height: 1.25rem;
  border-radius: 50%;
  border: 2px solid var(--border-color);
  position: relative;
  transition: var(--transition);
}

.radio-label input[type="radio"]:checked + .radio-custom {
  border-color: var(--accent-primary);
}

.radio-label input[type="radio"]:checked + .radio-custom::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 0.625rem;
  height: 0.625rem;
  border-radius: 50%;
  background: var(--accent-primary);
}

/* Toast */
.toast {
  background: var(--bg-card);
  border-left: 4px solid;
  padding: 1em 1.5em;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow);
  position: fixed;
  bottom: 20px;
  right: 20px;
  color: var(--text-primary);
  opacity: 0;
  transition: opacity 0.3s ease-in-out;
  z-index: 1000;
}

.toast.show {
  opacity: 1;
}

.toast-success {
  border-color: var(--accent-success);
}

.toast-error {
  border-color: var(--accent-danger);
}

.toast-warning {
  border-color: var(--accent-warning);
}

/* SweetAlert Customization */
.swal2-popup {
  border-radius: var(--radius-lg) !important;
  background: var(--bg-card) !important;
  font-family: "Inter", "Segoe UI", Arial, sans-serif !important;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25) !important;
  color: var(--text-primary) !important;
}

.swal2-title {
  color: var(--text-primary) !important;
  font-size: 1.5rem !important;
}

.swal2-confirm {
  background: var(--accent-success) !important;
  color: white !important;
  border-radius: var(--radius-md) !important;
}

.swal2-cancel {
  background: var(--accent-danger) !important;
  color: white !important;
  border-radius: var(--radius-md) !important;
}

/* No results message */
.no-results {
  text-align: center;
  padding: 2rem;
  color: var(--text-secondary);
  grid-column: 1 / -1;
}

#productImageView {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 20%;
  height: auto;
  border-radius: 8px;
}

/* Responsive */
@media (max-width: 768px) {
  #productImageView {
    display: none;
  }

  .navbar {
    padding: 0.75rem 1rem;
  }

  .navbar-menu {
    position: fixed;
    top: 0;
    right: -100%;
    width: 70%;
    max-width: 300px;
    height: 100vh;
    background: var(--bg-card);
    flex-direction: column;
    padding: 5rem 1.5rem 1.5rem;
    transition: right 0.3s ease;
    z-index: 150;
    box-shadow: -5px 0 15px rgba(0, 0, 0, 0.1);
  }

  .navbar-menu.active {
    right: 0;
  }

  .navbar-item {
    padding: 1rem;
    width: 100%;
  }

  .hamburger {
    display: flex;
    z-index: 200;
  }

  .hamburger.active span:nth-child(1) {
    transform: translateY(8px) rotate(45deg);
  }

  .hamburger.active span:nth-child(2) {
    opacity: 0;
  }

  .hamburger.active span:nth-child(3) {
    transform: translateY(-8px) rotate(-45deg);
  }

  .dashboard-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .header-actions {
    width: 100%;
  }

  .header-actions button {
    flex: 1;
  }

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

  .modal-content {
    width: 95vw;
    padding: 1rem;
  }

  .tabs {
    flex-wrap: wrap;
  }

  .tab-btn {
    flex: 1;
    text-align: center;
    padding: 0.5rem;
  }
}

@media (max-width: 480px) {
  .navbar-brand h1 {
    display: none;
  }

  .modal-actions {
    flex-direction: column;
  }

  .modal-actions button {
    width: 100%;
  }

  .product-grid {
    grid-template-columns: 1fr;
  }
}
