/* ============================================
   EduCRS Flashcards — Layout
   ============================================ */

#app { min-height: 100vh; display: flex; flex-direction: column; }

/* ---------- Header ---------- */
.header {
  height: var(--header-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-6);
  border-bottom: 1px solid var(--border);
  background: var(--bg-primary);
  position: sticky;
  top: 0;
  z-index: 100;
  transition: background-color var(--dur-normal) var(--ease-out);
}

.header-left {
  display: flex;
  align-items: center;
  gap: var(--space-4);
}

.header-left .hamburger {
  display: none;
  width: 36px;
  height: 36px;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  transition: background var(--dur-fast);
}
.header-left .hamburger:hover { background: var(--bg-surface); }

.header-brand {
  font-size: var(--fs-xl);
  font-weight: var(--fw-bold);
  letter-spacing: -0.5px;
}

.header-brand span {
  font-weight: var(--fw-light);
  margin-left: var(--space-2);
  font-size: var(--fs-md);
  opacity: 0.6;
}

.header-level-badge {
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
  padding: var(--space-1) var(--space-3);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-full);
  letter-spacing: 0.5px;
}

.header-right {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.icon-btn {
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-full);
  transition: background var(--dur-fast);
  position: relative;
}
.icon-btn:hover { background: var(--bg-surface-hover); }
.icon-btn svg { width: 18px; height: 18px; }

.lang-toggle {
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
  padding: var(--space-1) var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  transition: all var(--dur-fast);
  letter-spacing: 0.5px;
  min-width: 38px;
  text-align: center;
}
.lang-toggle:hover { background: var(--bg-surface-hover); border-color: var(--border-strong); }

/* ---------- Body ---------- */
.app-body {
  display: flex;
  flex: 1;
  min-height: calc(100vh - var(--header-height));
}

/* ---------- Sidebar ---------- */
.sidebar {
  width: var(--sidebar-width);
  border-right: 1px solid var(--border);
  background: var(--bg-secondary);
  display: flex;
  flex-direction: column;
  transition:
    width var(--dur-slow) var(--ease-out),
    transform var(--dur-slow) var(--ease-out),
    background-color var(--dur-normal) var(--ease-out);
  overflow: hidden;
  flex-shrink: 0;
}

.sidebar.collapsed {
  width: 0;
  border-right: none;
}

.sidebar-header {
  padding: var(--space-5) var(--space-5) var(--space-3);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sidebar-title {
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-tertiary);
}

.sidebar-collapse-btn {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  transition: background var(--dur-fast);
}
.sidebar-collapse-btn:hover { background: var(--bg-surface-hover); }
.sidebar-collapse-btn svg { width: 14px; height: 14px; }

.sidebar-input-wrap {
  padding: 0 var(--space-4) var(--space-4);
}

.sidebar-input {
  width: 100%;
  padding: var(--space-3) var(--space-4);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: var(--fs-sm);
  transition: all var(--dur-fast);
}
.sidebar-input::placeholder { color: var(--text-placeholder); }
.sidebar-input:focus {
  border-color: var(--border-strong);
  background: var(--bg-primary);
  box-shadow: var(--shadow-sm);
}

.sidebar-sets {
  flex: 1;
  overflow-y: auto;
  padding: 0 var(--space-2);
}

.set-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) var(--space-4);
  margin: var(--space-1) 0;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background var(--dur-fast);
  min-width: 0;
}
.set-item:hover { background: var(--bg-surface); }
.set-item.active { background: var(--bg-surface-active); font-weight: var(--fw-medium); }

.set-item-name {
  font-size: var(--fs-sm);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}

.set-item-count {
  font-size: var(--fs-xs);
  color: var(--text-tertiary);
  margin-left: var(--space-3);
  flex-shrink: 0;
}

.set-item-delete {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  opacity: 0;
  transition: all var(--dur-fast);
  margin-left: var(--space-2);
  flex-shrink: 0;
}
.set-item:hover .set-item-delete { opacity: 1; }
.set-item-delete:hover { background: var(--bg-surface-hover); }
.set-item-delete svg { width: 12px; height: 12px; }

.sidebar-empty {
  padding: var(--space-6) var(--space-5);
  text-align: center;
  color: var(--text-tertiary);
  font-size: var(--fs-sm);
  line-height: 1.5;
}

/* ---------- Content Area ---------- */
.content {
  flex: 1;
  padding: var(--space-8);
  position: relative;
  min-width: 0;
  transition: background-color var(--dur-normal) var(--ease-out);
}

.content-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  min-height: 400px;
  color: var(--text-tertiary);
  text-align: center;
  gap: var(--space-3);
}

.content-empty svg { width: 48px; height: 48px; opacity: 0.3; }
.content-empty p { font-size: var(--fs-md); }

/* ---------- Create Button (Floating +) ---------- */
.create-btn {
  position: fixed;
  top: calc(var(--header-height) + var(--space-6));
  right: var(--space-6);
  width: 48px;
  height: 48px;
  border-radius: var(--radius-full);
  background: var(--text-primary);
  color: var(--bg-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-lg);
  transition: all var(--dur-normal) var(--ease-out);
  z-index: 50;
}
.create-btn:hover {
  transform: scale(1.08);
  box-shadow: var(--shadow-xl);
}
.create-btn:active { transform: scale(0.96); }
.create-btn svg { width: 22px; height: 22px; }

/* ---------- Flashcard Grid ---------- */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: var(--space-6);
  padding-right: 70px; /* room for FAB */
}

/* ---------- Responsive ---------- */
@media (max-width: 768px) {
  .header-left .hamburger { display: flex; }
  .header-brand span { display: none; }

  .sidebar {
    position: fixed;
    top: var(--header-height);
    left: 0;
    bottom: 0;
    z-index: 90;
    transform: translateX(-100%);
    box-shadow: none;
    width: var(--sidebar-width);
  }
  .sidebar.mobile-open {
    transform: translateX(0);
    box-shadow: var(--shadow-xl);
  }

  .content { padding: var(--space-5); }
  .card-grid {
    grid-template-columns: 1fr;
    padding-right: 0;
  }

  .create-btn {
    top: auto;
    bottom: var(--space-6);
    right: var(--space-5);
  }
}
