/* ============================================================
   SECURE FILE PORTAL - VANILLA JS
   Complete CSS for production web server deployment
   ============================================================ */

/* Base Styles */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #0a0a0f;
  color: #f0f0ff;
  line-height: 1.5;
  min-height: 100vh;
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(99, 102, 241, 0.3);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(99, 102, 241, 0.5);
}

/* Selection */
::selection {
  background: rgba(99, 102, 241, 0.3);
  color: #f0f0ff;
}

/* Loading Screen */
.loading-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #0a0a0f;
}

.loading-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid rgba(99, 102, 241, 0.2);
  border-top-color: #6366f1;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* ========================
   LOGIN PAGE STYLES
   ======================== */

.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  background: #0a0a0f;
}

/* Animierter Hintergrund */
.login-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
}

.login-bg-shape {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.15;
  animation: float 20s ease-in-out infinite;
}

.shape-1 {
  width: 600px;
  height: 600px;
  background: #6366f1;
  top: -200px;
  right: -100px;
  animation-delay: 0s;
}

.shape-2 {
  width: 500px;
  height: 500px;
  background: #8b5cf6;
  bottom: -150px;
  left: -100px;
  animation-delay: -7s;
}

.shape-3 {
  width: 400px;
  height: 400px;
  background: #06b6d4;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  animation-delay: -14s;
}

@keyframes float {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(30px, -30px) scale(1.05); }
  66% { transform: translate(-20px, 20px) scale(0.95); }
}

/* Login-Karte */
.login-card {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 420px;
  margin: 1rem;
  padding: 2.5rem;
  background: rgba(15, 15, 25, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(99, 102, 241, 0.2);
  border-radius: 20px;
  box-shadow:
    0 0 0 1px rgba(99, 102, 241, 0.1),
    0 20px 50px rgba(0, 0, 0, 0.5),
    0 0 100px rgba(99, 102, 241, 0.05);
}

.login-card.shake {
  animation: shake 0.6s ease-in-out;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  10%, 50%, 90% { transform: translateX(-6px); }
  30%, 70% { transform: translateX(6px); }
}

/* Header */
.login-header {
  text-align: center;
  margin-bottom: 2rem;
}

.login-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 1rem;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 24px rgba(99, 102, 241, 0.3);
}

.login-icon svg {
  width: 28px;
  height: 28px;
  color: white;
}

.login-header h1 {
  font-size: 1.5rem;
  font-weight: 700;
  color: #f0f0ff;
  margin: 0 0 0.25rem;
  letter-spacing: -0.02em;
}

.login-subtitle {
  font-size: 0.875rem;
  color: #6b7280;
  margin: 0;
}

/* Formular */
.login-form {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.input-group label {
  display: block;
  font-size: 0.8rem;
  font-weight: 500;
  color: #9ca3af;
  margin-bottom: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.input-icon {
  position: absolute;
  left: 14px;
  width: 18px;
  height: 18px;
  color: #4b5563;
  pointer-events: none;
  transition: color 0.2s;
}

.input-wrapper input {
  width: 100%;
  padding: 0.875rem 1rem 0.875rem 2.75rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  color: #f0f0ff;
  font-size: 0.95rem;
  font-family: 'Inter', sans-serif;
  transition: all 0.2s;
  outline: none;
}

.input-wrapper input::placeholder {
  color: #4b5563;
}

.input-wrapper input:focus {
  border-color: #6366f1;
  background: rgba(99, 102, 241, 0.05);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.input-wrapper input:focus ~ .input-icon,
.input-wrapper input:focus + .input-icon {
  color: #6366f1;
}

.input-wrapper input:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Passwort-Toggle */
.toggle-password {
  position: absolute;
  right: 12px;
  background: none;
  border: none;
  padding: 4px;
  cursor: pointer;
  color: #4b5563;
  transition: color 0.2s;
  display: flex;
  align-items: center;
}

.toggle-password:hover {
  color: #9ca3af;
}

.toggle-password svg {
  width: 18px;
  height: 18px;
}

/* Fehlermeldung */
.error-message {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.875rem 1rem;
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.2);
  border-radius: 12px;
  color: #fca5a5;
  font-size: 0.85rem;
  animation: slideIn 0.3s ease-out;
}

.error-message svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  color: #ef4444;
}

.lock-countdown {
  margin-left: auto;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: #ef4444;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Login-Button */
.login-button {
  width: 100%;
  padding: 0.9rem;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: white;
  border: none;
  border-radius: 12px;
  font-size: 0.95rem;
  font-weight: 600;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  transition: all 0.2s;
  margin-top: 0.5rem;
  position: relative;
  overflow: hidden;
}

.login-button::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, #818cf8, #a78bfa);
  opacity: 0;
  transition: opacity 0.2s;
}

.login-button:hover:not(:disabled)::before {
  opacity: 1;
}

.login-button:hover:not(:disabled) {
  box-shadow: 0 8px 24px rgba(99, 102, 241, 0.35);
  transform: translateY(-1px);
}

.login-button:active:not(:disabled) {
  transform: translateY(0);
}

.login-button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.button-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  position: relative;
  z-index: 1;
}

.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Footer */
.login-footer {
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.security-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  color: #4b5563;
  font-size: 0.75rem;
}

.security-badge svg {
  width: 14px;
  height: 14px;
  color: #22c55e;
}

/* ========================
   DASHBOARD PAGE STYLES
   ======================== */

.dashboard {
  min-height: 100vh;
  background: #0a0a0f;
  color: #f0f0ff;
  padding: 0;
}

/* Header */
.dash-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 2rem;
  background: rgba(15, 15, 25, 0.9);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  position: sticky;
  top: 0;
  z-index: 10;
}

.dash-header-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.dash-logo {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.dash-logo svg {
  width: 20px;
  height: 20px;
  color: white;
}

.dash-title {
  font-size: 1.15rem;
  font-weight: 700;
  margin: 0;
  letter-spacing: -0.01em;
}

.dash-subtitle {
  font-size: 0.75rem;
  color: #6b7280;
  margin: 0;
}

.dash-header-right {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.user-badge {
  padding: 0.2rem 0.6rem;
  border-radius: 6px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.user-badge.admin {
  background: rgba(234, 179, 8, 0.15);
  color: #fbbf24;
  border: 1px solid rgba(234, 179, 8, 0.3);
}

.user-badge.viewer {
  background: rgba(59, 130, 246, 0.15);
  color: #60a5fa;
  border: 1px solid rgba(59, 130, 246, 0.3);
}

.user-name {
  font-size: 0.85rem;
  color: #9ca3af;
}

.logout-btn {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 1rem;
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.2);
  border-radius: 8px;
  color: #fca5a5;
  font-size: 0.8rem;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  transition: all 0.2s;
}

.logout-btn:hover {
  background: rgba(239, 68, 68, 0.2);
  border-color: rgba(239, 68, 68, 0.4);
}

.logout-btn svg {
  width: 16px;
  height: 16px;
}

/* Messages */
.dash-message {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 1rem 2rem 0;
  padding: 0.75rem 1rem;
  border-radius: 10px;
  font-size: 0.85rem;
  animation: slideIn 0.3s ease-out;
}

.dash-message svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.dash-message.success {
  background: rgba(34, 197, 94, 0.1);
  border: 1px solid rgba(34, 197, 94, 0.2);
  color: #86efac;
}

.dash-message.success svg {
  color: #22c55e;
}

.dash-message.error {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.2);
  color: #fca5a5;
}

.dash-message.error svg {
  color: #ef4444;
}

.dash-message.info {
  background: rgba(59, 130, 246, 0.1);
  border: 1px solid rgba(59, 130, 246, 0.2);
  color: #93c5fd;
}

.dash-message.info svg {
  color: #3b82f6;
}

/* Toolbar */
.dash-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 2rem;
}

.file-count {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  color: #9ca3af;
}

.file-count svg {
  width: 18px;
  height: 18px;
  color: #6b7280;
}

.file-input-hidden {
  display: none;
}

.upload-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1.2rem;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  border: none;
  border-radius: 10px;
  color: white;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.upload-btn:hover {
  box-shadow: 0 4px 16px rgba(99, 102, 241, 0.35);
  transform: translateY(-1px);
}

.upload-btn.uploading {
  opacity: 0.7;
  cursor: wait;
}

.upload-btn svg {
  width: 16px;
  height: 16px;
}

.spinner-small {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  display: inline-block;
}

/* Datei-Grid */
.file-grid {
  padding: 0 2rem 2rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.empty-state {
  text-align: center;
  padding: 4rem 2rem;
  color: #4b5563;
}

.empty-state svg {
  width: 64px;
  height: 64px;
  margin-bottom: 1rem;
  opacity: 0.3;
}

.empty-state p {
  font-size: 1rem;
  margin: 0;
}

/* Datei-Karte */
.file-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.25rem;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 12px;
  transition: all 0.2s;
}

.file-card:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(99, 102, 241, 0.2);
}

.file-icon-wrapper {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 10px;
  flex-shrink: 0;
}

.file-emoji {
  font-size: 1.4rem;
}

.file-info {
  flex: 1;
  min-width: 0;
}

.file-name {
  font-size: 0.9rem;
  font-weight: 500;
  margin: 0 0 0.2rem;
  color: #e5e7eb;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.file-meta {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.75rem;
  color: #6b7280;
}

.meta-dot {
  color: #374151;
}

.file-tag {
  padding: 0.1rem 0.4rem;
  background: rgba(99, 102, 241, 0.1);
  border-radius: 4px;
  color: #818cf8;
  font-size: 0.65rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

/* Datei-Aktionen */
.file-actions {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-shrink: 0;
}

.action-btn {
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  color: #9ca3af;
  cursor: pointer;
  transition: all 0.15s;
  font-size: 0.85rem;
  padding: 0;
}

.action-btn svg {
  width: 16px;
  height: 16px;
}

.action-btn.download:hover {
  background: rgba(34, 197, 94, 0.1);
  border-color: rgba(34, 197, 94, 0.3);
  color: #22c55e;
}

.action-btn.rename:hover {
  background: rgba(59, 130, 246, 0.1);
  border-color: rgba(59, 130, 246, 0.3);
  color: #3b82f6;
}

.action-btn.delete:hover {
  background: rgba(239, 68, 68, 0.1);
  border-color: rgba(239, 68, 68, 0.3);
  color: #ef4444;
}

.confirm-delete {
  display: flex;
  gap: 0.25rem;
}

.action-btn.confirm-yes {
  color: #22c55e;
  border-color: rgba(34, 197, 94, 0.3);
  background: rgba(34, 197, 94, 0.1);
}

.action-btn.confirm-no {
  color: #6b7280;
}

/* Umbenennen */
.rename-form {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.rename-input {
  padding: 0.3rem 0.6rem;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(99, 102, 241, 0.4);
  border-radius: 6px;
  color: #f0f0ff;
  font-size: 0.85rem;
  font-family: 'Inter', sans-serif;
  outline: none;
  width: 200px;
}

.rename-input:focus {
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}

.rename-save,
.rename-cancel {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.85rem;
  padding: 0;
}

.rename-save {
  background: rgba(34, 197, 94, 0.15);
  color: #22c55e;
}

.rename-cancel {
  background: rgba(107, 114, 128, 0.15);
  color: #6b7280;
}

/* Rollen-Info */
.role-info {
  padding: 1rem 2rem 2rem;
  text-align: center;
}

.role-info p {
  font-size: 0.8rem;
  color: #4b5563;
  margin: 0;
}

.role-info strong {
  color: #6b7280;
}

/* Responsive */
@media (max-width: 768px) {
  .dash-header {
    flex-direction: column;
    gap: 0.75rem;
    padding: 1rem;
  }

  .dash-header-right {
    width: 100%;
    justify-content: space-between;
  }

  .dash-toolbar {
    padding: 1rem;
  }

  .file-grid {
    padding: 0 1rem 1rem;
  }

  .file-card {
    padding: 0.875rem;
  }

  .rename-input {
    width: 120px;
  }

  .user-name {
    display: none;
  }
}
