/* ============================================================
   LAYOUT.CSS — Header, Sidebar, Main Content
   ============================================================ */

/* ── App Shell ───────────────────────────────────────────── */
.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 56px;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px 0 0;
  background: var(--n-0);
  border-bottom: 1px solid var(--n-150);
  box-shadow: var(--shadow-xs);
}

.header-left {
  display: flex;
  align-items: center;
  height: 100%;
}

.logo {
  display: flex;
  align-items: center;
  height: 100%;
  padding: 0 20px;
  font-family: var(--font-display);
  font-size: 18px;
  color: var(--brand-600);
  letter-spacing: -0.01em;
  border-right: 1px solid var(--n-150);
  width: 220px;
  gap: 8px;
}
.logo::before {
  content: '';
  display: inline-block;
  width: 28px;
  height: 28px;
  background: linear-gradient(135deg, var(--brand-400), var(--brand-600));
  border-radius: 8px;
  flex-shrink: 0;
}

.header-right {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}
.header-right .text-xs-muted {
  padding-right: var(--space-3);
  border-right: 1px solid var(--n-150);
  margin-right: var(--space-1);
}

/* ── Container ───────────────────────────────────────────── */
.container {
  display: flex;
  height: 100vh;
  padding-top: 56px;
}

/* ── Sidebar ─────────────────────────────────────────────── */
.sidebar {
  width: 220px;
  flex-shrink: 0;
  background: var(--n-0);
  border-right: 1px solid var(--n-150);
  height: calc(100vh - 56px);
  overflow-y: auto;
  position: fixed;
  top: 56px;
  left: 0;
  padding: var(--space-4) 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sidebar-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 16px 9px 20px;
  font-size: 13.5px;
  font-weight: 450;
  color: var(--n-500);
  cursor: pointer;
  border-radius: 0;
  transition: all var(--t-fast);
  position: relative;
  margin: 0 8px;
  border-radius: var(--r-sm);
}
.sidebar-item:hover {
  background: var(--brand-50);
  color: var(--brand-700);
}
.sidebar-item.active {
  background: var(--brand-50);
  color: var(--brand-600);
  font-weight: 600;
}
.sidebar-item.active::before {
  content: '';
  position: absolute;
  left: -8px;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 20px;
  background: var(--brand-500);
  border-radius: 0 2px 2px 0;
}

/* ── Main Content ────────────────────────────────────────── */
.main-content {
  margin-left: 220px;
  flex: 1;
  min-width: 0;
  height: calc(100vh - 56px);
  overflow-y: auto;
  background: var(--n-50);
}

/* ── Views ───────────────────────────────────────────────── */
/* Calendar uses .hidden to hide (visible by default) */
/* Other views use .active to show (hidden by default) */
.calendar-view.hidden { display: none; }

.clients-view,
.billing-view,
.edit-client-view {
  display: none;
}
.clients-view.active,
.billing-view.active,
.edit-client-view.active {
  display: block;
}

/* ── Login Screen ─────────────────────────────────────────── */
#loginScreen {
  display: flex;
  position: fixed;
  inset: 0;
  z-index: 99999;
  background: linear-gradient(145deg, #0f332c 0%, #1e6b5a 50%, #2d8470 100%);
  align-items: center;
  justify-content: center;
  font-family: var(--font-sans);
}
#loginScreen::before {
  content: '';
  position: absolute;
  inset: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' xmlns='http://www.w3.org/2000/svg'%3E%3Ccircle cx='30' cy='30' r='1' fill='rgba(255,255,255,0.06)'/%3E%3C/svg%3E") repeat;
}

.login-card {
  background: white;
  border-radius: var(--r-xl);
  padding: 48px 52px;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-xl);
  position: relative;
  z-index: 1;
  animation: loginFadeIn 0.4s cubic-bezier(0.34, 1.2, 0.64, 1);
}
@keyframes loginFadeIn {
  from { opacity: 0; transform: translateY(16px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.login-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}
.login-logo-mark {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--brand-400), var(--brand-700));
}
.login-logo-text {
  font-family: var(--font-display);
  font-size: 24px;
  color: var(--brand-700);
}
.login-subtitle {
  font-size: 13px;
  color: var(--n-400);
  margin-bottom: 36px;
  margin-left: 46px;
}
.login-heading {
  font-size: 20px;
  font-weight: 600;
  color: var(--n-800);
  margin-bottom: 28px;
}
.login-field {
  margin-bottom: 18px;
}
.login-btn {
  width: 100%;
  padding: 13px;
  background: var(--brand-500);
  color: white;
  border: none;
  border-radius: var(--r-md);
  font-size: 15px;
  font-weight: 600;
  font-family: var(--font-sans);
  cursor: pointer;
  transition: background var(--t-fast), transform var(--t-fast);
  margin-top: 4px;
}
.login-btn:hover { background: var(--brand-600); transform: translateY(-1px); }
.login-btn:active { transform: translateY(0); }

/* ── Breadcrumb ──────────────────────────────────────────── */
.breadcrumb {
  font-size: 13px;
  color: var(--n-400);
  padding: 14px 28px;
  border-bottom: 1px solid var(--n-150);
  background: var(--n-0);
}
.breadcrumb a {
  color: var(--brand-500);
  cursor: pointer;
  font-weight: 500;
}
.breadcrumb a:hover { color: var(--brand-600); }

/* ── Edit Client View ────────────────────────────────────── */
.edit-client-header {
  background: var(--n-0);
  padding: 20px 28px 0;
  border-bottom: 1px solid var(--n-150);
}
.edit-client-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--n-800);
  margin-bottom: 16px;
  font-family: var(--font-display);
}
.client-name-highlight { color: var(--brand-500); }

.edit-client-content {
  padding: 24px 28px;
  max-width: 720px;
}

.save-button {
  display: inline-flex;
  align-items: center;
  margin: 0 28px 28px;
  padding: 11px 28px;
  background: var(--brand-500);
  color: white;
  border: none;
  border-radius: var(--r-sm);
  font-size: 14px;
  font-weight: 600;
  font-family: var(--font-sans);
  cursor: pointer;
  transition: all var(--t-fast);
  box-shadow: var(--shadow-xs);
}
.save-button:hover { background: var(--brand-600); box-shadow: var(--shadow-sm); }

/* ── Section Headers (edit client) ──────────────────────── */
.section {
  background: var(--n-0);
  border: 1.5px solid var(--n-150);
  border-radius: var(--r-md);
  margin-bottom: var(--space-4);
  overflow: hidden;
}
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  font-size: 14px;
  font-weight: 600;
  color: var(--n-700);
  background: var(--n-50);
  border-bottom: 1px solid var(--n-150);
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 1fr;
  gap: var(--space-4);
  padding: var(--space-5) var(--space-5);
}
.form-group-full { grid-column: 1 / -1; }
.help-text { font-size: 12px; color: var(--n-400); margin-top: 4px; }

.minor-checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 18px;
  font-size: 13px;
  color: var(--n-600);
  border-top: 1px solid var(--n-150);
}

/* ── Tabs ────────────────────────────────────────────────── */
.tabs {
  display: flex;
  gap: 0;
  overflow-x: auto;
}
.tab {
  padding: 12px 18px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--n-400);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  transition: all var(--t-fast);
}
.tab:hover { color: var(--n-600); }
.tab.active {
  color: var(--brand-500);
  border-bottom-color: var(--brand-500);
  font-weight: 600;
}

/* ── Section title (in client modal) ────────────────────── */
.section-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--n-400);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin: 24px 0 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--n-150);
}

/* ── Form field ──────────────────────────────────────────── */
.form-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.form-field label {
  font-size: 12px;
  font-weight: 600;
  color: var(--n-500);
  letter-spacing: 0.02em;
}
.form-field input,
.form-field select {
  width: 100%;
}
.form-field.required label::after {
  content: ' *';
  color: var(--accent-red);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-4);
  margin-bottom: var(--space-4);
}
.form-group { margin-bottom: var(--space-5); }

/* ── Radio group ─────────────────────────────────────────── */
.radio-group {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}
.radio-option {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border: 1.5px solid var(--n-200);
  border-radius: var(--r-full);
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  color: var(--n-600);
  transition: all var(--t-fast);
  background: var(--n-0);
}
.radio-option:hover { border-color: var(--brand-300); color: var(--brand-700); background: var(--brand-50); }
.radio-option input[type="radio"] { accent-color: var(--brand-500); width: 14px; height: 14px; }
.radio-option:has(input:checked) { border-color: var(--brand-400); background: var(--brand-50); color: var(--brand-700); }

/* ── Date fields ─────────────────────────────────────────── */
.date-fields {
  display: flex;
  gap: 6px;
}
.date-fields select { flex: 1; }

/* ── Checkbox field ──────────────────────────────────────── */
.checkbox-field {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--n-600);
  cursor: pointer;
  padding: 8px 0;
}

/* ── Sidebar sub-items (dropdown children) ───────────────── */
.sidebar-sub-item {
  display: flex;
  align-items: center;
  padding: 7px 16px 7px 36px;
  font-size: 12.5px;
  font-weight: 400;
  color: var(--n-400);
  cursor: pointer;
  margin: 0 8px;
  border-radius: var(--r-sm);
  transition: all var(--t-fast);
}
.sidebar-sub-item:hover {
  background: var(--brand-50);
  color: var(--brand-700);
}
.sidebar-sub-item.active {
  color: var(--brand-600);
  font-weight: 600;
  background: var(--brand-50);
}

/* ── Settings sidebar — two-level collapsible ────────────── */
#settingsDropdown > .sidebar-sub-item {
  padding-left: 36px;
  font-size: 12px;
  font-weight: 500;
  color: var(--n-500);
}

#settingsCompanyDropdown .sidebar-sub-item,
#settingsUsersDropdown .sidebar-sub-item,
#settingsInsuranceDropdown .sidebar-sub-item {
  padding-left: 56px;
  font-size: 11.5px;
}
