/* =========================================
   Stratify 4096 - Design System
   Light / Crisp SaaS Foundation
========================================= */

/* =========================================
   Tokens
========================================= */

:root {

  /* Colors */
  --bg-body: #F5F7FA;
  --bg-card: #FFFFFF;
  --border-color: #E3E8EF;

  --text-primary: #111827;
  --text-secondary: #6B7280;

  --accent: #3B5BDB;
  --accent-hover: #2F4ACF;

  --success: #15803D;
  --danger: #B91C1C;

  /* Radius */
  --radius-sm: 6px;

  /* Spacing */
  --space-xs: 8px;
  --space-sm: 12px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;

  /* Typography */
  --font-base: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

/* =========================================
   Base Reset
========================================= */

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--font-base);
  background: var(--bg-body);
  color: var(--text-primary);
  line-height: 1.5;
}

/* =========================================
   Layout
========================================= */

.container {
  max-width: 800px;
  margin: 40px auto;
  padding: var(--space-lg);
}

.main {
  padding-top: var(--space-lg);
}

/* =========================================
   Cards
========================================= */

.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: var(--space-lg);
  margin-bottom: var(--space-lg);
}

.card p {
  margin-bottom: var(--space-md);
}

/* =========================================
   Typography
========================================= */

h1 {
  font-size: 26px;
  margin-bottom: var(--space-lg);
}

h2 {
  font-size: 20px;
  margin-bottom: var(--space-md);
}

h3 {
  font-size: 16px;
  margin-bottom: var(--space-sm);
  color: var(--text-secondary);
}

/* =========================================
   Buttons
========================================= */

button,
.btn {
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-weight: 500;
  transition: background 0.15s ease;
}

button:hover,
.btn:hover {
  background: var(--accent-hover);
}

/* =========================================
   Forms
========================================= */

input,
select,
textarea {
  width: 100%;
  padding: 10px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  margin-bottom: var(--space-md);
  font-size: 14px;
}

/* =========================================
   Flash Messages
========================================= */

.flash.success {
  background: #E6F4EA;
  border: 1px solid #B7E0C7;
  color: var(--success);
  padding: var(--space-sm);
  border-radius: var(--radius-sm);
  margin-bottom: var(--space-md);
}

.flash.error {
  background: #FDE8E8;
  border: 1px solid #F5C2C2;
  color: var(--danger);
  padding: var(--space-sm);
  border-radius: var(--radius-sm);
  margin-bottom: var(--space-md);
}

/* =========================================
   Links
========================================= */

.link {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
}

.link:hover {
  text-decoration: underline;
}

/* =========================================
   Overflow Safety (Safari Fix)
========================================= */

.card,
.card p,
.card span,
.card div {
  overflow-wrap: break-word;
  word-wrap: break-word;
  word-break: break-word;
}

/* =========================================
   Top Navigation
========================================= */

.topbar {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 100;
}

.topbar-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 var(--space-lg);
  height: 60px;

  display: flex;
  align-items: center;
  justify-content: space-between;

  /* ✅ FIX: anchors the absolute-position dropdown to the header */
  position: relative;
}

.brand a {
  font-weight: 600;
  font-size: 18px;
  color: var(--text-primary);
  text-decoration: none;
}

.nav {
  display: flex;
  gap: var(--space-md);
  align-items: center;
}

.nav a {
  text-decoration: none;
  color: var(--text-secondary);
  font-weight: 500;
  transition: color 0.15s ease;
}

.nav a:hover {
  color: var(--accent);
}

.nav-primary {
  background: var(--accent);
  color: #fff !important;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
}

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

.nav-logout {
  color: var(--danger);
}

/* =========================================
   Mobile Navigation
========================================= */

.hamburger {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  flex-direction: column;
  gap: 5px;
  z-index: 200;
}

.hamburger span {
  width: 22px;
  height: 2px;
  background: var(--text-primary);
  transition: all 0.2s ease;
}

/* Animate to X */
.hamburger.active span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.hamburger.active span:nth-child(2) {
  opacity: 0;
}

.hamburger.active span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

@media (max-width: 768px) {

  .hamburger {
    display: flex;
  }

  .nav {
    position: absolute;
    top: 60px;
    right: 16px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    flex-direction: column;
    width: 220px;
    padding: var(--space-md);

    opacity: 0;
    transform: translateY(-10px);
    pointer-events: none;

    transition: all 0.2s ease;
    box-shadow: 0 10px 25px rgba(0,0,0,0.05);

    /* ✅ ensure it overlays cards */
    z-index: 300;
  }

  .nav.nav-open {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
  }

  .nav a {
    padding: 10px 0;
  }
}

/* =========================================================
   Avatar Component
   - Circular profile image
   - Fixed square aspect ratio
   - Cropped to cover container
========================================================= */

.avatar {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    object-fit: cover;
}

/* =========================================================
   Avatar Size Variants
   - Small, Default, Large
========================================================= */

.avatar-sm {
    width: 48px;
    height: 48px;
}

.avatar {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    object-fit: cover;
}

.avatar-lg {
    width: 180px;
    height: 180px;
}

/* =========================================================
   Avatar Base Styling
   - Circular
   - Cropped
   - Subtle border + elevation
========================================================= */

.avatar {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    object-fit: cover;

    border: 2px solid rgba(0, 0, 0, 0.08);
    background-color: #f4f4f4;
}