/* iCloud / Apple Design System — Light, airy, glassmorphism */

:root {
  /* iCloud Light — soft whites, minimal contrast */
  --apple-bg: #f5f5f7;
  --apple-bg-secondary: #ffffff;
  --apple-bg-tertiary: #e8e8ed;
  --apple-bg-elevated: rgba(255, 255, 255, 0.72);
  --apple-text: #1d1d1f;
  --apple-text-secondary: #6e6e73;
  --apple-text-tertiary: #86868b;
  --apple-border: rgba(0, 0, 0, 0.06);
  --apple-border-strong: rgba(0, 0, 0, 0.08);
  --apple-blue: #0071e3;
  --apple-blue-hover: #0077ed;
  --apple-blue-muted: rgba(0, 113, 227, 0.12);
  --apple-green: #34c759;
  --apple-green-muted: rgba(52, 199, 89, 0.12);
  --apple-red: #ff3b30;
  --apple-red-muted: rgba(255, 59, 48, 0.1);
  --apple-orange: #ff9500;
  --apple-purple: #af52de;
  --apple-radius: 12px;
  --apple-radius-lg: 16px;
  --apple-radius-sm: 10px;
  --apple-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  --apple-shadow-card: 0 2px 8px rgba(0, 0, 0, 0.04);
  --apple-glass: rgba(255, 255, 255, 0.65);
  --apple-glass-border: rgba(0, 0, 0, 0.04);
}

[data-theme="dark"] {
  --apple-bg: #000000;
  --apple-bg-secondary: #1c1c1e;
  --apple-bg-tertiary: #2c2c2e;
  --apple-bg-elevated: rgba(44, 44, 46, 0.72);
  --apple-text: #f5f5f7;
  --apple-text-secondary: #a1a1a6;
  --apple-text-tertiary: #6e6e73;
  --apple-border: rgba(255, 255, 255, 0.06);
  --apple-border-strong: rgba(255, 255, 255, 0.1);
  --apple-blue: #0a84ff;
  --apple-blue-hover: #409cff;
  --apple-blue-muted: rgba(10, 132, 255, 0.15);
  --apple-green: #30d158;
  --apple-green-muted: rgba(48, 209, 88, 0.15);
  --apple-red: #ff453a;
  --apple-red-muted: rgba(255, 69, 58, 0.12);
  --apple-orange: #ff9f0a;
  --apple-purple: #bf5af2;
  --apple-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
  --apple-shadow-card: 0 2px 8px rgba(0, 0, 0, 0.2);
  --apple-glass: rgba(44, 44, 46, 0.65);
  --apple-glass-border: rgba(255, 255, 255, 0.06);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Segoe UI", Roboto, sans-serif;
  background-color: var(--apple-bg);
  color: var(--apple-text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  letter-spacing: -0.02em;
}

/* iCloud Cards — soft, elevated */
.apple-card {
  background: var(--apple-bg-secondary);
  border-radius: var(--apple-radius);
  border: 1px solid var(--apple-border);
  box-shadow: var(--apple-shadow);
  transition: box-shadow 0.25s ease, border-color 0.25s ease;
}

.apple-card:hover {
  box-shadow: var(--apple-shadow-card);
  border-color: var(--apple-border-strong);
}

/* iCloud Glass — frosted sidebar & nav */
.apple-glass-nav {
  background: var(--apple-glass);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--apple-glass-border);
}

/* Sidebar — iCloud style frosted */
.apple-sidebar {
  background: var(--apple-glass);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-right: 1px solid var(--apple-glass-border);
  width: 260px;
  min-height: 100vh;
  position: fixed;
  top: 0;
  left: 0;
  z-index: 1000;
  transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1);
  overflow-y: auto;
}

@media (max-width: 767px) {
  .apple-sidebar {
    transform: translateX(-100%);
    background: var(--apple-bg-secondary);
    box-shadow: var(--apple-shadow-card);
  }
  .apple-sidebar.open {
    transform: translateX(0);
  }
}

.apple-sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(4px);
  z-index: 999;
}

@media (max-width: 767px) {
  .apple-sidebar-overlay.open {
    display: block;
  }
}

.apple-sidebar-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: var(--apple-radius-sm);
  margin: 2px 10px;
  color: var(--apple-text-secondary);
  text-decoration: none;
  font-size: 15px;
  font-weight: 500;
  transition: background 0.2s ease, color 0.2s ease;
}

.apple-sidebar-link svg {
  flex-shrink: 0;
  opacity: 0.8;
  width: 20px;
  height: 20px;
}

.apple-sidebar-link:hover {
  background: var(--apple-bg-tertiary);
  color: var(--apple-text);
}

.apple-sidebar-link.active {
  background: var(--apple-blue);
  color: white !important;
}

.apple-sidebar-link.active svg {
  opacity: 1;
}

.apple-theme-toggle {
  width: 40px;
  height: 40px;
  border-radius: var(--apple-radius-sm);
  border: 1px solid var(--apple-border);
  background: var(--apple-bg-elevated);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s ease;
}

.apple-theme-toggle:hover {
  background: var(--apple-bg-tertiary);
}

/* Topbar: auf Desktop rechts neben fixer Sidebar (260px), sonst Titel unter Sidebar */
.apple-dash-header {
  margin-left: 260px;
  box-sizing: border-box;
}

@media (max-width: 767px) {
  .apple-dash-header {
    margin-left: 0;
  }
}

.apple-main {
  margin-left: 260px;
  min-height: 100vh;
  padding: 28px;
  transition: margin 0.3s ease;
}

@media (max-width: 767px) {
  .apple-main {
    margin-left: 0;
    padding: 16px;
  }
}

/* Buttons */
.apple-btn-primary {
  background: var(--apple-blue);
  color: white !important;
  padding: 12px 22px;
  border-radius: var(--apple-radius-sm);
  font-weight: 500;
  font-size: 15px;
  border: none;
  cursor: pointer;
  transition: background 0.2s ease;
}

.apple-btn-primary:hover {
  background: var(--apple-blue-hover);
}

/* Sekundär / Text-Buttons (nicht quadratisch wie Theme-Toggle) */
.apple-btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 18px;
  min-height: 44px;
  border-radius: var(--apple-radius-sm);
  font-size: 14px;
  font-weight: 500;
  border: 1px solid var(--apple-border);
  background: var(--apple-bg-secondary);
  color: var(--apple-text);
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease;
  white-space: nowrap;
}

.apple-btn-secondary:hover {
  background: var(--apple-bg-tertiary);
}

.apple-btn-destructive {
  border-color: rgba(255, 59, 48, 0.35);
  color: var(--apple-red);
  background: var(--apple-red-muted);
}

.apple-btn-destructive:hover {
  background: rgba(255, 59, 48, 0.18);
}

/* Deutlich als Aktion erkennbar (z. B. Testnachricht) */
.apple-btn-outline {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  min-height: 48px;
  border-radius: var(--apple-radius-sm);
  font-size: 15px;
  font-weight: 600;
  border: 2px solid var(--apple-blue);
  background: var(--apple-blue-muted);
  color: var(--apple-blue);
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.15s ease;
  white-space: nowrap;
}

.apple-btn-outline:hover {
  background: rgba(0, 122, 255, 0.18);
  border-color: var(--apple-blue-hover);
}

.apple-btn-outline:active {
  transform: scale(0.98);
}

/* Inputs */
.apple-input {
  background: var(--apple-bg-tertiary);
  border: 1px solid var(--apple-border);
  border-radius: var(--apple-radius-sm);
  padding: 12px 16px;
  font-size: 15px;
  color: var(--apple-text);
  transition: border-color 0.2s ease;
}

.apple-input:focus {
  outline: none;
  border-color: var(--apple-blue);
}

.apple-input::placeholder {
  color: var(--apple-text-tertiary);
}

/* Utilities */
.apple-text-secondary { color: var(--apple-text-secondary); }
.apple-text-tertiary { color: var(--apple-text-tertiary); }
.apple-text-blue { color: var(--apple-blue); }
.apple-text-green { color: var(--apple-green); }
.apple-text-red { color: var(--apple-red); }
.apple-text-orange { color: var(--apple-orange); }

.apple-gradient-text {
  color: var(--apple-blue);
}

/* Hamburger */
.apple-hamburger {
  width: 40px;
  height: 40px;
  border-radius: var(--apple-radius-sm);
  border: 1px solid var(--apple-border);
  background: var(--apple-bg-elevated);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  cursor: pointer;
  transition: background 0.2s ease;
}

.apple-hamburger span {
  width: 18px;
  height: 2px;
  background: var(--apple-text);
  border-radius: 1px;
}

@media (max-width: 767px) {
  .apple-table-responsive {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
}

.line-clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.line-clamp-3 {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.hide-scrollbar::-webkit-scrollbar { display: none; }
.hide-scrollbar { -ms-overflow-style: none; scrollbar-width: none; }

details > summary { list-style: none; }
details > summary::-webkit-details-marker { display: none; }

input[type="date"],
input[type="datetime-local"] {
  color-scheme: light;
}

[data-theme="dark"] input[type="date"],
[data-theme="dark"] input[type="datetime-local"] {
  color-scheme: dark;
}

/* iCloud notification dot */
.apple-notification-dot {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--apple-red);
  border: 2px solid var(--apple-bg-secondary);
  flex-shrink: 0;
}
