/* =========================================
   ARCHIBALD228 — SHARE TRANSFER PORTAL
   Main Stylesheet
   ========================================= */

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

:root {
  --brand-dark: #1a1a2e;
  --brand-blue: #16213e;
  --brand-accent: #e94560;
  --brand-accent-hover: #c73652;
  --brand-gold: #f5a623;
  --text-primary: #1a1a2e;
  --text-secondary: #64748b;
  --text-muted: #94a3b8;
  --bg-page: #f0f4f8;
  --bg-card: #ffffff;
  --bg-input: #f8fafc;
  --border: #e2e8f0;
  --border-focus: #3b82f6;
  --success: #10b981;
  --success-light: #d1fae5;
  --success-dark: #065f46;
  --warning: #f59e0b;
  --warning-light: #fef3c7;
  --error: #ef4444;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.10);
  --shadow-lg: 0 12px 40px rgba(0,0,0,0.14);
  --radius: 12px;
  --radius-lg: 16px;
  --radius-sm: 8px;
}

html { font-size: 16px; }

body {
  font-family: 'Inter', sans-serif;
  background: var(--bg-page);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.5;
}

/* ========= LOGIN ========= */
.login-overlay {
  position: fixed;
  inset: 0;
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1.5rem;
}

.login-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 2.5rem 2rem;
  width: 100%;
  max-width: 400px;
  box-shadow: var(--shadow-lg);
}

.login-logo {
  text-align: center;
  margin-bottom: 2rem;
}

.bear-icon {
  font-size: 3rem;
  display: block;
  margin-bottom: 0.5rem;
}

.bear-icon-img {
  display: block;
  width: 90px;
  height: auto;
  margin: 0 auto 0.5rem;
  object-fit: contain;
}

.bear-icon-sm-img {
  width: 36px;
  height: auto;
  object-fit: contain;
  display: block;
}

.login-logo h1 {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.5px;
}

.login-logo p {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-top: 0.25rem;
}

.form-group {
  margin-bottom: 1.25rem;
}

.form-group label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

.form-group input,
textarea {
  width: 100%;
  background: var(--bg-input);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
  font-size: 0.95rem;
  font-family: inherit;
  color: var(--text-primary);
  transition: border-color 0.15s, box-shadow 0.15s;
  outline: none;
}

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

.password-wrap {
  position: relative;
}

.password-wrap input { padding-right: 3rem; }

.toggle-pw {
  position: absolute;
  right: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 0.9rem;
  padding: 0.25rem;
}

.login-error {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: var(--error);
  border-radius: var(--radius-sm);
  padding: 0.6rem 0.9rem;
  font-size: 0.85rem;
  margin-bottom: 1rem;
}

.btn-login {
  width: 100%;
  background: linear-gradient(135deg, #1a1a2e, #0f3460);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  padding: 0.85rem 1.5rem;
  font-size: 1rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.1s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.btn-login:hover { opacity: 0.9; }
.btn-login:active { transform: scale(0.98); }

/* ========= HEADER ========= */
.app-header {
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
  color: white;
  padding: 0 1.5rem;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-md);
}

.header-inner {
  max-width: 860px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.bear-icon-sm { font-size: 1.5rem; }

.header-title {
  font-size: 1.1rem;
  font-weight: 700;
  line-height: 1.2;
}

.header-subtitle {
  font-size: 0.75rem;
  color: rgba(255,255,255,0.6);
}

.header-right {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.user-badge {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  background: rgba(255,255,255,0.12);
  border-radius: 100px;
  padding: 0.4rem 0.9rem;
  font-size: 0.85rem;
  font-weight: 600;
}

.btn-logout {
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.2);
  color: white;
  border-radius: 100px;
  padding: 0.4rem 0.9rem;
  font-size: 0.82rem;
  font-family: inherit;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  transition: background 0.15s;
}

.btn-logout:hover { background: rgba(255,255,255,0.2); }

/* ========= PROGRESS ========= */
.progress-section {
  background: white;
  border-bottom: 1px solid var(--border);
  padding: 1.25rem 1.5rem;
}

.progress-inner {
  max-width: 860px;
  margin: 0 auto;
}

.progress-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.6rem;
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.progress-pct {
  font-weight: 700;
  color: var(--brand-blue);
  font-size: 0.95rem;
}

.progress-bar-track {
  height: 10px;
  background: #e2e8f0;
  border-radius: 100px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #10b981, #059669);
  border-radius: 100px;
  transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.progress-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 0.4rem;
}

/* ========= MAIN / CHECKLIST ========= */
.checklist-main {
  padding: 2rem 1.5rem;
  min-height: calc(100vh - 64px - 80px - 100px);
}

.checklist-container {
  max-width: 860px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.loading-state {
  text-align: center;
  padding: 4rem 2rem;
  color: var(--text-muted);
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
}

/* ========= STEP CARD ========= */
.step-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 1.5px solid var(--border);
  overflow: hidden;
  transition: box-shadow 0.2s, border-color 0.2s;
  box-shadow: var(--shadow-sm);
}

.step-card:hover {
  box-shadow: var(--shadow-md);
}

.step-card.completed {
  border-color: #a7f3d0;
  background: linear-gradient(to right, #f0fdf4, #ffffff);
}

.step-header {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  padding: 1.25rem 1.5rem;
  cursor: pointer;
  user-select: none;
}

.step-number-badge {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, #1a1a2e, #0f3460);
  color: white;
  font-size: 0.875rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 2px;
}

.step-card.completed .step-number-badge {
  background: linear-gradient(135deg, #059669, #10b981);
}

.step-header-content {
  flex: 1;
}

.step-title-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.step-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.3;
}

.step-badge-responsible {
  font-size: 0.72rem;
  font-weight: 600;
  background: #eff6ff;
  color: #1d4ed8;
  border-radius: 100px;
  padding: 0.2rem 0.65rem;
  white-space: nowrap;
}

.step-card.completed .step-badge-responsible {
  background: var(--success-light);
  color: var(--success-dark);
}

.step-meta {
  margin-top: 0.35rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.step-meta-complete {
  color: var(--success);
  font-weight: 600;
}

.step-chevron {
  color: var(--text-muted);
  font-size: 0.85rem;
  transition: transform 0.2s;
  flex-shrink: 0;
  margin-top: 4px;
}

.step-chevron.open { transform: rotate(180deg); }

/* ========= STEP BODY (EXPANDABLE) ========= */
.step-body {
  border-top: 1px solid var(--border);
  display: none;
}

.step-body.open { display: block; }

.step-body-inner {
  padding: 1.5rem;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}

@media (max-width: 640px) {
  .step-body-inner {
    grid-template-columns: 1fr;
    gap: 1rem;
    padding: 1.25rem;
  }
  .step-header { padding: 1rem 1.25rem; }
}

.step-section-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.step-description {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.6;
  grid-column: 1 / -1;
}

.step-docs-list {
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.step-docs-list li {
  padding: 0.3rem 0;
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  list-style: none;
}

.step-docs-list li::before {
  content: "→";
  color: var(--text-muted);
  font-size: 0.8rem;
  flex-shrink: 0;
}

/* ========= ACTIONS ROW ========= */
.step-actions {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  padding-top: 0.25rem;
  border-top: 1px solid var(--border);
  margin-top: 0.5rem;
  padding-top: 1rem;
}

.btn-action {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.82rem;
  font-weight: 600;
  font-family: inherit;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
  border: 1.5px solid;
  text-decoration: none;
}

.btn-action:active { transform: scale(0.97); }

.btn-note {
  background: #eff6ff;
  color: #1d4ed8;
  border-color: #bfdbfe;
}
.btn-note:hover { background: #dbeafe; }

.btn-upload {
  background: #f5f3ff;
  color: #5b21b6;
  border-color: #ddd6fe;
}
.btn-upload:hover { background: #ede9fe; }

.btn-complete {
  background: white;
  color: var(--success);
  border-color: #6ee7b7;
  margin-left: auto;
}
.btn-complete:hover { background: var(--success-light); }

.btn-complete.active {
  background: var(--success);
  color: white;
  border-color: var(--success);
}
.btn-complete.active:hover { background: #059669; }

.docs-badge {
  background: #f5f3ff;
  color: #5b21b6;
  border-radius: 100px;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.2rem 0.55rem;
}

.notes-badge {
  background: #eff6ff;
  color: #1d4ed8;
  border-radius: 100px;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.2rem 0.55rem;
}

/* ========= NOTES SECTION ========= */
.notes-section {
  grid-column: 1 / -1;
}

.notes-list {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.note-item {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
  font-size: 0.875rem;
  position: relative;
}

.note-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.4rem;
}

.note-author-badge {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.15rem 0.55rem;
  border-radius: 100px;
}

.note-author-badge.benja {
  background: #fff7ed;
  color: #c2410c;
}

.note-author-badge.manuela {
  background: #f0fdf4;
  color: #166534;
}

.note-timestamp {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.note-delete {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.75rem;
  padding: 0.25rem;
  opacity: 0;
  transition: opacity 0.15s;
}

.note-item:hover .note-delete { opacity: 1; }
.note-delete:hover { color: var(--error); }

.note-content { color: var(--text-primary); line-height: 1.5; }

/* ========= DOCS SECTION ========= */
.docs-section {
  grid-column: 1 / -1;
}

.docs-grid {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.doc-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.65rem 1rem;
  font-size: 0.875rem;
}

.doc-icon {
  font-size: 1.2rem;
  flex-shrink: 0;
}

.doc-info { flex: 1; min-width: 0; }
.doc-name {
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.doc-meta {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.doc-actions {
  display: flex;
  gap: 0.4rem;
}

.doc-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 0.85rem;
  color: var(--text-muted);
  padding: 0.3rem 0.4rem;
  border-radius: 4px;
  transition: color 0.15s, background 0.15s;
}

.doc-btn:hover { color: var(--brand-blue); background: var(--border); }
.doc-btn.delete:hover { color: var(--error); background: #fef2f2; }

/* ========= MODALS ========= */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  backdrop-filter: blur(2px);
}

.modal-card {
  background: white;
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
}

.modal-large { max-width: 680px; }

.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 {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary);
}

.modal-close {
  background: none;
  border: none;
  font-size: 1rem;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.25rem;
  border-radius: 4px;
  transition: color 0.15s;
}
.modal-close:hover { color: var(--text-primary); }

.modal-body {
  padding: 1.5rem;
}

.modal-body textarea {
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  resize: vertical;
  min-height: 120px;
}

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

.btn-primary {
  background: linear-gradient(135deg, #1a1a2e, #0f3460);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  padding: 0.6rem 1.25rem;
  font-size: 0.875rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  transition: opacity 0.15s;
}
.btn-primary:hover { opacity: 0.88; }

.btn-secondary {
  background: white;
  color: var(--text-secondary);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.6rem 1.25rem;
  font-size: 0.875rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s;
}
.btn-secondary:hover { background: var(--bg-input); }

.btn-upload-new {
  cursor: pointer;
}

/* ========= FOOTER ========= */
.app-footer {
  text-align: center;
  padding: 1.5rem;
  font-size: 0.78rem;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
  margin-top: 1rem;
}

/* ========= TOAST ========= */
.toast {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  background: #1e293b;
  color: white;
  padding: 0.75rem 1.5rem;
  border-radius: 100px;
  font-size: 0.875rem;
  font-weight: 500;
  z-index: 9999;
  box-shadow: var(--shadow-md);
  white-space: nowrap;
  transition: opacity 0.3s;
}

.toast.success { background: #065f46; }
.toast.error { background: #991b1b; }

/* ========= MISC ========= */
.empty-state {
  text-align: center;
  padding: 1.5rem;
  color: var(--text-muted);
  font-size: 0.85rem;
  font-style: italic;
}

.upload-area {
  border: 2px dashed var(--border);
  border-radius: var(--radius-sm);
  padding: 1.5rem;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  font-size: 0.875rem;
  color: var(--text-muted);
}

.upload-area:hover {
  border-color: #a78bfa;
  background: #faf5ff;
  color: #5b21b6;
}

.upload-area input { display: none; }
.upload-icon { font-size: 1.75rem; margin-bottom: 0.5rem; display: block; }

/* Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }
