/* ============================================
   ЛАДОМИРЯРЪ — Design System Variables
   ============================================ */

:root {
  /* ── Colors: Background ── */
  --color-bg:              #F5F5F7;
  --color-surface:         #FFFFFF;
  --color-surface-hover:   #FAFAFA;
  --color-sidebar:         #FFFFFF;
  --color-sidebar-border:  #E5E7EB;
  --color-divider:         #E5E7EB;
  --color-input-border:    #D1D5DB;
  --color-input-bg:        #FFFFFF;
  --color-input-focus:     #E8613A;

  /* ── Colors: Text ── */
  --color-text-primary:    #1A1A2E;
  --color-text-secondary:  #6B7280;
  --color-text-muted:      #9CA3AF;
  --color-text-inverse:    #FFFFFF;
  --color-label:           #9CA3AF;

  /* ── Colors: Accent ── */
  --color-accent:          #E8613A;
  --color-accent-hover:    #D4532E;
  --color-accent-light:    #FEF2ED;
  --color-accent-text:     #FFFFFF;

  /* ── Colors: Semantic ── */
  --color-success:         #22C55E;
  --color-success-light:   #DCFCE7;
  --color-warning:         #F59E0B;
  --color-warning-light:   #FEF3C7;
  --color-danger:          #EF4444;
  --color-danger-light:    #FEE2E2;
  --color-info:            #3B82F6;
  --color-info-light:      #DBEAFE;

  /* ── Colors: Progress ── */
  --color-progress-bg:     #E5E7EB;
  --color-progress-fill:   #E8613A;
  --color-day-completed:   #22C55E;
  --color-day-current:     #E8613A;
  --color-day-locked:      #D1D5DB;

  /* ── Typography ── */
  --font-heading:          'Playfair Display', Georgia, 'Times New Roman', serif;
  --font-body:             'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

  --text-xs:   0.75rem;    /* 12px */
  --text-sm:   0.875rem;   /* 14px */
  --text-base: 1rem;       /* 16px */
  --text-lg:   1.125rem;   /* 18px */
  --text-xl:   1.25rem;    /* 20px */
  --text-2xl:  1.5rem;     /* 24px */
  --text-3xl:  1.875rem;   /* 30px */
  --text-4xl:  2.25rem;    /* 36px */

  --font-normal:    400;
  --font-medium:    500;
  --font-semibold:  600;
  --font-bold:      700;

  --leading-tight:  1.25;
  --leading-normal: 1.5;
  --leading-relaxed: 1.75;

  /* ── Spacing ── */
  --space-1:   0.25rem;   /* 4px */
  --space-2:   0.5rem;    /* 8px */
  --space-3:   0.75rem;   /* 12px */
  --space-4:   1rem;      /* 16px */
  --space-5:   1.25rem;   /* 20px */
  --space-6:   1.5rem;    /* 24px */
  --space-8:   2rem;      /* 32px */
  --space-10:  2.5rem;    /* 40px */
  --space-12:  3rem;      /* 48px */
  --space-16:  4rem;      /* 64px */

  /* ── Layout ── */
  --sidebar-width:         240px;
  --sidebar-mobile-width:  min(320px, 86vw);
  --sidebar-collapsed:     60px;
  --header-height:         0px;
  --content-max-width:     1200px;
  --content-padding:       var(--space-8);
  --safe-area-top:         env(safe-area-inset-top, 0px);
  --safe-area-bottom:      env(safe-area-inset-bottom, 0px);

  /* ── Border Radius ── */
  --radius-sm:   6px;
  --radius-md:   8px;
  --radius-lg:   12px;
  --radius-xl:   16px;
  --radius-full: 9999px;

  /* ── Shadows ── */
  --shadow-sm:   0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md:   0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --shadow-lg:   0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.05);
  --shadow-xl:   0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.05);
  --shadow-card: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-sidebar: 6px 0 28px rgba(0, 0, 0, 0.16);

  /* ── Transitions ── */
  --transition-fast:   150ms ease;
  --transition-base:   250ms ease;
  --transition-slow:   350ms ease;
  --transition-slide:  0.32s cubic-bezier(0.16, 1, 0.3, 1);
  --transition-fade:   0.25s ease;

  /* ── Z-index ── */
  --z-sidebar:   100;
  --z-overlay:   200;
  --z-modal:     300;
  --z-toast:     400;
  --z-banner:    50;
}


/* ============================================
   ЛАДОМИРЯРЪ — Base Styles
   ============================================ */

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

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

body {
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  color: var(--color-text-primary);
  background-color: var(--color-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
}

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

a {
  color: var(--color-accent);
  text-decoration: none;
  transition: color var(--transition-fast);
}
a:hover {
  color: var(--color-accent-hover);
}

ul, ol { list-style: none; }

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

/* ── Typography (Fluid & High Contrast with clamp()) ── */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: var(--font-bold);
  line-height: var(--leading-tight);
  color: #0F172A;
  overflow-wrap: break-word;
  word-wrap: break-word;
}

h1 { font-size: clamp(1.65rem, 4.5vw + 0.5rem, 2.35rem); letter-spacing: -0.015em; }
h2 { font-size: clamp(1.4rem, 3.8vw + 0.4rem, 1.85rem); letter-spacing: -0.01em; }
h3 { font-size: clamp(1.22rem, 3vw + 0.3rem, 1.45rem); }
h4 { font-size: clamp(1.1rem, 2.5vw + 0.2rem, 1.25rem); }

p {
  margin-bottom: var(--space-4);
  color: #1E293B;
  font-size: clamp(1.0625rem, 2.6vw + 0.4rem, 1.1875rem);
  line-height: 1.75;
  overflow-wrap: break-word;
}

/* ── Mobile Typography Overrides ── */
@media (max-width: 640px) {
  h1 { font-size: clamp(1.6rem, 6vw, 2.1rem); line-height: 1.25; color: #0F172A; }
  h2 { font-size: clamp(1.4rem, 5.2vw, 1.75rem); line-height: 1.28; color: #0F172A; }
  h3 { font-size: clamp(1.25rem, 4.5vw, 1.5rem);  line-height: 1.32; color: #0F172A; }
  h4 { font-size: clamp(1.15rem, 4vw, 1.3rem); line-height: 1.35; color: #0F172A; }
  p {
    font-size: clamp(1.2rem, 4.8vw, 1.375rem); /* 20px - 22px for crystal-clear readability */
    line-height: 1.75;
    color: #1E293B;
    margin-bottom: var(--space-4);
    word-break: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
    text-wrap: pretty;
  }
}

/* ── Body Lock when Mobile Sidebar is Open ── */
body.sidebar-open-lock {
  overflow: hidden !important;
  touch-action: none;
}

.text-muted { color: var(--color-text-muted); }
.text-accent { color: var(--color-accent); }
.text-success { color: var(--color-success); }
.text-danger { color: var(--color-danger); }
.text-sm { font-size: var(--text-sm); }
.text-xs { font-size: var(--text-xs); }
.text-center { text-align: center; }
.font-medium { font-weight: var(--font-medium); }
.font-semibold { font-weight: var(--font-semibold); }

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-6);
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
  text-decoration: none;
  line-height: 1;
}
.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background-color: var(--color-accent);
  color: var(--color-accent-text);
  border-color: var(--color-accent);
}
.btn-primary:hover:not(:disabled) {
  background-color: var(--color-accent-hover);
  border-color: var(--color-accent-hover);
}

.btn-secondary {
  background-color: var(--color-surface);
  color: var(--color-text-primary);
  border-color: var(--color-input-border);
}
.btn-secondary:hover:not(:disabled) {
  background-color: var(--color-surface-hover);
  border-color: var(--color-text-muted);
}

.btn-outline {
  background-color: transparent;
  color: var(--color-accent);
  border-color: var(--color-accent);
}
.btn-outline:hover:not(:disabled) {
  background-color: var(--color-accent-light);
}

.btn-danger {
  background-color: var(--color-danger);
  color: white;
  border-color: var(--color-danger);
}
.btn-danger:hover:not(:disabled) {
  background-color: #DC2626;
}

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

.btn-sm {
  padding: var(--space-2) var(--space-4);
  font-size: var(--text-xs);
}

.btn-lg {
  padding: var(--space-4) var(--space-8);
  font-size: var(--text-base);
}

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

.btn-icon {
  padding: var(--space-2);
  border-radius: var(--radius-md);
  background: none;
  border: none;
  color: var(--color-text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
}
.btn-icon:hover {
  color: var(--color-text-primary);
  background-color: var(--color-surface-hover);
}

/* ── Form Elements ── */
.form-group {
  margin-bottom: var(--space-5);
}

.form-label {
  display: block;
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  color: var(--color-text-primary);
  margin-bottom: var(--space-2);
}

.form-input,
.form-textarea,
.form-select {
  width: 100%;
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-sm);
  color: var(--color-text-primary);
  background-color: var(--color-input-bg);
  border: 1px solid var(--color-input-border);
  border-radius: var(--radius-md);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
  outline: none;
}
.form-input:focus,
.form-textarea:focus,
.form-select:focus {
  border-color: var(--color-input-focus);
  box-shadow: 0 0 0 3px rgba(232, 97, 58, 0.15);
}
.form-input::placeholder,
.form-textarea::placeholder {
  color: var(--color-text-muted);
}

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

/* ── Cards ── */
.card {
  background-color: var(--color-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: var(--space-6);
  transition: box-shadow var(--transition-base);
}
.card:hover {
  box-shadow: var(--shadow-md);
}
.card-flat {
  box-shadow: none;
  border: 1px solid var(--color-divider);
}
.card-flat:hover {
  box-shadow: none;
}

/* ── Badges ── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: var(--space-1) var(--space-3);
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
  border-radius: var(--radius-full);
  line-height: 1;
}
.badge-accent {
  background-color: var(--color-accent-light);
  color: var(--color-accent);
}
.badge-success {
  background-color: var(--color-success-light);
  color: var(--color-success);
}
.badge-warning {
  background-color: var(--color-warning-light);
  color: var(--color-warning);
}
.badge-danger {
  background-color: var(--color-danger-light);
  color: var(--color-danger);
}

/* ── Progress Bar ── */
.progress {
  width: 100%;
  height: 8px;
  background-color: var(--color-progress-bg);
  border-radius: var(--radius-full);
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background-color: var(--color-progress-fill);
  border-radius: var(--radius-full);
  transition: width var(--transition-slow);
  min-width: 0;
}

/* ── Tables ── */
.table-wrapper {
  overflow-x: auto;
}
.table {
  width: 100%;
  border-collapse: collapse;
}
.table th,
.table td {
  padding: var(--space-3) var(--space-4);
  text-align: left;
  font-size: var(--text-sm);
  border-bottom: 1px solid var(--color-divider);
}
.table th {
  font-weight: var(--font-semibold);
  color: var(--color-text-secondary);
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background-color: var(--color-surface-hover);
}
.table tr:hover td {
  background-color: var(--color-surface-hover);
}

/* ── Divider ── */
.divider {
  border: none;
  border-top: 1px solid var(--color-divider);
  margin: var(--space-6) 0;
}

/* ── Utilities ── */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.gap-1 { gap: var(--space-1); }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }
.gap-6 { gap: var(--space-6); }
.gap-8 { gap: var(--space-8); }
.w-full { width: 100%; }
.mt-2 { margin-top: var(--space-2); }
.mt-4 { margin-top: var(--space-4); }
.mt-6 { margin-top: var(--space-6); }
.mb-2 { margin-bottom: var(--space-2); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-6 { margin-bottom: var(--space-6); }
.mb-8 { margin-bottom: var(--space-8); }
.ml-auto { margin-left: auto; }
.p-4 { padding: var(--space-4); }
.p-6 { padding: var(--space-6); }
.hidden { display: none !important; }
.relative { position: relative; }
.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--color-input-border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--color-text-muted); }


/* ============================================
   ЛАДОМИРЯРЪ — Login Page Styles
   ============================================ */

body {
  margin: 0;
  padding: 0;
  background-color: var(--color-bg);
  font-family: var(--font-body);
  color: var(--color-text-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
}

.login-container {
  width: 100%;
  max-width: 400px;
  padding: var(--space-4);
  box-sizing: border-box;
}

.login-card {
  background-color: var(--color-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: var(--space-8) var(--space-6);
  text-align: center;
}

.login-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 4.5rem;
  margin: 0 auto var(--space-4) auto;
  text-align: center;
}

.login-logo img {
  width: 84px;
  height: 84px;
  max-width: 100%;
  object-fit: contain;
  border-radius: var(--radius-lg);
  display: block;
  margin: 0 auto;
}

.login-title {
  font-family: var(--font-heading);
  font-size: var(--text-2xl);
  font-weight: var(--font-bold);
  margin: 0 0 var(--space-1) 0;
  letter-spacing: 0.05em;
}

.login-subtitle {
  color: var(--color-text-secondary);
  font-size: var(--text-sm);
  margin: 0 0 var(--space-6) 0;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  text-align: left;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.form-group label {
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  color: var(--color-text-secondary);
}

.form-group input {
  padding: var(--space-3);
  border: 1px solid var(--color-input-border);
  border-radius: var(--radius-md);
  font-family: var(--font-body);
  font-size: var(--text-base);
  transition: border-color var(--transition-fast);
}

.form-group input:focus {
  outline: none;
  border-color: var(--color-input-focus);
}

.remember-me-row {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  cursor: pointer;
  user-select: none;
  margin-top: -2px;
}

.remember-me-row input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--color-accent);
  cursor: pointer;
  margin: 0;
}

.btn-primary {
  background-color: var(--color-accent);
  color: var(--color-accent-text);
  border: none;
  border-radius: var(--radius-md);
  padding: var(--space-3);
  font-family: var(--font-body);
  font-size: var(--text-base);
  font-weight: var(--font-medium);
  cursor: pointer;
  transition: background-color var(--transition-fast);
  margin-top: var(--space-2);
}

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

.login-error {
  color: var(--color-danger);
  font-size: var(--text-sm);
  background-color: var(--color-danger-light);
  padding: var(--space-2);
  border-radius: var(--radius-sm);
  margin-bottom: var(--space-4);
  display: none;
  text-align: center;
}

.login-divider {
  display: flex;
  align-items: center;
  text-align: center;
  color: var(--color-text-muted);
  font-size: var(--text-xs);
  margin: var(--space-6) 0;
}

.login-divider::before,
.login-divider::after {
  content: '';
  flex: 1;
  border-bottom: 1px solid var(--color-divider);
}

.login-divider:not(:empty)::before {
  margin-right: .5em;
}

.login-divider:not(:empty)::after {
  margin-left: .5em;
}

.demo-buttons {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.btn-outline {
  background-color: transparent;
  color: var(--color-text-primary);
  border: 1px solid var(--color-input-border);
  border-radius: var(--radius-md);
  padding: var(--space-2);
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-outline:hover {
  background-color: var(--color-surface-hover);
  border-color: var(--color-text-muted);
}

/* ────────────── Security Shield & Lockout Screen ────────────── */

.lockout-alert-box {
  background: linear-gradient(135deg, rgba(220, 38, 38, 0.15), rgba(185, 28, 28, 0.25));
  border: 1px solid #ef4444;
  border-radius: var(--radius-md);
  padding: var(--space-4);
  margin-bottom: var(--space-4);
  text-align: center;
  animation: shake 0.5s ease-in-out;
}

.lockout-alert-icon {
  font-size: 2rem;
  margin-bottom: 4px;
}

.lockout-alert-title {
  font-size: var(--text-base);
  font-weight: var(--font-bold);
  color: #ef4444;
  margin-bottom: 4px;
}

.lockout-alert-timer {
  font-family: monospace;
  font-size: 1.15rem;
  font-weight: 700;
  color: #f87171;
  background: rgba(0, 0, 0, 0.25);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  display: inline-block;
  margin-top: 6px;
  letter-spacing: 0.05em;
}

.attempts-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 9999px;
  margin-bottom: 12px;
}

.attempts-badge.safe {
  background: rgba(34, 197, 94, 0.15);
  color: #22c55e;
  border: 1px solid rgba(34, 197, 94, 0.3);
}

.attempts-badge.warning {
  background: rgba(234, 179, 8, 0.15);
  color: #eab308;
  border: 1px solid rgba(234, 179, 8, 0.3);
}

.attempts-badge.danger {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

/* ────────────── 2FA Honeypot Modal ────────────── */

.pin-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: var(--space-4);
  animation: fadeIn 0.25s ease-out;
}

.pin-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 420px;
  padding: var(--space-6);
  text-align: center;
  position: relative;
  animation: scaleUp 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.pin-icon {
  font-size: 2.5rem;
  margin-bottom: 8px;
}

.pin-title {
  font-family: var(--font-heading);
  font-size: var(--text-xl);
  font-weight: var(--font-bold);
  margin-bottom: 4px;
}

.pin-honeypot-hint {
  font-size: 13px;
  color: var(--color-text-secondary);
  margin-bottom: 16px;
  line-height: 1.4;
}

.pin-input-wrapper {
  margin-bottom: 16px;
}

.pin-input-field {
  width: 100%;
  max-width: 260px;
  padding: 12px 16px;
  font-size: 24px;
  font-weight: 700;
  letter-spacing: 0.35em;
  text-align: center;
  border: 2px solid var(--color-input-border);
  border-radius: var(--radius-md);
  background: var(--color-bg);
  color: var(--color-text-primary);
  outline: none;
  transition: all var(--transition-fast);
}

.pin-input-field:focus {
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px rgba(232, 97, 58, 0.2);
}

.pin-error-box {
  background: var(--color-danger-light);
  color: var(--color-danger);
  font-size: 13px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  margin-bottom: 14px;
  display: none;
}

.pin-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.recovery-link {
  font-size: 12px;
  color: var(--color-text-muted);
  text-decoration: underline;
  cursor: pointer;
  background: none;
  border: none;
  padding: 4px;
  margin-top: 6px;
  transition: color var(--transition-fast);
}

.recovery-link:hover {
  color: var(--color-accent);
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes scaleUp {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

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