/* =================================================================
   CAELUM CO. — iOS / APPLE-INSPIRED PREMIUM UI REDESIGN (client.css)
================================================================= */

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@400;500;600;700;800&display=swap');

:root {
  /* iOS / Apple Design Tokens adapted for Caelum Co. */
  --ios-bg: #f2f2f7;
  --ios-surface: #ffffff;
  --ios-surface-alt: #f9f9f9;
  --ios-border: rgba(0, 0, 0, 0.05);
  --ios-border-hover: rgba(0, 168, 150, 0.15);
  --ios-text-primary: #1c1c1e;
  --ios-text-secondary: #8e8e93;
  --ios-accent: #00a896; /* Caelum Teal */
  --ios-accent-rgb: 0, 168, 150;
  --ios-blue: #007aff;
  --ios-green: #34c759;
  --ios-green-bg: #eafaf1;
  --ios-orange: #ff9500;
  --ios-orange-bg: #fff9f0;
  --ios-red: #ff3b30;
  --ios-red-bg: #ffefee;
  --ios-card-shadow: 0 4px 18px rgba(0, 0, 0, 0.02);
  --ios-modal-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
  
  /* Easing curves matching spring animation guides */
  --spring-easing: linear(0, 0.016 0.5%, 0.06 1%, 0.226 2%, 1.116 5.4%, 1.375 6.6%, 1.527 7.7%, 1.565 8.2%, 1.585 8.8%, 1.581 9.3%, 1.559 9.8%, 1.458 10.9%, 0.937 14.3%, 0.784 15.5%, 0.693 16.6%, 0.67 17.1%, 0.657 17.7%, 0.671 18.7%, 0.729 19.8%, 1.042 23.3%, 1.13 24.5%, 1.182 25.6%, 1.201 26.7%, 1.192 27.7%, 1.156 28.8%, 0.977 32.2%, 0.925 33.4%, 0.894 34.5%, 0.882 35.6%, 0.887 36.6%, 0.907 37.7%, 1.045 42.4%, 1.069 44.5%, 1.059 46.3%, 0.979 50.9%, 0.96 53.4%, 0.966 55.3%, 1.013 59.9%, 1.024 62.3%, 0.986 71.2%, 1.008 79.9%, 0.995 88.9%, 1);
  --transition-ios: all 0.4s var(--spring-easing);
  
  /* Fonts */
  --font-family-ios: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Outfit", "Segoe UI", sans-serif;
}

/* ─── BASE RESET ─────────────────────────────────────────────── */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: var(--font-family-ios);
  -webkit-font-smoothing: antialiased;
}

body {
  background-color: var(--ios-bg);
  color: var(--ios-text-primary);
  min-height: 100vh;
}

/* ─── MAIN LAYOUT ────────────────────────────────────────────── */
.client-layout {
  display: flex;
  min-height: 100vh;
}

/* ─── iOS SIDEBAR (DESKTOP) ──────────────────────────────────── */
.client-sidebar {
  width: 250px;
  background-color: var(--ios-surface);
  border-right: 1px solid var(--ios-border);
  padding: 1.5rem 1rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  height: 100vh;
  position: sticky;
  top: 0;
  transition: var(--transition-ios);
}

.client-sidebar.collapsed {
  width: 72px;
}

.client-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0.75rem 1.5rem;
  border-bottom: 1px solid var(--ios-border);
  margin-bottom: 1rem;
}

.client-brand .brand-text {
  transition: opacity 0.3s ease;
  white-space: nowrap;
}

.client-sidebar.collapsed .brand-text {
  opacity: 0;
  width: 0;
  overflow: hidden;
  pointer-events: none;
}

.client-nav-label {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--ios-text-secondary);
  letter-spacing: 0.05em;
  padding: 1rem 0.75rem 0.4rem;
  white-space: nowrap;
  transition: opacity 0.3s ease;
}

.client-sidebar.collapsed .client-nav-label {
  opacity: 0;
}

.client-nav {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.client-nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 0.75rem;
  border-radius: 10px;
  border: none;
  background: none;
  cursor: pointer;
  width: 100%;
  text-align: left;
  transition: var(--transition-ios);
  color: var(--ios-text-primary);
  font-size: 0.9rem;
  font-weight: 500;
}

.client-nav-item:hover {
  background-color: var(--ios-bg);
}

.client-nav-item.active {
  background-color: rgba(var(--ios-accent-rgb), 0.1);
  color: var(--ios-accent);
  font-weight: 600;
}

.client-nav-item .nav-icon {
  font-size: 1.15rem;
  width: 22px;
  text-align: center;
  flex-shrink: 0;
}

.client-nav-item .nav-label {
  transition: opacity 0.3s ease;
  white-space: nowrap;
}

.client-sidebar.collapsed .nav-label {
  opacity: 0;
  width: 0;
  overflow: hidden;
  pointer-events: none;
}

/* ─── MAIN PORTAL CONTENT AREA ────────────────────────────────── */
.client-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  position: relative;
}

/* Sticky Minimal iOS Header with subtle translucency */
.client-topbar {
  position: sticky;
  top: 0;
  z-index: 200;
  height: 60px;
  background-color: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid var(--ios-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2rem;
}

.btn-toggle-sidebar {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: none;
  border: none;
  cursor: pointer;
  transition: background-color 0.2s;
}

.btn-toggle-sidebar:hover {
  background-color: rgba(0, 0, 0, 0.03);
}

.client-content {
  padding: 2rem;
  max-width: 1000px;
  margin: 0 auto;
  width: 100%;
}

/* ─── iOS GROUPED CONTAINER CARDS ────────────────────────────── */
.card {
  background-color: var(--ios-surface);
  border-radius: 14px;
  border: 1px solid var(--ios-border);
  box-shadow: var(--ios-card-shadow);
  padding: 1.25rem;
  margin-bottom: 1.25rem;
  transition: var(--transition-ios);
}

/* Protection Hero Banner Card */
.protection-card {
  background: var(--ios-surface);
  border: 1px solid var(--ios-border);
  border-radius: 18px;
  padding: 1.75rem;
  box-shadow: var(--ios-card-shadow);
  margin-bottom: 1.5rem;
  position: relative;
  overflow: hidden;
}

/* Status Indicator slow pulse */
.sys-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--ios-green);
  display: inline-block;
  animation: iosPulse 2.4s infinite ease-in-out;
}

@keyframes iosPulse {
  0% {
    transform: scale(0.9);
    opacity: 0.6;
  }
  50% {
    transform: scale(1.2);
    opacity: 1;
    box-shadow: 0 0 10px rgba(52, 199, 89, 0.6);
  }
  100% {
    transform: scale(0.9);
    opacity: 0.6;
  }
}

.badge-active {
  background-color: var(--ios-green-bg);
  color: var(--ios-green);
}

.badge-warning {
  background-color: var(--ios-orange-bg);
  color: var(--ios-orange);
}

.badge-critical {
  background-color: var(--ios-red-bg);
  color: var(--ios-red);
}

/* KPI CARDS iOS Settings Layout Style */
.client-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.client-kpi-card {
  background-color: var(--ios-surface);
  border: 1px solid var(--ios-border);
  border-radius: 12px;
  padding: 1rem;
  box-shadow: var(--ios-card-shadow);
  cursor: pointer;
  transition: var(--transition-ios);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.client-kpi-card:hover {
  transform: translateY(-2px);
  border-color: var(--ios-border-hover);
}

.kpi-label {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--ios-text-secondary);
  letter-spacing: 0.04em;
  margin-bottom: 0.25rem;
}

.kpi-value {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--ios-text-primary);
  line-height: 1.2;
}

/* iOS Grouped Roster Settings Rows */
.settings-group {
  background-color: var(--ios-surface);
  border: 1px solid var(--ios-border);
  border-radius: 14px;
  overflow: hidden;
  margin-bottom: 1.5rem;
  box-shadow: var(--ios-card-shadow);
}

.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1.25rem;
  border-bottom: 1px solid var(--ios-border);
  transition: background-color 0.2s;
  cursor: pointer;
  text-decoration: none;
  color: inherit;
}

.settings-row:hover {
  background-color: rgba(0, 0, 0, 0.015);
}

.settings-row:last-child {
  border-bottom: none;
}

.settings-row-label {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.9rem;
  font-weight: 500;
}

.settings-row-icon {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  background-color: var(--ios-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
}

.settings-row-value {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--ios-text-secondary);
  font-size: 0.85rem;
}

.chevron-right::after {
  content: '›';
  font-family: monospace;
  font-size: 1.25rem;
  color: #c7c7cc;
  margin-left: 0.25rem;
}

/* ─── MODALS & iOS SLIDE-UP SHEETS ────────────────────────────── */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 9999;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  transition: opacity 0.3s ease;
}

.modal-overlay.active {
  display: flex;
}

.modal-content {
  background-color: var(--ios-surface);
  border-radius: 16px;
  box-shadow: var(--ios-modal-shadow);
  padding: 1.5rem;
  width: 100%;
  max-width: 500px;
  border: 1px solid var(--ios-border);
  animation: iosModalEnter 0.4s var(--spring-easing);
  position: relative;
}

@keyframes iosModalEnter {
  from {
    transform: translateY(30px) scale(0.96);
    opacity: 0;
  }
  to {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
}

/* iOS Toggle switches */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 51px;
  height: 31px;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #e5e5ea;
  transition: .4s;
  border-radius: 34px;
}

.toggle-slider:before {
  position: absolute;
  content: "";
  height: 27px;
  width: 27px;
  left: 2px;
  bottom: 2px;
  background-color: white;
  transition: .4s;
  border-radius: 50%;
  box-shadow: 0 3px 8px rgba(0,0,0,0.15);
}

input:checked + .toggle-slider {
  background-color: #34c759;
}

input:checked + .toggle-slider:before {
  transform: translateX(20px);
}

/* ─── RESPONSIVE iOS BOTTOM TAB BAR ──────────────────────────── */
@media (max-width: 768px) {
  .client-sidebar {
    display: none;
  }

  .client-topbar {
    padding: 0 1rem;
    height: 52px;
  }

  .btn-toggle-sidebar {
    display: none;
  }

  .client-content {
    padding: 1rem 1rem 5.5rem 1rem;
  }

  .client-kpi-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  /* Translucent frosted glass tab bar for iOS native app feel */
  .mobile-bottom-nav {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background-color: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-top: 1px solid var(--ios-border);
    padding: 0.5rem 0.75rem;
    justify-content: space-around;
    align-items: center;
    box-shadow: 0 -3px 15px rgba(0, 0, 0, 0.02);
    z-index: 9900;
  }

  .mobile-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.2rem;
    font-size: 0.65rem;
    color: var(--ios-text-secondary);
    background: none;
    border: none;
    cursor: pointer;
    flex: 1;
    padding: 0.25rem;
    transition: color 0.2s;
  }

  .mobile-nav-item.active {
    color: var(--ios-accent);
  }

  .mobile-nav-item span:first-child {
    font-size: 1.3rem;
    line-height: 1;
  }

  /* Slide-up sheet animation for mobile modal bottom sheets */
  .modal-content {
    border-radius: 20px 20px 0 0;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    max-width: 100%;
    margin-bottom: 0;
    animation: iosMobileSheetEnter 0.4s var(--spring-easing);
  }

  @keyframes iosMobileSheetEnter {
    from {
      transform: translateY(100%);
    }
    to {
      transform: translateY(0);
    }
  }
}
