/* ═══════════════════════════════════════════════
   Wasserschaden UI – Style (v2 / Admin+Gast)
   ═══════════════════════════════════════════════ */

:root {
  --bg-body: #f0f4f8;
  --bg-card: #ffffff;
  --bg-topbar: #1a2332;
  --text-primary: #1a2332;
  --text-secondary: #5a6478;
  --text-light: #8a94a8;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --accent-light: #dbeafe;
  --green: #16a34a;
  --green-light: #dcfce7;
  --red: #dc2626;
  --red-light: #fee2e2;
  --orange: #ea580c;
  --border: #e2e8f0;
  --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-lg: 0 10px 25px rgba(0,0,0,0.1);
  --radius: 12px;
  --radius-sm: 8px;
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

/* ─── Reset ─── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font);
  background: var(--bg-body);
  color: var(--text-primary);
  line-height: 1.5;
  min-height: 100vh;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ─── Login Page ─── */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: linear-gradient(135deg, #1a2332 0%, #2d3b4e 50%, #1e3a5f 100%);
}

.login-container {
  width: 100%;
  max-width: 460px;
  padding: 20px;
}

.login-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.login-header {
  background: linear-gradient(135deg, #1a2332, #2d3b4e);
  color: white;
  padding: 32px 32px 24px;
  text-align: center;
}

.login-icon {
  font-size: 48px;
  margin-bottom: 8px;
}

.login-header h1 {
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 4px;
}

.login-subtitle {
  font-size: 14px;
  opacity: 0.8;
}

/* ─── Role Selector (Login ohne Code) ─── */
.role-selector {
  padding: 28px 32px 24px;
}

.role-title {
  text-align: center;
  font-size: 15px;
  color: var(--text-secondary);
  margin-bottom: 20px;
  font-weight: 500;
}

.role-form {
  margin-bottom: 12px;
}

.role-form:last-child {
  margin-bottom: 0;
}

.role-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px 20px;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-body);
  cursor: pointer;
  transition: all 0.2s;
  text-align: left;
  font-family: inherit;
}

.role-btn:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}

.admin-btn:hover {
  border-color: var(--accent);
  background: var(--accent-light);
}

.guest-btn:hover {
  border-color: #6b7280;
  background: #f3f4f6;
}

.role-icon {
  font-size: 32px;
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-card);
  border-radius: 12px;
}

.admin-btn .role-icon {
  background: var(--accent-light);
}

.guest-btn .role-icon {
  background: #f3f4f6;
}

.role-name {
  display: block;
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.role-desc {
  display: block;
  font-size: 13px;
  color: var(--text-light);
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 600;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
}

.btn:hover {
  text-decoration: none;
}

.btn-primary {
  background: var(--accent);
  color: white;
  padding: 14px 24px;
  font-size: 16px;
}

.btn-primary:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.btn-small {
  padding: 6px 12px;
  font-size: 12px;
  border-radius: 6px;
  background: var(--bg-body);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

.btn-small:hover {
  background: var(--border);
  color: var(--text-primary);
}

.btn-download {
  background: var(--green-light);
  color: var(--green);
  border-color: var(--green);
}

.btn-download:hover {
  background: var(--green);
  color: white;
}

.btn-delete {
  background: var(--red-light);
  color: var(--red);
  border-color: var(--red);
}

.btn-delete:hover {
  background: var(--red);
  color: white;
}

.btn-upload-start {
  background: var(--green);
  color: white;
  border: none;
  padding: 8px 16px;
}

.btn-upload-start:hover {
  background: #15803d;
}

.btn-upload-start:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-full {
  width: 100%;
  justify-content: center;
}

.login-footer {
  text-align: center;
  padding: 0 32px 24px;
  font-size: 12px;
  color: var(--text-light);
}

.footer-link {
  color: var(--accent);
}

/* ─── Top Bar ─── */
.topbar {
  background: var(--bg-topbar);
  color: white;
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 18px;
  font-weight: 700;
}

.brand-icon {
  font-size: 24px;
}

.topbar-info {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.role-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}

.role-admin {
  background: #1e40af;
  color: white;
}

.role-guest {
  background: #6b7280;
  color: white;
}

.file-stats {
  font-size: 13px;
  opacity: 0.8;
}

.topbar-info .btn {
  background: rgba(255,255,255,0.1);
  color: white;
  border: 1px solid rgba(255,255,255,0.2);
}

.topbar-info .btn:hover {
  background: rgba(255,255,255,0.2);
}

/* ─── Dashboard ─── */
.dashboard {
  max-width: 1200px;
  margin: 0 auto;
  padding: 32px 24px;
}

/* Welcome Cards */
.welcome-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 28px 32px;
  margin-bottom: 32px;
  box-shadow: var(--shadow);
}

.welcome-card h2 {
  font-size: 22px;
  margin-bottom: 8px;
}

.welcome-card p {
  color: var(--text-secondary);
  font-size: 15px;
  line-height: 1.6;
}

.welcome-admin {
  border-left: 4px solid var(--accent);
}

.welcome-guest {
  border-left: 4px solid var(--text-light);
}

.welcome-tips {
  margin-top: 12px;
  padding: 10px 14px;
  background: var(--accent-light);
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--accent);
}

/* Folder Grid */
.folder-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}

.folder-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
  transition: all 0.2s;
  display: flex;
  gap: 16px;
  text-decoration: none;
  color: inherit;
  border: 1px solid transparent;
}

.folder-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
  border-color: var(--accent);
  text-decoration: none;
}

.folder-icon {
  font-size: 36px;
  flex-shrink: 0;
  line-height: 1;
}

.folder-body h3 {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 4px;
}

.folder-desc {
  font-size: 13px;
  color: var(--text-light);
  margin-bottom: 8px;
}

.folder-meta {
  display: flex;
  gap: 12px;
  font-size: 12px;
  color: var(--text-light);
}

.folder-badges {
  display: flex;
  gap: 6px;
  margin-top: 8px;
  flex-wrap: wrap;
}

.badge {
  display: inline-flex;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
}

.badge-image {
  background: #fef3c7;
  color: #92400e;
}

.badge-pdf {
  background: #fee2e2;
  color: #991b1b;
}

/* ─── Folder View ─── */
.folder-view {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px;
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--text-light);
  margin-bottom: 20px;
}

.breadcrumb a {
  color: var(--accent);
}

.sep {
  color: var(--text-light);
}

/* Upload Panel (Admin) */
.upload-panel {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 24px;
  box-shadow: var(--shadow);
  border: 1px dashed var(--accent);
}

.upload-header {
  margin-bottom: 16px;
}

.upload-header h3 {
  font-size: 18px;
  font-weight: 600;
}

.upload-info {
  font-size: 12px;
  color: var(--text-light);
}

/* Drop Zone */
.drop-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 40px 20px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  background: var(--bg-body);
}

.drop-zone:hover,
.drop-zone.drag-over {
  border-color: var(--accent);
  background: var(--accent-light);
}

.drop-icon {
  font-size: 40px;
  margin-bottom: 8px;
}

.drop-text {
  font-size: 16px;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.drop-text strong {
  color: var(--accent);
}

.drop-hint {
  font-size: 13px;
  color: var(--text-light);
}

/* Upload List */
.upload-list {
  margin-top: 16px;
}

.upload-list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
  margin-bottom: 8px;
  font-weight: 600;
  color: var(--text-secondary);
}

.upload-items {
  max-height: 300px;
  overflow-y: auto;
}

.upload-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: var(--bg-body);
  border-radius: var(--radius-sm);
  margin-bottom: 4px;
  font-size: 13px;
}

.upload-item-icon {
  font-size: 18px;
}

.upload-item-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.upload-item-size {
  color: var(--text-light);
  font-size: 12px;
  white-space: nowrap;
}

.upload-item-remove {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 18px;
  color: var(--red);
  padding: 0 4px;
  line-height: 1;
}

/* Progress Bar */
.upload-progress {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 16px;
}

.progress-bar {
  flex: 1;
  height: 8px;
  background: var(--border);
  border-radius: 4px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--green));
  border-radius: 4px;
  transition: width 0.3s ease;
}

.progress-text {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  white-space: nowrap;
}

/* ─── File Grid ─── */
.file-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}

.file-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: all 0.2s;
  border: 1px solid var(--border);
}

.file-card:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-lg);
}

.file-preview {
  display: block;
  width: 100%;
  height: 160px;
  overflow: hidden;
  background: var(--bg-body);
  position: relative;
}

.file-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s;
}

.file-card:hover .file-preview img {
  transform: scale(1.05);
}

/* PDF Preview */
.pdf-preview {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  background: #fef2f2;
}

.pdf-icon {
  font-size: 48px;
}

.pdf-label {
  font-size: 12px;
  color: var(--red);
  font-weight: 600;
  margin-top: 4px;
}

/* File Fallback */
.file-fallback {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  background: var(--bg-body);
}

.fallback-icon {
  font-size: 36px;
  margin-bottom: 4px;
}

.fallback-ext {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-light);
  text-transform: uppercase;
}

/* File Meta */
.file-meta {
  padding: 12px 14px 14px;
}

.file-name {
  font-size: 13px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-bottom: 4px;
}

.file-details {
  font-size: 11px;
  color: var(--text-light);
  display: flex;
  gap: 4px;
  margin-bottom: 8px;
}

.file-actions {
  display: flex;
  gap: 6px;
}

.file-actions .btn-small {
  font-size: 11px;
  padding: 4px 8px;
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-light);
}

.empty-icon {
  font-size: 64px;
  margin-bottom: 12px;
}

.empty-state h3 {
  font-size: 20px;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.empty-state p {
  font-size: 14px;
}

/* ─── Lightbox ─── */
.lightbox {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.9);
  z-index: 1000;
  justify-content: center;
  align-items: center;
  cursor: pointer;
}

.lightbox.open {
  display: flex;
}

.lightbox-content {
  max-width: 90%;
  max-height: 90%;
  border-radius: 4px;
  box-shadow: 0 0 30px rgba(0, 0, 0, 0.5);
}

.lightbox-close {
  position: absolute;
  top: 20px;
  right: 30px;
  color: white;
  font-size: 40px;
  background: none;
  border: none;
  cursor: pointer;
  opacity: 0.7;
  transition: opacity 0.2s;
}

.lightbox-close:hover {
  opacity: 1;
}

/* ─── Create Folder Button ─── */
.btn-create-folder {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 16px;
  padding: 12px 20px;
  background: linear-gradient(135deg, #1a2332, #2d3b4e);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-create-folder:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

/* ─── Modal ─── */
.modal {
  display: none;
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(0,0,0,0.5);
  z-index: 2000;
  justify-content: center;
  align-items: center;
}
.modal.open { display: flex; }
.modal-content {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 28px 32px;
  max-width: 420px;
  width: 90%;
  box-shadow: var(--shadow-lg);
  position: relative;
}
.modal-close {
  position: absolute;
  top: 12px; right: 16px;
  background: none;
  border: none;
  font-size: 28px;
  cursor: pointer;
  color: var(--text-light);
  line-height: 1;
}
.modal-close:hover { color: var(--text-primary); }
.btn-cancel {
  padding: 10px 20px;
  background: var(--bg-body);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  cursor: pointer;
  color: var(--text-secondary);
}
.btn-cancel:hover { background: var(--border); }

/* ─── Mobile Upload Buttons ─── */
.mobile-upload-row {
  display: flex;
  gap: 10px;
  margin-top: 16px;
  flex-wrap: wrap;
}
.btn-mobile-upload {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 20px;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-body);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
  min-width: 120px;
}
.btn-mobile-upload:hover {
  border-color: var(--accent);
  background: var(--accent-light);
  transform: translateY(-1px);
}
.btn-mobile-upload.camera {
  border-color: #16a34a;
  color: #16a34a;
}
.btn-mobile-upload.camera:hover {
  background: #dcfce7;
}
.btn-mobile-upload.document {
  border-color: #2563eb;
  color: #2563eb;
}
.btn-mobile-upload.document:hover {
  background: #dbeafe;
}

/* ─── Footer ─── */
.footer {
  text-align: center;
  padding: 24px;
  font-size: 12px;
  color: var(--text-light);
}

/* ─── Responsive ─── */
@media (max-width: 768px) {
  .dashboard {
    padding: 16px;
  }

  .folder-view {
    padding: 16px;
  }

  .folder-grid {
    grid-template-columns: 1fr;
  }

  .file-grid {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  }

  .topbar {
    padding: 10px 16px;
  }

  .topbar-brand {
    font-size: 15px;
  }

  .login-container {
    padding: 12px;
  }

  .login-form {
    padding: 20px 20px 24px;
  }
}

/* ─── Scrollbar ─── */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-body);
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-light);
}
