/**
 * NASU Management System – Stylesheet
 * 
 * Farbschema: Jagd-Grün (#1f3d1a)
 * Mobile-first, responsive
 */

/* === Reset & Basis === */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --primary: #1f3d1a;
  --primary-light: #2d5a24;
  --primary-dark: #162d12;
  --primary-bg: #f4f7f3;
  --accent: #8b6914;
  --accent-light: #c9a84c;
  --text: #1a1a1a;
  --text-light: #555;
  --text-muted: #888;
  --bg: #ffffff;
  --bg-card: #ffffff;
  --border: #ddd;
  --border-light: #eee;
  --success: #2d7a3a;
  --error: #c0392b;
  --warning: #d4a017;
  --info: #2471a3;
  --radius: 6px;
  --shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 4px 16px rgba(0, 0, 0, 0.12);
  --transition: 0.2s ease;
}

html {
  font-size: 16px;
}

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

/* === Header === */
.header {
  background: var(--primary);
  color: white;
  padding: 0.75rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow);
}

.header-title {
  font-size: 1.1rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.header-subtitle {
  font-size: 0.75rem;
  opacity: 0.8;
  font-weight: 400;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.85rem;
}

.header-role {
  background: rgba(255, 255, 255, 0.15);
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius);
  font-size: 0.75rem;
}

/* === Navigation === */
.nav {
  background: var(--primary-dark);
  display: flex;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.nav a {
  color: rgba(255, 255, 255, 0.7);
  text-decoration: none;
  padding: 0.6rem 1rem;
  font-size: 0.85rem;
  white-space: nowrap;
  border-bottom: 2px solid transparent;
  transition: var(--transition);
}

.nav a:hover,
.nav a.active {
  color: white;
  border-bottom-color: var(--accent-light);
}

/* === Main Content === */
.main {
  max-width: 960px;
  margin: 0 auto;
  padding: 1.5rem 1rem;
}

.main-wide {
  max-width: 90vw;
}

/* === Cards === */
.card {
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.5rem;
  margin-bottom: 1rem;
}

.card-title {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 1rem;
  color: var(--primary);
}

/* === Login === */
.login-container {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 1rem;
}

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

.login-header {
  text-align: center;
  margin-bottom: 1.5rem;
}

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

.login-header p {
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* === Formulare === */
.form-group {
  margin-bottom: 1rem;
}

.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  margin-bottom: 0.3rem;
  color: var(--text);
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-family: inherit;
  transition: var(--transition);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--primary-light);
  box-shadow: 0 0 0 2px rgba(31, 61, 26, 0.15);
}

/* === Buttons === */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.6rem 1.2rem;
  border: none;
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-family: inherit;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  gap: 0.4rem;
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

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

.btn-primary:hover:not(:disabled) {
  background: var(--primary-light);
}

.btn-secondary {
  background: var(--border);
  color: var(--text);
}

.btn-secondary:hover:not(:disabled) {
  background: #ccc;
}

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

.btn-danger:hover:not(:disabled) {
  background: #a93226;
}

.btn-small {
  padding: 0.35rem 0.75rem;
  font-size: 0.8rem;
}

.btn-block {
  width: 100%;
}

/* === Icon-Buttons (Aktionen in Listen) === */
.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-card);
  color: var(--text-light);
  cursor: pointer;
  transition: var(--transition);
  vertical-align: middle;
}
.btn-icon + .btn-icon {
  margin-left: 0.3rem;
}
.btn-icon:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.btn-icon-danger {
  color: var(--error);
}
.btn-icon-primary {
  color: var(--primary);
}
.btn-icon:hover:not(:disabled) {
  background: var(--primary-bg);
  border-color: var(--text-light);
}
.btn-icon-danger:hover:not(:disabled) {
  background: #fdecea;
  border-color: var(--error);
}
.btn-icon-primary:hover:not(:disabled) {
  background: var(--primary-bg);
  border-color: var(--primary);
}

/* === Messages === */
.message {
  display: none;
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  font-size: 0.85rem;
  margin-bottom: 1rem;
}

.message.success {
  display: block;
  background: #e8f5e9;
  color: var(--success);
  border: 1px solid #c8e6c9;
}

.message.error {
  display: block;
  background: #fce4ec;
  color: var(--error);
  border: 1px solid #f8bbd0;
}

.message.info {
  display: block;
  background: #e3f2fd;
  color: var(--info);
  border: 1px solid #bbdefb;
}

/* === Tabellen === */
.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

th, td {
  text-align: left;
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid var(--border-light);
  white-space: nowrap;
}

th {
  background: var(--primary-bg);
  font-weight: 600;
  color: var(--primary);
  white-space: nowrap;
}

tr:hover {
  background: #f9faf8;
}

/* === Status-Badges === */
.badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 10px;
  font-size: 0.75rem;
  font-weight: 500;
}

.badge-admin { background: #e8eaf6; color: #283593; }
.badge-nasu_leitung { background: #e8f5e9; color: #2e7d32; }
.badge-koordination { background: #fff3e0; color: #e65100; }
.badge-callcenter { background: #e3f2fd; color: #1565c0; }
.badge-fuehrer { background: #fce4ec; color: #ad1457; }
.badge-disabled { background: #eee; color: #888; }

/* === Modal === */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 200;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal-overlay.active {
  display: flex;
}

.modal {
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 1.5rem;
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-title {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 1rem;
  color: var(--primary);
}

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

/* === Loading === */
.loading {
  text-align: center;
  padding: 2rem;
  color: var(--text-muted);
}

.spinner {
  display: inline-block;
  width: 24px;
  height: 24px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

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

/* === Utility === */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--text-muted); }
.text-small { font-size: 0.8rem; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.hidden { display: none; }
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-1 { gap: 0.5rem; }

/* === Responsive === */
@media (max-width: 640px) {
  .header {
    padding: 0.5rem 0.75rem;
  }

  .header-title {
    font-size: 1rem;
  }

  .main {
    padding: 1rem 0.75rem;
  }

  .card {
    padding: 1rem;
  }

  .modal {
    padding: 1rem;
  }

  table {
    font-size: 0.8rem;
  }

  th, td {
    padding: 0.4rem 0.5rem;
  }
}
