/* ============================================================
   VokaTrainer – style.css
   Main stylesheet – no framework, plain CSS
   ============================================================ */

/* ------------------------------------------------------------
   1. CSS Custom Properties (Light Theme)
   ------------------------------------------------------------ */
:root {
  --primary:       #2563EB;
  --primary-dark:  #1D4ED8;
  --primary-light: #DBEAFE;
  --secondary:     #64748B;
  --success:       #16A34A;
  --success-light: #DCFCE7;
  --danger:        #DC2626;
  --danger-light:  #FEE2E2;
  --warning:       #D97706;
  --warning-light: #FEF3C7;
  --info:          #0891B2;
  --info-light:    #CFFAFE;

  --bg:            #F1F5F9;
  --bg-card:       #FFFFFF;
  --bg-nav:        #1E40AF;

  --text:          #0F172A;
  --text-muted:    #64748B;
  --text-on-primary: #FFFFFF;

  --border:        #E2E8F0;
  --border-focus:  #2563EB;

  --shadow-sm:     0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.05);
  --shadow:        0 4px 12px rgba(0,0,0,.10), 0 2px 6px rgba(0,0,0,.06);
  --shadow-lg:     0 10px 30px rgba(0,0,0,.12), 0 4px 12px rgba(0,0,0,.08);

  --radius-sm:     6px;
  --radius:        12px;
  --radius-lg:     18px;
  --radius-full:   9999px;

  --transition:    0.2s ease;
  --font:          system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
                   Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

/* ------------------------------------------------------------
   2. Dark Mode
   ------------------------------------------------------------ */
@media (prefers-color-scheme: dark) {
  :root {
    --primary:       #3B82F6;
    --primary-dark:  #2563EB;
    --primary-light: #1E3A5F;
    --secondary:     #94A3B8;
    --success:       #22C55E;
    --success-light: #14532D;
    --danger:        #F87171;
    --danger-light:  #7F1D1D;
    --warning:       #FBBF24;
    --warning-light: #78350F;
    --info:          #22D3EE;
    --info-light:    #164E63;

    --bg:            #0F172A;
    --bg-card:       #1E293B;
    --bg-nav:        #0F172A;

    --text:          #F1F5F9;
    --text-muted:    #94A3B8;
    --text-on-primary: #FFFFFF;

    --border:        #334155;
    --border-focus:  #3B82F6;

    --shadow-sm:     0 1px 3px rgba(0,0,0,.3);
    --shadow:        0 4px 12px rgba(0,0,0,.4);
    --shadow-lg:     0 10px 30px rgba(0,0,0,.5);
  }
}

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.6;
  color: var(--text);
  background-color: var(--bg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

img, video, svg {
  max-width: 100%;
  display: block;
}

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

ul, ol { list-style: none; }

button, input, select, textarea {
  font-family: inherit;
  font-size: inherit;
}

h1, h2, h3, h4, h5, h6 {
  line-height: 1.25;
  font-weight: 700;
  color: var(--text);
}

h1 { font-size: 2rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.25rem; }
h4 { font-size: 1.1rem; }

hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 1.5rem 0;
}

/* ------------------------------------------------------------
   4. Layout
   ------------------------------------------------------------ */
.wrapper {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem;
  width: 100%;
}

.container {
  padding: 0 1rem;
}

.page-content {
  padding: 2rem 0;
  flex: 1;
}

.main-content {
  flex: 1;
}

/* ------------------------------------------------------------
   5. Navbar
   ------------------------------------------------------------ */
.navbar {
  background-color: var(--bg-nav);
  color: var(--text-on-primary);
  box-shadow: var(--shadow);
  position: sticky;
  top: 0;
  z-index: 1000;
}

.navbar-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
  gap: 1rem;
}

.navbar-brand {
  font-size: 1.4rem;
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
  white-space: nowrap;
}
.navbar-brand:hover { text-decoration: none; opacity: 0.9; }
.navbar-brand .brand-icon {
  font-size: 1.6rem;
}

.navbar-nav {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  flex: 1;
  justify-content: center;
}

.navbar-nav a {
  color: rgba(255,255,255,0.8);
  padding: 0.4rem 0.85rem;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 500;
  transition: background var(--transition), color var(--transition);
  white-space: nowrap;
}
.navbar-nav a:hover,
.navbar-nav a.active {
  background: rgba(255,255,255,0.15);
  color: #fff;
  text-decoration: none;
}

.navbar-user {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  white-space: nowrap;
}

.navbar-user .user-info {
  font-size: 0.85rem;
  color: rgba(255,255,255,0.7);
}

.navbar-user a {
  color: rgba(255,255,255,0.85);
  font-size: 0.875rem;
  padding: 0.35rem 0.75rem;
  border: 1px solid rgba(255,255,255,0.3);
  border-radius: var(--radius-sm);
  transition: background var(--transition);
}
.navbar-user a:hover {
  background: rgba(255,255,255,0.15);
  text-decoration: none;
}

/* Hamburger */
.navbar-toggle {
  display: none;
  flex-direction: column;
  justify-content: space-between;
  width: 28px;
  height: 20px;
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
  z-index: 1100;
}
.navbar-toggle span {
  display: block;
  width: 100%;
  height: 2px;
  background: #fff;
  border-radius: 2px;
  transition: transform 0.3s ease, opacity 0.3s ease;
}
.navbar-toggle.open span:nth-child(1) {
  transform: translateY(9px) rotate(45deg);
}
.navbar-toggle.open span:nth-child(2) {
  opacity: 0;
  transform: scaleX(0);
}
.navbar-toggle.open span:nth-child(3) {
  transform: translateY(-9px) rotate(-45deg);
}

/* Mobile Nav */
.navbar-collapse {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex: 1;
}

/* Footer */
.site-footer {
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  padding: 1.5rem 0;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-top: auto;
}

/* ------------------------------------------------------------
   6. Cards
   ------------------------------------------------------------ */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: box-shadow var(--transition), transform var(--transition);
  animation: fadeIn 0.35s ease both;
}
.card:hover {
  box-shadow: var(--shadow);
}

.card-header {
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border);
  background: var(--bg-card);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.card-header h2,
.card-header h3,
.card-header h4 {
  margin: 0;
}

.card-body {
  padding: 1.5rem;
}

.card-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border);
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
}

/* ------------------------------------------------------------
   7. Buttons
   ------------------------------------------------------------ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.55rem 1.2rem;
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1;
  border: 2px solid transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-decoration: none;
  transition: background var(--transition), color var(--transition),
              border-color var(--transition), box-shadow var(--transition),
              transform var(--transition);
  white-space: nowrap;
  user-select: none;
}
.btn:focus-visible {
  outline: 3px solid var(--primary);
  outline-offset: 2px;
}
.btn:active { transform: translateY(1px); }
.btn:disabled,
.btn.disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.btn-primary:hover {
  background: var(--primary-dark);
  border-color: var(--primary-dark);
  text-decoration: none;
}

.btn-secondary {
  background: var(--secondary);
  color: #fff;
  border-color: var(--secondary);
}
.btn-secondary:hover {
  background: #4B5563;
  border-color: #4B5563;
  text-decoration: none;
}

.btn-success {
  background: var(--success);
  color: #fff;
  border-color: var(--success);
}
.btn-success:hover {
  background: #15803D;
  border-color: #15803D;
  text-decoration: none;
}

.btn-danger {
  background: var(--danger);
  color: #fff;
  border-color: var(--danger);
}
.btn-danger:hover {
  background: #B91C1C;
  border-color: #B91C1C;
  text-decoration: none;
}

.btn-warning {
  background: var(--warning);
  color: #fff;
  border-color: var(--warning);
}
.btn-warning:hover {
  background: #B45309;
  border-color: #B45309;
  text-decoration: none;
}

.btn-outline {
  background: transparent;
  color: var(--primary);
  border-color: var(--primary);
}
.btn-outline:hover {
  background: var(--primary);
  color: #fff;
  text-decoration: none;
}

.btn-ghost {
  background: transparent;
  color: var(--text);
  border-color: var(--border);
}
.btn-ghost:hover {
  background: var(--bg);
  text-decoration: none;
}

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

.btn-lg {
  padding: 0.8rem 1.8rem;
  font-size: 1.05rem;
  border-radius: var(--radius);
}

.btn-block {
  display: flex;
  width: 100%;
}

.btn-icon {
  padding: 0.5rem;
  min-width: 38px;
  min-height: 38px;
}

/* ------------------------------------------------------------
   8. Forms
   ------------------------------------------------------------ */
.form-group {
  margin-bottom: 1.25rem;
}

.form-label {
  display: block;
  margin-bottom: 0.4rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text);
}
.form-label .required {
  color: var(--danger);
  margin-left: 0.2rem;
}

.form-control,
.form-select {
  display: block;
  width: 100%;
  padding: 0.6rem 0.9rem;
  font-size: 0.95rem;
  color: var(--text);
  background-color: var(--bg-card);
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  transition: border-color var(--transition), box-shadow var(--transition);
  appearance: none;
  -webkit-appearance: none;
}

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

.form-control:focus,
.form-select:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(37,99,235,0.15);
}

.form-control.is-invalid,
.form-select.is-invalid {
  border-color: var(--danger);
}
.form-control.is-invalid:focus,
.form-select.is-invalid:focus {
  box-shadow: 0 0 0 3px rgba(220,38,38,0.15);
}

.form-control.is-valid,
.form-select.is-valid {
  border-color: var(--success);
}

.form-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%2364748B' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.9rem center;
  padding-right: 2.5rem;
  cursor: pointer;
}

.form-text {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.3rem;
}

.invalid-feedback {
  font-size: 0.8rem;
  color: var(--danger);
  margin-top: 0.3rem;
  display: none;
}
.form-control.is-invalid ~ .invalid-feedback,
.form-select.is-invalid ~ .invalid-feedback {
  display: block;
}

.form-check {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
}
.form-check input[type="checkbox"],
.form-check input[type="radio"] {
  width: 1.1rem;
  height: 1.1rem;
  cursor: pointer;
  accent-color: var(--primary);
  flex-shrink: 0;
}
.form-check-label {
  font-size: 0.9rem;
  cursor: pointer;
}

textarea.form-control {
  min-height: 100px;
  resize: vertical;
}

/* Password toggle */
.input-group {
  position: relative;
  display: flex;
}
.input-group .form-control {
  flex: 1;
  border-radius: var(--radius-sm) 0 0 var(--radius-sm);
}
.input-group .input-group-btn {
  display: flex;
}
.input-group .input-group-btn .btn {
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  border-left: none;
}

.password-toggle {
  position: relative;
}
.password-toggle .form-control {
  padding-right: 3rem;
}
.password-toggle .toggle-pw-btn {
  position: absolute;
  right: 0.5rem;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  padding: 0.25rem;
  font-size: 1.1rem;
  line-height: 1;
}
.password-toggle .toggle-pw-btn:hover {
  color: var(--text);
}

/* Password strength */
.password-strength {
  margin-top: 0.5rem;
}
.password-strength-bar {
  height: 4px;
  border-radius: var(--radius-full);
  background: var(--border);
  overflow: hidden;
}
.password-strength-fill {
  height: 100%;
  border-radius: var(--radius-full);
  transition: width 0.3s ease, background-color 0.3s ease;
  width: 0%;
}
.strength-0 .password-strength-fill { width: 0%;   background: var(--border); }
.strength-1 .password-strength-fill { width: 25%;  background: var(--danger); }
.strength-2 .password-strength-fill { width: 50%;  background: var(--warning); }
.strength-3 .password-strength-fill { width: 75%;  background: var(--info); }
.strength-4 .password-strength-fill { width: 100%; background: var(--success); }
.password-strength-label {
  font-size: 0.75rem;
  margin-top: 0.3rem;
  color: var(--text-muted);
}

/* Search bar */
.search-bar {
  display: flex;
  align-items: stretch;
  max-width: 420px;
  width: 100%;
}
.search-bar .form-control {
  border-radius: var(--radius-sm) 0 0 var(--radius-sm);
  border-right: none;
  flex: 1;
}
.search-bar .form-control:focus {
  border-right: none;
  box-shadow: none;
}
.search-bar .search-bar-inner {
  display: flex;
  width: 100%;
  box-shadow: 0 0 0 2px transparent;
  border-radius: var(--radius-sm);
  transition: box-shadow var(--transition);
}
.search-bar .search-bar-inner:focus-within {
  box-shadow: 0 0 0 3px rgba(37,99,235,0.15);
}
.search-bar .btn {
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

/* Filter bar */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
}

/* ------------------------------------------------------------
   9. Alerts
   ------------------------------------------------------------ */
.alert {
  padding: 0.9rem 1.1rem;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-size: 0.9rem;
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  animation: fadeIn 0.3s ease;
}
.alert .alert-icon {
  font-size: 1.1rem;
  flex-shrink: 0;
  margin-top: 0.05rem;
}
.alert .alert-close {
  margin-left: auto;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.2rem;
  line-height: 1;
  color: inherit;
  opacity: 0.6;
  padding: 0;
  flex-shrink: 0;
}
.alert .alert-close:hover { opacity: 1; }

.alert-success {
  background: var(--success-light);
  border-color: var(--success);
  color: var(--success);
}
.alert-error,
.alert-danger {
  background: var(--danger-light);
  border-color: var(--danger);
  color: var(--danger);
}
.alert-warning {
  background: var(--warning-light);
  border-color: var(--warning);
  color: var(--warning);
}
.alert-info {
  background: var(--info-light);
  border-color: var(--info);
  color: var(--info);
}

/* ------------------------------------------------------------
   10. Badges
   ------------------------------------------------------------ */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.6rem;
  font-size: 0.75rem;
  font-weight: 700;
  border-radius: var(--radius-full);
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.badge-admin {
  background: #EDE9FE;
  color: #6D28D9;
}
.badge-user {
  background: var(--primary-light);
  color: var(--primary-dark);
}
.badge-leicht {
  background: var(--success-light);
  color: var(--success);
}
.badge-mittel {
  background: var(--warning-light);
  color: var(--warning);
}
.badge-schwer {
  background: var(--danger-light);
  color: var(--danger);
}
.badge-neutral {
  background: var(--border);
  color: var(--text-muted);
}

@media (prefers-color-scheme: dark) {
  .badge-admin    { background: #4C1D95; color: #C4B5FD; }
  .badge-user     { background: #1E3A5F; color: #93C5FD; }
  .badge-leicht   { background: #14532D; color: #86EFAC; }
  .badge-mittel   { background: #78350F; color: #FCD34D; }
  .badge-schwer   { background: #7F1D1D; color: #FCA5A5; }
  .badge-neutral  { background: #334155; color: #94A3B8; }
}

/* ------------------------------------------------------------
   11. Table
   ------------------------------------------------------------ */
.table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

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

.table th,
.table td {
  padding: 0.85rem 1rem;
  text-align: left;
  vertical-align: middle;
}

.table thead tr {
  background: var(--bg);
  border-bottom: 2px solid var(--border);
}

.table thead th {
  font-weight: 700;
  color: var(--text-muted);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
}
.table thead th.sortable {
  cursor: pointer;
  user-select: none;
}
.table thead th.sortable::after {
  content: " ↕";
  opacity: 0.4;
}
.table thead th.sort-asc::after  { content: " ↑"; opacity: 1; }
.table thead th.sort-desc::after { content: " ↓"; opacity: 1; }

.table tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background var(--transition);
}
.table tbody tr:last-child { border-bottom: none; }
.table tbody tr:hover { background: var(--bg); }

.table-striped tbody tr:nth-child(even) {
  background: var(--bg);
}
.table-striped tbody tr:nth-child(even):hover {
  background: var(--border);
}

.table .actions {
  display: flex;
  gap: 0.4rem;
  align-items: center;
  flex-wrap: nowrap;
}

/* ------------------------------------------------------------
   12. Pagination
   ------------------------------------------------------------ */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  padding: 1rem 0;
  flex-wrap: wrap;
}

.pagination .page-item {
  display: inline-block;
}

.pagination .page-link {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 36px;
  padding: 0 0.6rem;
  font-size: 0.875rem;
  font-weight: 500;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  background: var(--bg-card);
  transition: background var(--transition), color var(--transition),
              border-color var(--transition);
  text-decoration: none;
}
.pagination .page-link:hover {
  background: var(--primary-light);
  border-color: var(--primary);
  color: var(--primary);
  text-decoration: none;
}
.pagination .page-item.active .page-link {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}
.pagination .page-item.disabled .page-link {
  opacity: 0.4;
  pointer-events: none;
}

/* ------------------------------------------------------------
   13. Modal
   ------------------------------------------------------------ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(2px);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  opacity: 0;
  animation: overlayFadeIn 0.2s ease forwards;
}

.modal-dialog {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  transform: scale(0.95) translateY(-10px);
  animation: modalSlideIn 0.25s ease forwards;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
}
.modal-header h3,
.modal-header h4 {
  margin: 0;
  font-size: 1.1rem;
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  color: var(--text-muted);
  padding: 0.1rem 0.3rem;
  border-radius: var(--radius-sm);
  transition: color var(--transition), background var(--transition);
}
.modal-close:hover {
  color: var(--text);
  background: var(--bg);
}

.modal-body {
  padding: 1.5rem;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
}

/* Modal animations */
@keyframes overlayFadeIn {
  to { opacity: 1; }
}
@keyframes modalSlideIn {
  to {
    transform: scale(1) translateY(0);
    opacity: 1;
  }
}

/* ------------------------------------------------------------
   14. Stat Cards (Dashboard)
   ------------------------------------------------------------ */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.25rem;
  margin-bottom: 1.5rem;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  animation: fadeIn 0.4s ease both;
  transition: box-shadow var(--transition), transform var(--transition);
}
.stat-card:hover {
  box-shadow: var(--shadow);
  transform: translateY(-2px);
}

.stat-card .stat-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  margin-bottom: 0.25rem;
}
.stat-icon-blue   { background: var(--primary-light); color: var(--primary); }
.stat-icon-green  { background: var(--success-light);  color: var(--success); }
.stat-icon-red    { background: var(--danger-light);   color: var(--danger); }
.stat-icon-yellow { background: var(--warning-light);  color: var(--warning); }
.stat-icon-info   { background: var(--info-light);     color: var(--info); }

.stat-card .stat-value {
  font-size: 2rem;
  font-weight: 800;
  color: var(--text);
  line-height: 1;
}
.stat-card .stat-label {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 500;
}
.stat-card .stat-change {
  font-size: 0.8rem;
  font-weight: 600;
  margin-top: 0.25rem;
}
.stat-change-up   { color: var(--success); }
.stat-change-down { color: var(--danger); }

/* ------------------------------------------------------------
   15. Progress Bar
   ------------------------------------------------------------ */
.progress-container {
  margin-bottom: 1.5rem;
}
.progress-info {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
}
.progress-track {
  height: 10px;
  background: var(--border);
  border-radius: var(--radius-full);
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--primary-dark));
  border-radius: var(--radius-full);
  transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  min-width: 0%;
}
.progress-fill.success { background: linear-gradient(90deg, var(--success), #15803D); }
.progress-fill.warning { background: linear-gradient(90deg, var(--warning), #B45309); }
.progress-fill.danger  { background: linear-gradient(90deg, var(--danger), #B91C1C); }

/* ------------------------------------------------------------
   16. Training Card
   ------------------------------------------------------------ */
.training-wrapper {
  max-width: 680px;
  margin: 0 auto;
}

.training-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  gap: 1rem;
}
.training-counter {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
}
.training-timer {
  font-size: 1rem;
  font-weight: 700;
  color: var(--primary);
  background: var(--primary-light);
  padding: 0.3rem 0.8rem;
  border-radius: var(--radius-full);
  white-space: nowrap;
  transition: background 0.5s, color 0.5s;
}
.training-timer.urgent {
  background: var(--danger-light);
  color: var(--danger);
  animation: pulse 1s ease-in-out infinite;
}

.training-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 2.5rem 2rem;
  text-align: center;
  animation: fadeIn 0.3s ease;
}

.training-category {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.training-question {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 0.5rem;
  line-height: 1.3;
  word-break: break-word;
}

.training-hint {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
  font-style: italic;
}

.training-input-area {
  margin-top: 1.5rem;
}
.training-input-area .form-control {
  font-size: 1.1rem;
  text-align: center;
  padding: 0.8rem;
}

/* Answer options (Multiple Choice) */
.answer-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

.answer-btn {
  background: var(--bg-card);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 0.9rem 1rem;
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
  text-align: center;
  transition: background var(--transition), border-color var(--transition),
              color var(--transition), transform var(--transition);
  line-height: 1.3;
  word-break: break-word;
}
.answer-btn:hover:not(:disabled) {
  border-color: var(--primary);
  background: var(--primary-light);
  color: var(--primary);
  transform: translateY(-1px);
}
.answer-btn.selected {
  border-color: var(--primary);
  background: var(--primary-light);
  color: var(--primary);
}
.answer-btn.correct {
  border-color: var(--success);
  background: var(--success-light);
  color: var(--success);
  animation: bounce 0.4s ease;
}
.answer-btn.wrong {
  border-color: var(--danger);
  background: var(--danger-light);
  color: var(--danger);
  animation: shake 0.4s ease;
}
.answer-btn:disabled { cursor: not-allowed; opacity: 0.75; }

/* Feedback overlay inside training card */
.training-feedback {
  margin-top: 1.5rem;
  padding: 1rem 1.25rem;
  border-radius: var(--radius);
  font-size: 0.95rem;
  font-weight: 600;
  display: none;
}
.training-feedback.correct {
  background: var(--success-light);
  color: var(--success);
  display: block;
}
.training-feedback.wrong {
  background: var(--danger-light);
  color: var(--danger);
  display: block;
}
.training-feedback .correct-answer {
  font-size: 1.1rem;
  margin-top: 0.35rem;
}

/* ------------------------------------------------------------
   17. Score Circle
   ------------------------------------------------------------ */
.score-circle-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  margin: 1.5rem 0;
}

.score-circle {
  width: 140px;
  height: 140px;
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  position: relative;
  background: conic-gradient(var(--primary) calc(var(--score, 0) * 3.6deg), var(--border) 0);
  box-shadow: var(--shadow);
}
.score-circle::before {
  content: "";
  position: absolute;
  inset: 12px;
  border-radius: 50%;
  background: var(--bg-card);
}
.score-circle .score-value {
  font-size: 2.2rem;
  color: var(--primary);
  z-index: 1;
  line-height: 1;
}
.score-circle .score-unit {
  font-size: 0.8rem;
  color: var(--text-muted);
  z-index: 1;
}

.score-circle.score-high   { background: conic-gradient(var(--success) calc(var(--score, 0) * 3.6deg), var(--border) 0); }
.score-circle.score-high .score-value { color: var(--success); }
.score-circle.score-medium { background: conic-gradient(var(--warning) calc(var(--score, 0) * 3.6deg), var(--border) 0); }
.score-circle.score-medium .score-value { color: var(--warning); }
.score-circle.score-low    { background: conic-gradient(var(--danger) calc(var(--score, 0) * 3.6deg), var(--border) 0); }
.score-circle.score-low .score-value { color: var(--danger); }

.score-label {
  font-size: 0.9rem;
  color: var(--text-muted);
  font-weight: 600;
}

/* ------------------------------------------------------------
   18. Loading Spinner
   ------------------------------------------------------------ */
.loading {
  display: inline-block;
  width: 1.5rem;
  height: 1.5rem;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
.loading-lg {
  width: 3rem;
  height: 3rem;
  border-width: 4px;
}
.loading-center {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 3rem;
}

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

/* Skeleton loaders */
.skeleton {
  background: linear-gradient(90deg, var(--border) 25%, var(--bg) 50%, var(--border) 75%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.5s ease infinite;
  border-radius: var(--radius-sm);
}
@keyframes skeleton-shimmer {
  from { background-position: 200% 0; }
  to   { background-position: -200% 0; }
}

/* ------------------------------------------------------------
   19. Utilities
   ------------------------------------------------------------ */
/* Text */
.text-center  { text-align: center !important; }
.text-right   { text-align: right !important; }
.text-left    { text-align: left !important; }
.text-muted   { color: var(--text-muted) !important; }
.text-primary { color: var(--primary) !important; }
.text-success { color: var(--success) !important; }
.text-danger  { color: var(--danger) !important; }
.text-warning { color: var(--warning) !important; }
.text-sm      { font-size: 0.875rem !important; }
.text-lg      { font-size: 1.1rem !important; }
.fw-bold      { font-weight: 700 !important; }
.fw-normal    { font-weight: 400 !important; }

/* Display */
.d-none         { display: none !important; }
.d-block        { display: block !important; }
.d-flex         { display: flex !important; }
.d-inline-flex  { display: inline-flex !important; }
.d-grid         { display: grid !important; }
.d-inline-block { display: inline-block !important; }

/* Flex helpers */
.flex-1         { flex: 1 !important; }
.flex-wrap      { flex-wrap: wrap !important; }
.align-center   { align-items: center !important; }
.align-start    { align-items: flex-start !important; }
.justify-center { justify-content: center !important; }
.justify-between{ justify-content: space-between !important; }
.justify-end    { justify-content: flex-end !important; }

/* Gap */
.gap-1  { gap: 0.25rem !important; }
.gap-2  { gap: 0.5rem !important; }
.gap-3  { gap: 0.75rem !important; }
.gap-4  { gap: 1rem !important; }
.gap-5  { gap: 1.25rem !important; }
.gap-6  { gap: 1.5rem !important; }

/* Margin top */
.mt-0  { margin-top: 0 !important; }
.mt-1  { margin-top: 0.25rem !important; }
.mt-2  { margin-top: 0.5rem !important; }
.mt-3  { margin-top: 0.75rem !important; }
.mt-4  { margin-top: 1rem !important; }
.mt-5  { margin-top: 1.5rem !important; }
.mt-6  { margin-top: 2rem !important; }

/* Margin bottom */
.mb-0  { margin-bottom: 0 !important; }
.mb-1  { margin-bottom: 0.25rem !important; }
.mb-2  { margin-bottom: 0.5rem !important; }
.mb-3  { margin-bottom: 0.75rem !important; }
.mb-4  { margin-bottom: 1rem !important; }
.mb-5  { margin-bottom: 1.5rem !important; }
.mb-6  { margin-bottom: 2rem !important; }

/* Padding */
.p-0  { padding: 0 !important; }
.p-1  { padding: 0.25rem !important; }
.p-2  { padding: 0.5rem !important; }
.p-3  { padding: 0.75rem !important; }
.p-4  { padding: 1rem !important; }
.p-5  { padding: 1.5rem !important; }
.p-6  { padding: 2rem !important; }

/* Width */
.w-100  { width: 100% !important; }
.w-auto { width: auto !important; }

/* Misc */
.rounded        { border-radius: var(--radius-sm) !important; }
.rounded-lg     { border-radius: var(--radius) !important; }
.rounded-full   { border-radius: var(--radius-full) !important; }
.shadow         { box-shadow: var(--shadow) !important; }
.shadow-sm      { box-shadow: var(--shadow-sm) !important; }
.border         { border: 1px solid var(--border) !important; }
.overflow-hidden{ overflow: hidden !important; }
.cursor-pointer { cursor: pointer !important; }

/* Visibility */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
}

/* ------------------------------------------------------------
   20. Animations
   ------------------------------------------------------------ */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%       { transform: translateX(-8px); }
  40%       { transform: translateX(8px); }
  60%       { transform: translateX(-5px); }
  80%       { transform: translateX(5px); }
}

@keyframes bounce {
  0%, 100% { transform: translateY(0) scale(1); }
  30%       { transform: translateY(-8px) scale(1.03); }
  60%       { transform: translateY(-3px) scale(1.01); }
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.6; }
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-12px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Stagger for lists */
.stagger-item { animation: fadeIn 0.35s ease both; }
.stagger-item:nth-child(1) { animation-delay: 0.05s; }
.stagger-item:nth-child(2) { animation-delay: 0.10s; }
.stagger-item:nth-child(3) { animation-delay: 0.15s; }
.stagger-item:nth-child(4) { animation-delay: 0.20s; }
.stagger-item:nth-child(5) { animation-delay: 0.25s; }
.stagger-item:nth-child(6) { animation-delay: 0.30s; }

/* ------------------------------------------------------------
   21. Page-specific: Auth (Login / Register)
   ------------------------------------------------------------ */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  padding: 2rem 1rem;
}

.auth-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 2.5rem 2rem;
  width: 100%;
  max-width: 420px;
  animation: fadeIn 0.4s ease;
}

.auth-logo {
  text-align: center;
  margin-bottom: 1.5rem;
}
.auth-logo .logo-icon {
  font-size: 3rem;
  margin-bottom: 0.5rem;
}
.auth-logo h1 {
  font-size: 1.6rem;
  color: var(--text);
}
.auth-logo p {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-top: 0.25rem;
}

/* ------------------------------------------------------------
   22. Page-specific: Vocab List
   ------------------------------------------------------------ */
.vocab-list-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.vocab-word {
  font-weight: 700;
  font-size: 1rem;
}
.vocab-translation {
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* ------------------------------------------------------------
   23. Empty state
   ------------------------------------------------------------ */
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-muted);
}
.empty-state .empty-icon {
  font-size: 3.5rem;
  margin-bottom: 1rem;
  opacity: 0.4;
}
.empty-state h3 {
  color: var(--text);
  margin-bottom: 0.5rem;
}
.empty-state p {
  margin-bottom: 1.5rem;
  max-width: 360px;
  margin-left: auto;
  margin-right: auto;
}

/* ------------------------------------------------------------
   24. Toast Notifications
   ------------------------------------------------------------ */
.toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  max-width: 360px;
}

.toast {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 0.9rem 1.1rem;
  font-size: 0.9rem;
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  animation: slideDown 0.3s ease;
  border-left: 4px solid var(--primary);
}
.toast-success { border-left-color: var(--success); }
.toast-error   { border-left-color: var(--danger); }
.toast-warning { border-left-color: var(--warning); }
.toast-info    { border-left-color: var(--info); }

.toast .toast-icon { font-size: 1.1rem; flex-shrink: 0; }
.toast .toast-msg  { flex: 1; }
.toast .toast-close {
  background: none; border: none; cursor: pointer;
  color: var(--text-muted); font-size: 1.1rem; line-height: 1;
  padding: 0; flex-shrink: 0;
}

/* ------------------------------------------------------------
   25. Responsive – 768px
   ------------------------------------------------------------ */
@media (max-width: 768px) {
  html { font-size: 15px; }

  .wrapper { padding: 0 1rem; }

  /* Navbar mobile */
  .navbar-toggle { display: flex; }

  .navbar-collapse {
    display: none;
    position: absolute;
    top: 60px;
    left: 0;
    right: 0;
    background: var(--bg-nav);
    flex-direction: column;
    align-items: flex-start;
    padding: 1rem 1.5rem 1.5rem;
    gap: 0.5rem;
    box-shadow: var(--shadow);
    animation: slideDown 0.2s ease;
  }
  .navbar-collapse.open { display: flex; }

  .navbar-nav {
    flex-direction: column;
    align-items: flex-start;
    width: 100%;
    justify-content: flex-start;
  }
  .navbar-nav a { width: 100%; padding: 0.6rem 0.75rem; }

  .navbar-user {
    width: 100%;
    flex-direction: column;
    align-items: flex-start;
    border-top: 1px solid rgba(255,255,255,0.1);
    padding-top: 0.75rem;
    margin-top: 0.25rem;
  }

  /* Stat grid */
  .stat-grid { grid-template-columns: repeat(2, 1fr); }

  /* Answer options */
  .answer-options { grid-template-columns: 1fr; }

  /* Training card */
  .training-card { padding: 1.5rem 1.25rem; }
  .training-question { font-size: 1.25rem; }

  /* Table */
  .table-wrapper { border-radius: var(--radius-sm); }

  /* Vocab list header */
  .vocab-list-header { flex-direction: column; align-items: stretch; }
  .search-bar { max-width: 100%; }

  /* Auth */
  .auth-card { padding: 1.75rem 1.25rem; }
}

/* ------------------------------------------------------------
   26. Responsive – 480px
   ------------------------------------------------------------ */
@media (max-width: 480px) {
  html { font-size: 14px; }

  .stat-grid { grid-template-columns: 1fr; }

  .card-body { padding: 1rem; }
  .card-header, .card-footer { padding: 0.75rem 1rem; }

  .training-card { padding: 1.25rem 1rem; }

  .modal-dialog { border-radius: var(--radius); }
  .modal-body { padding: 1rem; }
  .modal-header, .modal-footer { padding: 0.75rem 1rem; }

  .btn-lg { padding: 0.7rem 1.4rem; font-size: 1rem; }

  h1 { font-size: 1.6rem; }
  h2 { font-size: 1.3rem; }

  .pagination .page-link { min-width: 32px; height: 32px; font-size: 0.8rem; }
}
