/* Allgemeines CSS (aus main.php) */

:root {
  --md-sys-color-primary: #6750a4;
  --md-sys-color-on-primary: #ffffff;
  --md-sys-color-primary-container: #eaddff;
  --md-sys-color-on-primary-container: #21005d;
  --md-sys-color-primary-variant: #8a6bb1;
  --md-sys-color-secondary: #625b71;
  --md-sys-color-on-secondary: #ffffff;
  --md-sys-color-secondary-container: #e8def8;
  --md-sys-color-on-secondary-container: #1d192b;
  --md-sys-color-tertiary: #7d5260;
  --md-sys-color-on-tertiary: #ffffff;
  --md-sys-color-tertiary-container: #ffd8e4;
  --md-sys-color-on-tertiary-container: #31111d;
  --md-sys-color-error: #b3261e;
  --md-sys-color-error-hover: #911e18;
  --md-sys-color-on-error: #ffffff;
  --md-sys-color-error-container: #f9dedc;
  --md-sys-color-on-error-container: #410e0b;
  --md-sys-color-background: #fffbfe;
  --md-sys-color-on-background: #1c1b1f;
  --md-sys-color-surface: #fffbfe;
  --md-sys-color-on-surface: #1c1b1f;
  --md-sys-color-surface-variant: #e7e0ec;
  --md-sys-color-on-surface-variant: #49454f;
  --md-sys-color-surface-container-low: #f7f2fa;
  --md-sys-color-surface-container-high: #ece6f0;
  --md-sys-color-outline: #79747e;
  --md-sys-color-shadow: #000000;
  --md-sys-color-inverse-surface: #313033;
  --md-sys-color-inverse-on-surface: #f4eff4;
  --md-sys-color-inverse-primary: #d0bcff;
}

body {
  font-family: "Roboto", sans-serif;
  background-color: var(--md-sys-color-background);
  color: var(--md-sys-color-on-background);
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  line-height: 1.6;
}

h1, h2, h3, h4, h5, h6 { /* Basic heading modernization */
  font-weight: 600;
  color: var(--md-sys-color-on-background); /* Ensure contrast */
  margin-top: 1.5em;
  margin-bottom: 0.75em;
}

/* Specific h1 style is in header h1 */

header {
  background-color: var(--md-sys-color-surface-variant);
  color: var(--md-sys-color-on-surface-variant);
  padding: 1rem 2rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06); /* Modernized shadow */
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 1.5rem; /* Increased gap */
}

header .logo-nav {
  display: flex;
  align-items: center;
  gap: 1rem; /* This is for logo and nav, 1.5rem on header is for items within header flexbox */
}

header h1 {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 600; /* Modernized font weight */
}

header h1 a {
  text-decoration: none;
  color: var(--md-sys-color-primary);
}

nav ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

nav ul li a {
  text-decoration: none;
  color: var(--md-sys-color-on-surface-variant);
  display: flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.25rem 0;
}

nav ul li a .material-icons {
  font-size: 1.1rem;
}

nav ul li a:hover,
nav ul li a.active {
  color: var(--md-sys-color-primary);
}

.header-search {
  display: flex;
  align-items: center;
  flex-grow: 1;
  max-width: 400px;
}

.header-search input[type="text"] {
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--md-sys-color-outline);
  border-right: none;
  border-radius: 4px 0 0 4px;
  background-color: var(--md-sys-color-surface);
  color: var(--md-sys-color-on-surface);
  flex-grow: 1;
}

.header-search button {
  padding: 0.5rem 0.75rem;
  background-color: var(--md-sys-color-primary);
  color: var(--md-sys-color-on-primary);
  border: 1px solid var(--md-sys-color-primary);
  border-radius: 0 4px 4px 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center; /* Ensure horizontal centering */
}

.header-search button .material-icons {
  font-size: 1.2rem;
  padding: 0; /* Remove potential default padding */
  margin: 0; /* Remove potential default margin */
}

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

.header-actions .user-greeting {
  font-size: 0.9rem;
  white-space: nowrap;
}

.header-actions a {
  white-space: nowrap;
}

#theme-toggle {
  background: var(--md-sys-color-secondary-container);
  color: var(--md-sys-color-on-secondary-container);
  border: none;
  padding: 0.5rem;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

#theme-toggle .material-icons {
  font-size: 1.25rem;
}

.container {
  flex: 1;
  padding: 20px 30px; /* Increased padding */
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
}

footer {
  background-color: var(--md-sys-color-surface-variant);
  color: var(--md-sys-color-on-surface-variant);
  text-align: center;
  padding: 1.5rem 1rem; /* Increased padding */
  margin-top: auto;
}

body.dark-theme {
  --md-sys-color-primary: #d0bcff;
  --md-sys-color-on-primary: #381e72;
  --md-sys-color-primary-container: #4f378b;
  --md-sys-color-on-primary-container: #eaddff;
  --md-sys-color-primary-variant: #b8a7e0;
  --md-sys-color-secondary: #ccc2dc;
  --md-sys-color-on-secondary: #332d41;
  --md-sys-color-secondary-container: #4a4458;
  --md-sys-color-on-secondary-container: #e8def8;
  --md-sys-color-tertiary: #efb8c8;
  --md-sys-color-on-tertiary: #492532;
  --md-sys-color-tertiary-container: #633b48;
  --md-sys-color-on-tertiary-container: #ffd8e4;
  --md-sys-color-error: #f2b8b5;
  --md-sys-color-on-error: #601410;
  --md-sys-color-error-container: #8c1d18;
  --md-sys-color-on-error-container: #f9dedc;
  --md-sys-color-background: #1c1b1f;
  --md-sys-color-on-background: #e6e1e5;
  --md-sys-color-surface: #1c1b1f;
  --md-sys-color-on-surface: #e6e1e5;
  --md-sys-color-surface-variant: #49454f;
  --md-sys-color-on-surface-variant: #cac4d0;
  --md-sys-color-surface-container-low: #211f26;
  --md-sys-color-surface-container-high: #2b2930;
  --md-sys-color-outline: #938f99;
  --md-sys-color-inverse-surface: #e6e1e5;
  --md-sys-color-inverse-on-surface: #313033;
  --md-sys-color-inverse-primary: #6750a4;
}

@media (max-width: 768px) {
  header {
    flex-direction: column;
    align-items: stretch;
  }

  .logo-nav {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
  }

  header h1 { /* Center logo text */
    text-align: center;
  }

  nav ul {
    flex-direction: column; /* Stack nav items vertically */
    align-items: stretch; /* Make nav items take full width */
  }

  nav ul li { /* Add spacing between stacked nav items */
    margin-bottom: 0.5rem;
  }

  nav ul li a { /* Ensure links take full width for easier tapping */
    display: block;
    text-align: center; /* Center nav link text */
  }

  .header-search {
    order: 3;
    margin-top: 0.5rem;
    width: 100%;
    max-width: none;
  }

  .header-actions {
    order: 2;
    justify-content: space-between;
    width: 100%;
  }
}

@media (max-width: 480px) {
  nav ul li a {
    font-size: 0.85rem;
  }

  nav ul li a .material-icons {
    font-size: 1rem;
  }

  .header-search input[type="text"] {
    padding: 0.4rem 0.6rem;
  }

  .header-search button {
    padding: 0.4rem 0.6rem;
  }

  .header-actions {
    gap: 0.5rem;
  }

  .header-actions a,
  .header-actions .user-greeting {
    font-size: 0.85rem;
  }
}

/* Produkt-Raster und -Karten */
.product-grid {
  display: grid; /* Changed to grid */
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); /* Responsive columns */
  gap: 10px;
  margin-top: 20px;
}

.product-card {
  border: 1px solid var(--md-sys-color-outline);
  padding: 1rem; /* Standardized padding */
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1); /* Modernized shadow */
  border-radius: 8px; /* Rounded corners */
  display: flex;
  flex-direction: column;
  transition: box-shadow 0.3s ease-in-out, transform 0.3s ease-in-out; /* Smooth transition */
}

.product-card:hover {
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15); /* Enhanced shadow on hover */
  transform: translateY(-5px); /* Slight lift on hover */
}

.product-img {
  width: 100%;
  aspect-ratio: 1 / 1;
  background: #fff;
  border-radius: 5px;
}

.product-img img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

/* Allgemeine Formularstile */
form label {
  display: block;
  margin-bottom: 5px;
}

form input[type="text"],
form input[type="email"],
form input[type="password"],
form textarea {
  width: 100%;
  padding: 10px 12px; /* Updated padding */
  margin-bottom: 10px;
  border: 1px solid var(--md-sys-color-outline);
  border-radius: 6px; /* Updated border-radius */
  background-color: var(--md-sys-color-surface);
  color: var(--md-sys-color-on-surface);
  transition: border-color 0.2s ease-in-out, box-shadow 0.2s ease-in-out; /* Added transition for focus */
}

form button {
  padding: 10px 20px; /* Updated padding */
  color: var(--md-sys-color-on-primary);
  background-color: var(--md-sys-color-primary);
  border: none;
  border-radius: 6px; /* Updated border-radius */
  cursor: pointer;
  font-weight: 500; /* Added font-weight */
  transition: background-color 0.2s ease-in-out, transform 0.1s ease, box-shadow 0.2s ease-in-out; /* Added transition */
}

form button:hover {
  opacity: 0.9; /* Existing, consider replacing with brightness or primary-variant */
  transform: translateY(-1px); /* Added transform */
  box-shadow: 0 2px 4px rgba(0,0,0,0.1); /* Added subtle shadow */
}

form button:active {
  transform: translateY(0); /* Added active state */
}

/* Allgemeine Button-Stile */
.btn-primary {
  text-decoration: none;
  padding: 10px 20px; /* Updated padding */
  background-color: var(--md-sys-color-primary);
  color: var(--md-sys-color-on-primary);
  border-radius: 6px; /* Updated border-radius */
  border: none;
  cursor: pointer;
  display: inline-block;
  font-weight: 500; /* Added font-weight */
  transition: background-color 0.2s ease-in-out, transform 0.1s ease, box-shadow 0.2s ease-in-out; /* Added transition */
}

.btn-primary:hover {
  background-color: var(--md-sys-color-primary-variant); /* Existing behavior, good */
  transform: translateY(-1px); /* Added transform */
  box-shadow: 0 2px 4px rgba(0,0,0,0.1); /* Added subtle shadow */
}

.btn-primary:active {
  transform: translateY(0); /* Added active state */
}

.btn-secondary {
  text-decoration: none;
  padding: 10px 20px; /* Updated padding */
  background-color: var(--md-sys-color-secondary);
  color: var(--md-sys-color-on-secondary);
  border-radius: 6px; /* Updated border-radius */
  border: none;
  cursor: pointer;
  display: inline-block;
  font-weight: 500; /* Added font-weight */
  transition: background-color 0.2s ease-in-out, transform 0.1s ease, box-shadow 0.2s ease-in-out; /* Added transition */
}

.btn-secondary:hover {
  background-color: var(--md-sys-color-secondary-container); /* Example: use container for hover */
  color: var(--md-sys-color-on-secondary-container);
  transform: translateY(-1px); /* Added transform */
  box-shadow: 0 2px 4px rgba(0,0,0,0.1); /* Added subtle shadow */
}

.btn-secondary:active {
  transform: translateY(0); /* Added active state */
}

.btn-secondary-container {
  text-decoration: none;
  padding: 10px 20px; /* Updated padding */
  background-color: var(--md-sys-color-secondary-container);
  color: var(--md-sys-color-on-secondary-container);
  border-radius: 6px; /* Updated border-radius */
  border: none;
  cursor: pointer;
  display: inline-block;
  font-weight: 500; /* Added font-weight */
  transition: background-color 0.2s ease-in-out, transform 0.1s ease, box-shadow 0.2s ease-in-out; /* Added transition */
}

.btn-secondary-container:hover {
  /* Consider a slightly darker shade or an outline for hover on container buttons */
  filter: brightness(0.95);
  transform: translateY(-1px); /* Added transform */
  box-shadow: 0 2px 4px rgba(0,0,0,0.1); /* Added subtle shadow */
}

.btn-secondary-container:active {
  transform: translateY(0); /* Added active state */
}

.btn-error {
  text-decoration: none;
  padding: 10px 20px; /* Updated padding */
  background-color: var(--md-sys-color-error);
  color: var(--md-sys-color-on-error);
  border-radius: 6px; /* Updated border-radius */
  border: none;
  cursor: pointer;
  display: inline-block;
  font-weight: 500; /* Added font-weight */
  transition: background-color 0.2s ease-in-out, transform 0.1s ease, box-shadow 0.2s ease-in-out; /* Added transition */
}

.btn-error:hover {
  background-color: var(--md-sys-color-error-hover); /* Existing behavior, good */
  transform: translateY(-1px); /* Added transform */
  box-shadow: 0 2px 4px rgba(0,0,0,0.1); /* Added subtle shadow */
}

.btn-error:active {
  transform: translateY(0); /* Added active state */
}

.btn-small { /* Adjusted padding for small buttons */
  padding: 6px 12px;
  font-weight: 500; /* Added font-weight */
  border-radius: 6px; /* Updated border-radius */
  /* transition can be inherited or defined if different behavior is needed */
}

/* Allgemeine Rand- und Abstands-Hilfsklassen */
.margin-bottom {
  margin-bottom: 15px;
}

.margin-bottom-small {
  margin-bottom: 5px;
}

.margin-bottom-large {
  margin-bottom: 20px;
}

.margin-top {
  margin-top: 20px;
}

.margin-top-large {
  margin-top: 30px;
}

.padding {
  padding: 10px;
}

/* Allgemeine Formular-Container */
.form-container {
  max-width: 600px;
  margin: auto;
  padding: 20px;
  border: 1px solid var(--md-sys-color-outline);
  border-radius: 5px;
  background-color: var(--md-sys-color-surface-container-low);
  box-sizing: border-box;
}

.form-input {
  width: 100%;
  padding: 10px 12px; /* Updated padding */
  border: 1px solid var(--md-sys-color-outline);
  border-radius: 6px; /* Updated border-radius */
  background-color: var(--md-sys-color-surface);
  color: var(--md-sys-color-on-surface);
  transition: border-color 0.2s ease-in-out, box-shadow 0.2s ease-in-out; /* Added transition for focus */
}

/* Tabellenstile */
.table-full-width {
  width: 100%;
  border-collapse: collapse;
}

.table-header {
  border-bottom: 2px solid var(--md-sys-color-outline);
}

.table-row {
  border-bottom: 1px solid var(--md-sys-color-surface-variant);
}

.table-cell {
  padding: 10px;
  text-align: left;
}

.table-cell-center {
  padding: 10px;
  text-align: center;
}

.table-cell-nowrap {
  padding: 10px;
  text-align: center;
  white-space: nowrap;
}

/* Hilfsklassen */
.text-center {
  text-align: center;
}

.text-small {
  font-size: 0.9em;
  color: var(--md-sys-color-on-surface-variant);
}

.text-tiny {
  font-size: 0.8em;
  color: var(--md-sys-color-on-surface-variant);
}

.search-container {
  display: flex;
  justify-content: center;
  width: 100%;
}

.search-button {
  background-color: var(--md-sys-color-primary);
  color: var(--md-sys-color-on-primary);
  border: none;
  padding: 10px 15px;
  border-radius: 4px;
  cursor: pointer;
  height: 33px;
}

/* Bildstile */
.img-thumbnail {
  max-width: 150px;
  max-height: 150px;
  border-radius: 4px;
  border: 1px solid var(--md-sys-color-outline);
}

/* Inline-Formulare */
.form-inline {
  display: inline;
}

/* Authentifizierungsformular-Stile */
.auth-form-container {
  max-width: 400px;
  margin: 50px auto;
  padding: 20px;
  border: 1px solid var(--md-sys-color-outline);
  border-radius: 8px;
  background-color: var(--md-sys-color-surface-variant);
}

.auth-form-title {
  text-align: center;
  color: var(--md-sys-color-primary);
  margin-bottom: 20px;
  font-size: 1.5rem;
  font-weight: 600; /* Modernized font weight */
}

.auth-form {
  width: 100%;
}

.form-group {
  margin-bottom: 15px;
}

.form-group:last-of-type,
.form-group-last {
  margin-bottom: 20px;
}

.form-label {
  display: block;
  margin-bottom: 5px;
  font-weight: 500;
  color: var(--md-sys-color-on-surface);
}

.form-label-optional {
  color: var(--md-sys-color-on-surface-variant);
  font-weight: 400;
}

.form-input:focus {
  outline: none;
  border-color: var(--md-sys-color-primary);
  box-shadow: 0 0 0 2px var(--md-sys-color-primary-container);
}

.form-help {
  display: block;
  margin-top: 4px;
  font-size: 12px;
  color: var(--md-sys-color-on-surface-variant);
  line-height: 1.3;
}

.auth-submit-btn {
  width: 100%;
  padding: 10px;
  font-size: 16px;
  font-weight: 500;
  border-radius: 4px;
  background-color: var(--md-sys-color-primary);
  color: var(--md-sys-color-on-primary);
  border: none;
  cursor: pointer;
  transition: background-color 0.2s ease, transform 0.1s ease;
}

.auth-submit-btn:hover {
  transform: translateY(-1px);
}

.auth-submit-btn:active {
  transform: translateY(0);
}

.auth-link-text {
  text-align: center;
  margin-top: 20px;
  color: var(--md-sys-color-on-surface);
  font-size: 14px;
}

.auth-link {
  color: var(--md-sys-color-primary);
  text-decoration: underline;
  transition: color 0.2s ease;
}

.auth-link:hover {
  color: var(--md-sys-color-primary-variant);
  text-decoration: none;
}

/* Flash-Nachrichten */
.flash-message {
  padding: 10px;
  border-radius: 4px;
  margin-bottom: 15px;
  text-align: center;
  font-size: 14px;
  line-height: 1.4;
}

/* Erweiterte Button-Stile */
.button {
  display: inline-block;
  padding: 8px 16px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
  font-size: 14px;
  font-weight: 500; /* Already present */
  transition: background-color 0.2s ease-in-out, transform 0.1s ease, box-shadow 0.2s ease-in-out; /* Updated transition */
  box-sizing: border-box; /* Already present */
  border-radius: 6px; /* Updated border-radius */
  padding: 10px 20px; /* Standardized padding */
}

.button:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.button:active {
  transform: translateY(0);
}

.button-primary {
  background-color: var(--md-sys-color-primary); /* Already present */
  color: var(--md-sys-color-on-primary); /* Already present */
  /* inherits font-weight, transition, border-radius, padding from .button */
}

.button-primary:hover {
  background-color: var(--md-sys-color-primary-variant); /* Already present */
  /* inherits transform and box-shadow from .button:hover */
}

.button-primary:disabled {
  background-color: var(--md-sys-color-outline);
  color: var(--md-sys-color-on-surface-variant);
  cursor: not-allowed;
}

/* Basisstile für Flash-Nachrichten */
.flash-message {
  padding: 10px;
  border-radius: 4px;
  margin-bottom: 15px;
  text-align: center;
  font-size: 14px;
  line-height: 1.4;
}

.flash-success {
  color: var(--md-sys-color-on-primary-container);
  background-color: var(--md-sys-color-primary-container);
}

.flash-error {
  color: var(--md-sys-color-on-error-container);
  background-color: var(--md-sys-color-error-container);
}

.flash-info {
  color: var(--md-sys-color-on-secondary-container);
  background-color: var(--md-sys-color-secondary-container);
}

.flash-warning {
  color: #9f6000;
  background-color: #feefb3;
}
