/**
 * Nob Hills Portal - Custom Styles
 *
 * This file contains minimal custom CSS.
 * Most styling is handled by Tailwind CSS and DaisyUI.
 *
 * Keep this file minimal as per the UI stack philosophy.
 */

/* Alpine.js x-cloak - prevent flash of unstyled content */
[x-cloak] {
    display: none !important;
}

/* Add any custom styles here as needed */

/* ─── glass-ui design tokens ─────────────────────────────── */
:root {
  --brand-rgb:  6 182 212;
  --brand2-rgb: 14 165 233;
  --brand-bg:   240 252 255;

  --color-glass-light:         rgba(255,255,255,0.55);
  --color-glass-light-hover:   rgba(255,255,255,0.68);
  --color-glass-border:        rgba(255,255,255,0.70);
  --color-glass-border-strong: rgba(200,200,220,0.60);

  --blur-glass-sm:  8px;
  --blur-glass-md:  16px;
  --blur-glass-lg:  24px;

  --shadow-glass-md:
    0 4px 16px rgba(0,0,0,0.06),
    inset 0 1px 0 rgba(255,255,255,0.80);
  --shadow-glass-elevated:
    0 20px 60px rgba(0,0,0,0.10),
    inset 0 1px 0 rgba(255,255,255,0.90);

  --font-body: "Inter", system-ui, sans-serif;

  /* Text colors — light theme defaults (glass-ui bundle defaults to white/dark) */
  --color-text-primary:   rgba(10, 10, 20, 0.90);
  --color-text-secondary: rgba(10, 10, 20, 0.60);
  --color-text-muted:     rgba(10, 10, 20, 0.40);

  /* Brand palette (keep in sync with glass-ui) */
  --color-brand-300: #67e8f9;
  --color-brand-400: #22d3ee;
  --color-brand-500: #06b6d4;
  --color-brand-600: #0891b2;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
}

/* ─── Keyframes ───────────────────────────────────────────── */
@keyframes blob-drift {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33%       { transform: translate(30px, -20px) scale(1.05); }
  66%       { transform: translate(-20px, 15px) scale(0.95); }
}
@keyframes fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes slide-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ─── Glass utility classes ───────────────────────────────── */
.glass-surface {
  background: var(--color-glass-light);
  backdrop-filter: blur(var(--blur-glass-md)) saturate(180%);
  -webkit-backdrop-filter: blur(var(--blur-glass-md)) saturate(180%);
  border: 1px solid var(--color-glass-border);
  box-shadow: var(--shadow-glass-md);
}

.glass-surface-elevated {
  background: var(--color-glass-light-hover);
  backdrop-filter: blur(var(--blur-glass-lg)) saturate(200%);
  -webkit-backdrop-filter: blur(var(--blur-glass-lg)) saturate(200%);
  border: 1px solid var(--color-glass-border-strong);
  box-shadow: var(--shadow-glass-elevated);
}

.glass-input {
  background: rgba(255,255,255,0.50);
  border: 1px solid rgba(10,10,20,0.15);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-radius: 12px;
  color: rgba(10,10,20,0.90);
  transition: border-color 150ms ease, background 150ms ease, box-shadow 150ms ease;
  outline: none;
  width: 100%;
  padding: 0.75rem 1rem;
}

.glass-input::placeholder {
  color: rgba(10,10,20,0.35);
}

.glass-input:focus {
  background: rgba(255,255,255,0.65);
  border-color: rgba(6,182,212,0.60);
  box-shadow: 0 0 0 3px rgba(6,182,212,0.15);
}

/* ─── Missing component classes (React-only in glass-ui dist) ─ */

/* Card */
.glass-card {
  background: var(--color-glass-light);
  backdrop-filter: blur(var(--blur-glass-md)) saturate(180%);
  -webkit-backdrop-filter: blur(var(--blur-glass-md)) saturate(180%);
  border: 1px solid var(--color-glass-border);
  box-shadow: var(--shadow-glass-md);
  border-radius: 0.75rem;
  padding: 1.5rem;
}
.glass-card-compact {
  background: var(--color-glass-light);
  backdrop-filter: blur(var(--blur-glass-md)) saturate(180%);
  -webkit-backdrop-filter: blur(var(--blur-glass-md)) saturate(180%);
  border: 1px solid var(--color-glass-border);
  box-shadow: var(--shadow-glass-md);
  border-radius: 0.75rem;
  padding: 1rem;
}
.glass-card {
  transition: box-shadow 0.2s ease;
}
.glass-card:hover {
  box-shadow: 0 25px 50px rgba(0,0,0,0.12), inset 0 1px 0 rgba(255,255,255,0.90);
}

/* Modal box */
.glass-modal-box {
  background: var(--color-glass-light-hover);
  backdrop-filter: blur(var(--blur-glass-lg)) saturate(200%);
  -webkit-backdrop-filter: blur(var(--blur-glass-lg)) saturate(200%);
  border: 1px solid var(--color-glass-border-strong);
  box-shadow: var(--shadow-glass-elevated);
  border-radius: 1rem;
  padding: 1.5rem;
  animation: slideUp 0.2s ease-out;
}
@keyframes slideUp {
  from { transform: translateY(8px); opacity: 0; }
  to   { transform: translateY(0);   opacity: 1; }
}

/* Table */
.glass-table {
  background: var(--color-glass-light);
  backdrop-filter: blur(var(--blur-glass-md)) saturate(180%);
  -webkit-backdrop-filter: blur(var(--blur-glass-md)) saturate(180%);
  border: 1px solid var(--color-glass-border);
  border-radius: 0.75rem;
  overflow: hidden;
  width: 100%;
}
.glass-table thead {
  background: rgba(255,255,255,0.08);
  position: sticky;
  top: 0;
}
.glass-table thead tr {
  border-bottom: 1px solid rgba(10,10,20,0.10);
}
.glass-table th {
  padding: 0.75rem 1rem;
  text-align: left;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: rgba(10,10,20,0.50);
  white-space: nowrap;
}
.glass-table tbody tr {
  border-bottom: 1px solid rgba(10,10,20,0.06);
  transition: background 100ms ease;
}
.glass-table tbody tr:last-child {
  border-bottom: none;
}
.glass-table tbody tr:hover {
  background: rgba(10,10,20,0.04);
}
.glass-table td {
  padding: 0.75rem 1rem;
  font-size: 0.875rem;
  color: rgba(10,10,20,0.80);
}

/* Dropdown panel
   NOTE: backdrop-filter is intentionally omitted here. Dropdowns are typically
   rendered inside a glass-navbar ancestor that already has backdrop-filter set,
   which creates a CSS stacking context. A child's backdrop-filter would then blur
   the parent's composited layer rather than the underlying page content, producing
   no visible frosted effect. We compensate with a high-opacity background + shadow. */
.glass-dropdown-content {
  background: rgba(242, 247, 255, 0.97);
  border: 1px solid var(--color-glass-border-strong);
  border-radius: 0.75rem;
  box-shadow: 0 8px 32px rgba(0,0,0,0.14), 0 2px 8px rgba(0,0,0,0.08), inset 0 1px 0 rgba(255,255,255,0.80);
  position: absolute;
  z-index: 50;
  min-width: 10rem;
  padding: 0.5rem;
  animation: slideUp 0.15s ease-out;
}

/* Avatar */
.glass-avatar {
  border-radius: 9999px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, rgb(var(--brand-rgb)), rgb(var(--brand2-rgb)));
}

/* Form controls */
.glass-select {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='rgba(10,10,20,0.5)' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  padding-right: 2.5rem;
}
.glass-textarea {
  resize: vertical;
  min-height: 5rem;
}
.glass-checkbox,
.glass-toggle {
  accent-color: rgb(var(--brand-rgb));
}

/* ─── Navbar: restore backdrop-filter lost in light-theme override ────────── */
.glass-navbar {
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border-bottom: 1px solid var(--color-glass-border);
}

/* ─── Nav links: proper hover style (border + shadow like a button) ────────── */
/* Transparent border on default state prevents layout shift on hover */
.glass-nav-link {
  border: 1px solid transparent;
}
.glass-nav-link:hover {
  border-color: rgba(10,10,20,0.12);
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  background: rgba(255,255,255,0.55);
}
.glass-nav-link-active {
  display: inline-flex;
  align-items: center;
  padding: 0.375rem 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 500;
  text-decoration: none;
  transition: all 0.15s;
  border: 1px solid rgba(10,10,20,0.14);
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  background: rgba(255,255,255,0.65);
}

/* ─── Glass button: defeat Tailwind v3 CDN preflight ─────────────────────── */
/*                                                                              */
/* glass-ui.css uses @layer components (Tailwind v4).                          */
/* Tailwind v3 CDN injects UNLAYERED preflight at runtime:                     */
/*   button { background-color: transparent; padding: 0; color: inherit }      */
/* Unlayered rules always beat @layer rules, so buttons lose their styles.     */
/* Fix: explicit unlayered overrides here with !important where needed.         */

.glass-btn {
  padding-inline: 1rem !important;
  height: 2.5rem !important;
  gap: 0.5rem !important;
  font-size: 0.875rem !important;
  background-color: transparent !important;  /* reset; subclasses set their own */
}
.glass-btn-sm {
  padding-inline: 0.75rem !important;
  height: 2rem !important;
  gap: 0.375rem !important;
  font-size: 0.875rem !important;
}
.glass-btn-lg {
  padding-inline: 1.5rem !important;
  height: 3rem !important;
  gap: 0.625rem !important;
  font-size: 1rem !important;
}

.glass-btn-primary {
  color: #fff !important;
  background: linear-gradient(to bottom right, #06b6d4e6, #0284c7e6) !important;
  box-shadow: 0 4px 16px rgb(var(--brand-rgb) / 0.35) !important;
  border: 1px solid #22d3ee66 !important;
}
.glass-btn-primary:not(:disabled):hover {
  color: #fff !important;
  background: linear-gradient(to bottom right, #22d3eee6, #0ea5e9e6) !important;
  box-shadow: 0 4px 20px rgb(var(--brand-rgb) / 0.5) !important;
}
.glass-btn-danger {
  color: #fff !important;
  background: #ef4444cc !important;
  border: 1px solid #ef444466 !important;
  box-shadow: 0 4px 16px #ef444440 !important;
}
.glass-btn-danger:not(:disabled):hover {
  color: #fff !important;
  background: #ef4444e6 !important;
}

/* ─── Alert colors: solid, opaque — must demand user attention ────────────── */
.glass-alert-info    { background: #dbeafe; color: #1e3a8a; border-color: #93c5fd; }
.glass-alert-warning { background: #ffe2c4; color: #7c2d12; border-color: #fdba74; }
.glass-alert-error   { background: #fee2e2; color: #7f1d1d; border-color: #fca5a5; }
.glass-alert-success { background: #d1fae5; color: #064e3b; border-color: #6ee7b7; }

/* ─── Badge text color overrides for light theme ─────────────────────────── */
.glass-badge-info    { color: rgb(7 89 133); }
.glass-badge-success { color: rgb(4 108 78); }
.glass-badge-warning { color: rgb(146 64 14); }
.glass-badge-danger  { color: rgb(153 27 27); }
.glass-badge-primary { color: rgb(8 145 178); }
.glass-badge-default { color: rgba(10,10,20,0.75); background: rgba(0,0,0,0.07); border-color: rgba(0,0,0,0.12); }

/* ─── Modal styles (DaisyUI-compatible — DaisyUI is not in this stack) ──────── */
dialog.modal {
  padding: 0;
  border: none;
  background: transparent;
  width: 100%;
  max-width: none;
  height: 100%;
  max-height: none;
}
dialog.modal[open] {
  display: grid;
  place-items: center;
}
dialog.modal::backdrop {
  background: rgba(0, 0, 0, 0.40);
}
.modal-box {
  background: #fff;
  padding: 1.5rem;
  border-radius: 1rem;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  max-height: calc(100vh - 5em);
  overflow-y: auto;
  position: relative;
  width: 100%;
}
.modal-action {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 1rem;
  padding-top: 1rem;
}
.modal-backdrop {
  position: fixed;
  inset: 0;
}

/* Error state for glass-input */
.glass-input-error {
  border-color: rgba(239, 68, 68, 0.60);
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.15);
}

/* ─── App Sidebar Layout ──────────────────────────────────── */

/* Default (desktop): sidebar in flow, w-60 */
#app-sidebar {
  width: 15rem;
}
#app-sidebar.app-sidebar-collapsed {
  width: 4rem;
}

/* Mobile: sidebar as fixed overlay */
@media (max-width: 1023px) {
  #app-sidebar {
    position: fixed;
    top: 3.5rem; /* h-14 */
    bottom: 0;
    left: 0;
    width: 15rem !important;
    transform: translateX(-100%);
  }
  #app-sidebar.app-sidebar-mobile-open {
    transform: translateX(0);
  }
  .app-mobile-backdrop { display: block; }
  .app-hamburger { display: inline-flex !important; }
  .app-collapse-btn { display: none !important; }
}
@media (min-width: 1024px) {
  .app-hamburger { display: none !important; }
  .app-mobile-backdrop { display: none !important; }
  #app-sidebar {
    transform: none !important;
  }
}

/* Sidebar label — shrink when collapsed */
.app-sidebar-label {
  overflow: hidden;
  white-space: nowrap;
  transition: opacity 0.2s ease, width 0.2s ease;
}
#app-sidebar.app-sidebar-collapsed .app-sidebar-label {
  opacity: 0;
  width: 0;
  pointer-events: none;
}

/* ─── Sidebar item active state: light-theme override ────── */
/* glass-ui.css active state uses brand-300 (#67e8f9) which is too light on white bg */
.glass-sidebar-item-active {
  background: rgba(6,182,212,0.12) !important;
  color: rgb(8,145,178) !important;
  border-color: rgba(6,182,212,0.25) !important;
}

/* ─── Profile page tab nav ────────────────────────────────── */
.glass-surface-static {
  background: rgba(255,255,255,0.30);
  border: 1px solid var(--color-glass-border);
  border-radius: var(--radius-md);
}

.profile-tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 500;
  transition: all 0.15s;
  cursor: pointer;
  background: transparent;
  border: 1px solid transparent;
}

.profile-tab-active {
  background: rgba(6,182,212,0.12);
  color: rgb(8,145,178);
  border-color: rgba(6,182,212,0.25);
}

.profile-tab-inactive {
  color: rgba(10,10,20,0.55);
}

.profile-tab-inactive:hover {
  background: rgba(10,10,20,0.05);
  color: rgba(10,10,20,0.85);
}

/* ─── Native dialog / modal centering (DaisyUI .modal pattern) ── */

/* Make the dialog itself transparent and properly sized */
dialog.modal {
  border: none;
  background: transparent;
  padding: 1rem;
  width: min(90vw, 32rem);
  overflow: visible;
  max-height: 100vh;
  /* Explicit centering — overrides browser UA top-left default */
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  margin: 0;
}

/* Browser native backdrop overlay */
dialog.modal::backdrop {
  background: rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

/* .modal-backdrop form: position it as an invisible full-screen layer */
/* behind the modal-box so clicking outside closes the dialog */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: -1;
  margin: 0;
}
.modal-backdrop button {
  position: fixed;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: default;
  padding: 0;
  border: none;
  background: transparent;
}

/* ─── Scrollable tabs (mobile) ───────────────────────────── */
.tabs-scrollable {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.tabs-scrollable::-webkit-scrollbar {
  display: none;
}
@media (max-width: 767px) {
  .tabs-scrollable {
    width: auto !important;
  }
}

/* ─── Filter bottom sheet (mobile) ───────────────────────── */
dialog.filter-sheet-modal {
  position: fixed;
  top: auto;
  bottom: 0;
  left: 0;
  right: 0;
  transform: none;
  width: 100%;
  max-width: 100%;
  padding: 0;
  margin: 0;
}
.filter-sheet-box {
  border-radius: 1rem 1rem 0 0;
  max-height: 85vh;
  animation: sheetSlideUp 0.25s ease-out;
}
@keyframes sheetSlideUp {
  from { transform: translateY(100%); }
  to   { transform: translateY(0); }
}
