/* ============================================================
   account.politiq.ch — Dark Theme Stylesheet
   Schweizer Hochdeutsch, keine externen Dependencies
   ============================================================ */

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

:root {
  --bg-body: #0c111d;
  --bg-card: rgba(255, 255, 255, 0.03);
  --bg-card-hover: rgba(255, 255, 255, 0.05);
  --bg-input: rgba(255, 255, 255, 0.05);
  --bg-input-focus: rgba(255, 255, 255, 0.08);
  --border: rgba(255, 255, 255, 0.07);
  --border-focus: rgba(59, 130, 246, 0.5);
  --text-primary: #eef0f4;
  --text-secondary: #6a7a98;
  --text-muted: #4a5568;
  --primary: #3b82f6;
  --primary-hover: #2563eb;
  --accent: #E30613;
  --accent-hover: #c7050f;
  --success: #22c55e;
  --success-bg: rgba(34, 197, 94, 0.1);
  --error: #ef4444;
  --error-bg: rgba(239, 68, 68, 0.1);
  --warning: #f59e0b;
  --radius: 12px;
  --radius-sm: 8px;
  --radius-xs: 6px;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.3), 0 1px 2px rgba(0, 0, 0, 0.2);
  --shadow-lg: 0 4px 16px rgba(0, 0, 0, 0.4);
  --transition: 150ms ease;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: "SF Mono", "Fira Code", "Fira Mono", "Roboto Mono", monospace;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font);
  background: var(--bg-body);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: color var(--transition);
}

a:hover {
  color: var(--primary-hover);
  text-decoration: underline;
}

/* --- Layout --- */
.page-wrapper {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* --- Header / Navbar --- */
.navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  height: 56px;
  background: rgba(12, 17, 29, 0.95);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 100;
}

.navbar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  font-size: 1rem;
  color: var(--text-primary);
  text-decoration: none;
}

.navbar-brand:hover {
  color: var(--text-primary);
  text-decoration: none;
}

.navbar-brand svg {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
}

.navbar-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

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

.navbar-link {
  font-size: 0.875rem;
  color: var(--text-secondary);
  transition: color var(--transition);
}

.navbar-link:hover {
  color: var(--text-primary);
  text-decoration: none;
}

.btn-logout {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  padding: 6px 14px;
  border-radius: var(--radius-xs);
  font-size: 0.8125rem;
  cursor: pointer;
  transition: all var(--transition);
  font-family: var(--font);
}

.btn-logout:hover {
  color: var(--text-primary);
  border-color: rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.03);
}

/* --- Login Page --- */
.login-wrapper {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.login-box {
  width: 100%;
  max-width: 400px;
}

.login-header {
  text-align: center;
  margin-bottom: 32px;
}

.login-logo {
  width: 64px;
  height: 64px;
  margin: 0 auto 16px;
  display: block;
}

.login-header h1 {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 6px;
}

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

.login-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: var(--shadow-lg);
}

.login-footer {
  margin-top: 20px;
  text-align: center;
  font-size: 0.8125rem;
  color: var(--text-secondary);
}

.login-footer a {
  color: var(--text-secondary);
}

.login-footer a:hover {
  color: var(--primary);
}

.login-footer-divider {
  margin: 0 8px;
  color: var(--text-muted);
}

/* --- Form Elements --- */
.form-group {
  margin-bottom: 18px;
}

.form-group:last-child {
  margin-bottom: 0;
}

.form-label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.form-input {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  color: var(--text-primary);
  font-size: 0.9375rem;
  font-family: var(--font);
  transition: all var(--transition);
  outline: none;
}

.form-input:focus {
  background: var(--bg-input-focus);
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.form-input::placeholder {
  color: var(--text-muted);
}

.form-input[readonly] {
  opacity: 0.6;
  cursor: not-allowed;
}

.form-select {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  color: var(--text-primary);
  font-size: 0.9375rem;
  font-family: var(--font);
  transition: all var(--transition);
  outline: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L5 5L9 1' stroke='%236a7a98' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
}

.form-select:focus {
  background-color: var(--bg-input-focus);
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.form-select option {
  background: #1a2035;
  color: var(--text-primary);
}

.form-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 4px;
}

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border: none;
  border-radius: var(--radius-xs);
  font-size: 0.9375rem;
  font-weight: 500;
  font-family: var(--font);
  cursor: pointer;
  transition: all var(--transition);
  outline: none;
  text-decoration: none;
  line-height: 1.4;
}

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

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

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

.btn-accent {
  background: var(--accent);
  color: #fff;
}

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

.btn-success {
  background: var(--success);
  color: #fff;
}

.btn-success:hover:not(:disabled) {
  background: #16a34a;
}

.btn-outline {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

.btn-outline:hover:not(:disabled) {
  color: var(--text-primary);
  border-color: rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.03);
}

.btn-block {
  width: 100%;
}

.btn-sm {
  padding: 7px 14px;
  font-size: 0.8125rem;
}

.btn-lg {
  padding: 12px 24px;
  font-size: 1rem;
}

/* --- Spinner --- */
.spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

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

/* --- Profile Page --- */
.main-content {
  flex: 1;
  padding: 32px 24px;
  max-width: 960px;
  margin: 0 auto;
  width: 100%;
}

.page-title {
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 24px;
}

.cards-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

/* --- Card --- */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: background var(--transition);
}

.card:hover {
  background: var(--bg-card-hover);
}

.card-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  font-size: 0.9375rem;
}

.card-header svg {
  width: 18px;
  height: 18px;
  color: var(--primary);
  flex-shrink: 0;
}

.card-body {
  padding: 20px;
}

.card-body .form-group:last-child {
  margin-bottom: 0;
}

/* --- Card: Personal (spans full width on large layout) --- */
.card-personal {
  grid-column: 1 / -1;
}

@media (min-width: 768px) {
  .card-personal {
    grid-column: 1 / 2;
    grid-row: 1 / 3;
  }
}

/* --- Avatar --- */
.avatar-section {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
}

.avatar-preview {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
}

.avatar-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.avatar-preview svg {
  width: 32px;
  height: 32px;
  color: var(--text-muted);
}

.avatar-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.avatar-upload-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  font-size: 0.8125rem;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition);
}

.avatar-upload-label:hover {
  background: var(--bg-input-focus);
  color: var(--text-primary);
}

.avatar-upload-label input[type="file"] {
  display: none;
}

.avatar-hint {
  font-size: 0.6875rem;
  color: var(--text-muted);
}

/* --- Platforms --- */
.platform-list {
  list-style: none;
}

.platform-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.875rem;
}

.platform-item:last-child {
  border-bottom: none;
}

.platform-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
  flex-shrink: 0;
}

.platform-name {
  flex: 1;
}

.platform-link {
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.platform-link:hover {
  color: var(--primary);
}

/* --- Account Info --- */
.info-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.875rem;
}

.info-row:last-child {
  border-bottom: none;
}

.info-label {
  color: var(--text-secondary);
  font-size: 0.8125rem;
}

.info-value {
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  word-break: break-all;
}

/* --- Security Card --- */
.security-info {
  color: var(--text-secondary);
  font-size: 0.875rem;
  margin-bottom: 16px;
  line-height: 1.5;
}

/* --- Save Bar --- */
.save-bar {
  margin-top: 24px;
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

/* --- Toast Notifications --- */
.toast-container {
  position: fixed;
  top: 72px;
  right: 24px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  pointer-events: auto;
  animation: toastIn 0.3s ease, toastOut 0.3s ease 3.7s;
  animation-fill-mode: forwards;
  max-width: 360px;
}

.toast-success {
  background: var(--success-bg);
  border: 1px solid rgba(34, 197, 94, 0.3);
  color: var(--success);
}

.toast-error {
  background: var(--error-bg);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: var(--error);
}

.toast svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateX(20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes toastOut {
  from {
    opacity: 1;
    transform: translateX(0);
  }
  to {
    opacity: 0;
    transform: translateX(20px);
  }
}

/* --- Password Strength --- */
.password-strength {
  margin-top: 8px;
}

.strength-bar {
  height: 4px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.06);
  overflow: hidden;
  margin-bottom: 4px;
}

.strength-fill {
  height: 100%;
  border-radius: 2px;
  width: 0;
  transition: width 0.3s ease, background 0.3s ease;
}

.strength-fill[data-level="0"] { width: 0; }
.strength-fill[data-level="1"] { width: 25%; background: var(--error); }
.strength-fill[data-level="2"] { width: 50%; background: var(--warning); }
.strength-fill[data-level="3"] { width: 75%; background: var(--primary); }
.strength-fill[data-level="4"] { width: 100%; background: var(--success); }

.strength-text {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* --- Alert / Error --- */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-xs);
  font-size: 0.875rem;
  margin-bottom: 18px;
  display: none;
}

.alert-error {
  background: var(--error-bg);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: var(--error);
}

.alert-success {
  background: var(--success-bg);
  border: 1px solid rgba(34, 197, 94, 0.3);
  color: var(--success);
}

.alert.visible {
  display: block;
}

/* --- Loading overlay --- */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg-body);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  transition: opacity 0.3s ease;
}

.loading-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

.loading-spinner {
  width: 36px;
  height: 36px;
  border: 3px solid rgba(255, 255, 255, 0.1);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* --- Footer --- */
.page-footer {
  text-align: center;
  padding: 16px 24px;
  font-size: 0.75rem;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
}

.page-footer a {
  color: var(--text-muted);
}

.page-footer a:hover {
  color: var(--text-secondary);
}

/* --- Responsive --- */
@media (max-width: 767px) {
  .cards-grid {
    grid-template-columns: 1fr;
  }

  .card-personal {
    grid-column: 1;
  }

  .navbar {
    padding: 0 16px;
  }

  .main-content {
    padding: 20px 16px;
  }

  .login-box {
    max-width: 100%;
  }

  .login-card {
    padding: 22px;
  }

  .avatar-section {
    flex-direction: column;
    text-align: center;
  }

  .save-bar {
    flex-direction: column;
  }

  .save-bar .btn {
    width: 100%;
  }

  .info-row {
    flex-direction: column;
    gap: 2px;
  }

  .toast-container {
    right: 12px;
    left: 12px;
  }

  .toast {
    max-width: 100%;
  }
}

@media (min-width: 768px) and (max-width: 959px) {
  .main-content {
    max-width: 720px;
  }
}

/* --- Register Page --- */
.register-content {
  text-align: center;
  max-width: 480px;
  margin: 0 auto;
  padding: 40px 24px;
}

.register-content h2 {
  font-size: 1.25rem;
  margin-bottom: 12px;
}

.register-content p {
  color: var(--text-secondary);
  font-size: 0.9375rem;
  margin-bottom: 24px;
  line-height: 1.6;
}

.register-content .btn {
  margin-bottom: 16px;
}

/* --- Utility --- */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.text-center { text-align: center; }
.text-muted { color: var(--text-secondary); }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.mb-2 { margin-bottom: 8px; }
.mb-4 { margin-bottom: 16px; }
