/* ==========================================================================
   University of Rio Grande - Student Hub Stylesheet
   Modern, Mobile-First PWA Styling
   ========================================================================== */

/* Design Tokens & Theme Variables */
:root {
  --primary: #B5121B;          /* Official Rio Red */
  --primary-dark: #8C0D14;     /* Deep Red */
  --primary-light: #FEF2F2;    /* Soft Red Tint */
  --primary-glow: rgba(181, 18, 27, 0.18);

  --accent-gold: #F59E0B;      /* Star / Favorite */
  --accent-emerald: #059669;
  --accent-sky: #0284C7;
  --accent-purple: #7C3AED;

  /* Light Theme Defaults */
  --bg-page: #E5E7EB;          /* Backdrop behind phone frame on desktop */
  --bg-app: #FFFFFF;           /* App surface */
  --bg-card: #FFFFFF;
  --bg-card-hover: #F9FAFB;
  --bg-card-subtle: #F3F4F6;
  --bg-input: #F3F4F6;
  --bg-input-focus: #FFFFFF;
  
  --border-subtle: #E5E7EB;
  --border-card: #E5E7EB;
  
  --text-main: #111827;
  --text-sub: #374151;
  --text-muted: #6B7280;
  
  --nav-bg: rgba(255, 255, 255, 0.94);
  --header-bg: rgba(255, 255, 255, 0.96);
  --glass-border: rgba(229, 231, 235, 0.8);
  
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.07);
  --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.1);
  --shadow-active: 0 2px 6px rgba(181, 18, 27, 0.2);

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-pill: 9999px;

  --trans-fast: 0.15s ease;
  --trans-normal: 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Dark Theme Overrides */
[data-theme="dark"] {
  --primary: #D32F2F;
  --primary-dark: #9A0007;
  --primary-light: #2A1114;
  --primary-glow: rgba(211, 47, 47, 0.25);

  --bg-page: #0B0F19;
  --bg-app: #111827;
  --bg-card: #1F2937;
  --bg-card-hover: #263345;
  --bg-card-subtle: #192231;
  --bg-input: #1F2937;
  --bg-input-focus: #192231;

  --border-subtle: #374151;
  --border-card: #2D3748;

  --text-main: #F9FAFB;
  --text-sub: #E5E7EB;
  --text-muted: #9CA3AF;

  --nav-bg: rgba(17, 24, 39, 0.94);
  --header-bg: rgba(17, 24, 39, 0.96);
  --glass-border: rgba(55, 65, 81, 0.8);

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.5);
}

/* Reset & Global */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  width: 100%;
  height: 100%;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background-color: var(--bg-page);
  color: var(--text-main);
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
}

/* Mobile Frame Wrapper */
.mobile-frame {
  width: 100%;
  height: 100%;
  max-width: 480px;
  background-color: var(--bg-app);
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.15);
}

@media (min-width: 481px) {
  .mobile-frame {
    height: 94vh;
    max-height: 920px;
    border-radius: 36px;
    border: 8px solid #1E293B;
  }
}

/* Top App Bar */
.app-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 18px;
  padding-top: calc(12px + env(safe-area-inset-top));
  background-color: var(--header-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-subtle);
  z-index: 40;
  flex-shrink: 0;
}

.topbar-branding {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-crest {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  background-color: var(--primary-light);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 4px;
}

.brand-logo-svg {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.brand-titles {
  display: flex;
  flex-direction: column;
}

.brand-college {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--primary);
  line-height: 1.1;
}

.brand-hub-name {
  font-size: 16px;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.3px;
  line-height: 1.2;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.icon-btn {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-subtle);
  background: var(--bg-card-subtle);
  color: var(--text-main);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--trans-fast);
}

.icon-btn:hover {
  background: var(--border-subtle);
}

.icon-btn.emergency {
  background: var(--primary-light);
  border-color: rgba(181, 18, 27, 0.2);
  color: var(--primary);
}

.icon-btn.emergency:active {
  transform: scale(0.92);
}

.icon {
  width: 20px;
  height: 20px;
}

/* PWA Install Banner */
.install-banner {
  display: none;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: #FFFFFF;
  font-size: 13px;
  z-index: 35;
  animation: slideDown 0.3s ease-out;
}

.install-banner.visible {
  display: flex;
}

.install-banner-text {
  display: flex;
  flex-direction: column;
}

.install-banner-text strong {
  font-weight: 700;
}

.install-banner-text span {
  font-size: 11px;
  opacity: 0.9;
}

.install-banner-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.install-btn {
  background: #FFFFFF;
  color: var(--primary);
  border: none;
  font-weight: 700;
  font-size: 12px;
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  cursor: pointer;
}

.dismiss-btn {
  background: none;
  border: none;
  color: #FFFFFF;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  padding: 4px;
}

/* Search Section */
.search-section {
  padding: 12px 16px 8px 16px;
  background-color: var(--bg-app);
  z-index: 30;
  flex-shrink: 0;
}

.search-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.search-icon {
  position: absolute;
  left: 14px;
  width: 18px;
  height: 18px;
  color: var(--text-muted);
  pointer-events: none;
}

.search-input {
  width: 100%;
  height: 44px;
  padding: 0 40px 0 42px;
  background-color: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-pill);
  font-size: 14px;
  color: var(--text-main);
  outline: none;
  transition: all var(--trans-fast);
}

.search-input:focus {
  background-color: var(--bg-input-focus);
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.search-clear-btn {
  position: absolute;
  right: 12px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: none;
  background: var(--text-muted);
  color: var(--bg-app);
  display: none;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 4px;
}

.search-clear-btn.visible {
  display: flex;
}

/* Category Filter Pills Bar */
.category-pills-bar {
  display: flex;
  gap: 8px;
  padding: 6px 16px 12px 16px;
  overflow-x: auto;
  white-space: nowrap;
  background-color: var(--bg-app);
  border-bottom: 1px solid var(--border-subtle);
  scrollbar-width: none;
  -ms-overflow-style: none;
  flex-shrink: 0;
}

.category-pills-bar::-webkit-scrollbar {
  display: none;
}

.pill-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-subtle);
  background: var(--bg-card);
  color: var(--text-sub);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--trans-fast);
  flex-shrink: 0;
}

.pill-icon {
  width: 15px;
  height: 15px;
}

.pill-btn:hover {
  background: var(--bg-card-subtle);
  border-color: var(--text-muted);
}

.pill-btn.active {
  background-color: var(--primary);
  color: #FFFFFF;
  border-color: var(--primary);
  box-shadow: 0 2px 8px var(--primary-glow);
}

.pill-btn.active .pill-icon {
  stroke: #FFFFFF;
}

/* Main Scrollable Content Area */
.main-scroll-area {
  flex: 1;
  overflow-y: auto;
  padding: 16px 16px calc(80px + env(safe-area-inset-bottom)) 16px;
  -webkit-overflow-scrolling: touch;
}

/* Weather & Class Cancellations Alert Card */
.weather-alert-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: linear-gradient(135deg, #FFFBEB 0%, #FEF3C7 100%);
  border: 1px solid #FCD34D;
  border-radius: var(--radius-md);
  margin-bottom: 20px;
  cursor: pointer;
  transition: transform var(--trans-fast), box-shadow var(--trans-fast);
}

[data-theme="dark"] .weather-alert-card {
  background: linear-gradient(135deg, #2D2305 0%, #3B2E07 100%);
  border-color: #78350F;
}

.weather-alert-card:active {
  transform: scale(0.98);
}

.alert-icon-box {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background-color: #F59E0B;
  color: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.alert-icon-box svg {
  width: 22px;
  height: 22px;
}

.alert-info {
  flex: 1;
}

.alert-tag {
  display: inline-block;
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: #B45309;
  margin-bottom: 2px;
}

[data-theme="dark"] .alert-tag {
  color: #FBBF24;
}

.alert-info h4 {
  font-size: 14px;
  font-weight: 700;
  color: #78350F;
  line-height: 1.2;
}

[data-theme="dark"] .alert-info h4 {
  color: #FDE68A;
}

.alert-info p {
  font-size: 12px;
  color: #92400E;
  margin-top: 2px;
}

[data-theme="dark"] .alert-info p {
  color: #FCD34D;
}

.alert-arrow {
  color: #B45309;
}

.alert-arrow svg {
  width: 18px;
  height: 18px;
}

/* Section Groups */
.section-group {
  margin-bottom: 24px;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.section-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 8px;
}

.section-bullet {
  width: 6px;
  height: 16px;
  border-radius: 4px;
  background-color: var(--border-subtle);
}

.section-bullet.red {
  background-color: var(--primary);
}

.star-icon-yellow {
  color: var(--accent-gold);
  display: inline-flex;
}

.star-icon-yellow svg {
  width: 18px;
  height: 18px;
}

.section-count {
  font-size: 12px;
  font-weight: 700;
  background: var(--bg-card-subtle);
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  color: var(--text-muted);
}

.section-badge-desc {
  font-size: 12px;
  font-weight: 600;
  color: var(--primary);
}

.section-view-more {
  background: none;
  border: none;
  color: var(--primary);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  padding: 4px 6px;
}

/* Favorites Grid */
.favorites-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.quick-fav-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: all var(--trans-fast);
}

.quick-fav-card:active {
  transform: scale(0.97);
  background-color: var(--bg-card-hover);
}

.quick-fav-icon {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: var(--bg-card-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.quick-fav-icon svg {
  width: 18px;
  height: 18px;
}

.quick-fav-text {
  flex: 1;
  min-width: 0;
}

.quick-fav-title {
  display: block;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.quick-fav-sub {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
}

.quick-fav-arrow {
  color: var(--text-muted);
}

.quick-fav-arrow svg {
  width: 14px;
  height: 14px;
}

/* Hero Portals Grid */
.hero-portals-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.hero-portal-card {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  padding: 18px;
  box-shadow: var(--shadow-md);
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: transform var(--trans-fast), box-shadow var(--trans-fast);
}

.hero-portal-card:hover {
  box-shadow: var(--shadow-lg);
}

.hero-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.hero-icon-box {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.hero-icon-box svg {
  width: 26px;
  height: 26px;
}

.hero-top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-badge {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 3px 8px;
  background-color: var(--bg-card-subtle);
  color: var(--text-sub);
  border-radius: var(--radius-pill);
}

.fav-star-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 6px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform var(--trans-fast), color var(--trans-fast);
}

.fav-star-btn svg {
  width: 20px;
  height: 20px;
}

.fav-star-btn:active {
  transform: scale(1.3);
}

.fav-star-btn.active {
  color: var(--accent-gold);
}

.hero-card-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.2px;
}

.hero-card-desc {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.45;
  margin-top: 4px;
}

.hero-card-footer {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
}

.btn-open-tile {
  flex: 1;
  height: 44px;
  background: var(--primary);
  color: #FFFFFF;
  border: none;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  box-shadow: 0 4px 12px var(--primary-glow);
  transition: all var(--trans-fast);
}

.btn-open-tile:active {
  transform: scale(0.97);
  background: var(--primary-dark);
}

.btn-icon {
  width: 16px;
  height: 16px;
}

.btn-more-options {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  background: var(--bg-card-subtle);
  color: var(--text-sub);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background var(--trans-fast);
}

.btn-more-options:hover {
  background: var(--border-subtle);
}

.btn-more-options svg {
  width: 18px;
  height: 18px;
}

/* Links List Rows */
.links-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.link-row-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  transition: all var(--trans-fast);
}

.link-row-card:hover {
  background: var(--bg-card-hover);
}

.row-icon-box {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: var(--bg-card-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.row-icon-box svg {
  width: 20px;
  height: 20px;
}

.row-main-content {
  flex: 1;
  min-width: 0;
  cursor: pointer;
}

.row-title-line {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.row-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.25;
}

.row-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: var(--radius-pill);
  background: var(--bg-card-subtle);
  color: var(--text-muted);
}

.row-desc {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.35;
  margin-top: 2px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.row-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.row-launch-btn {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: none;
  background: var(--bg-card-subtle);
  color: var(--text-sub);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--trans-fast);
}

.row-launch-btn:hover {
  background: var(--primary);
  color: #FFFFFF;
}

.row-launch-btn svg {
  width: 15px;
  height: 15px;
}

/* Bookstore & Financial Aid Callout Banner */
.bookstore-banner {
  background: linear-gradient(135deg, #1E293B 0%, #0F172A 100%);
  color: #FFFFFF;
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-md);
  position: relative;
  overflow: hidden;
}

.bookstore-banner::after {
  content: '';
  position: absolute;
  top: -50px;
  right: -50px;
  width: 120px;
  height: 120px;
  background: radial-gradient(circle, rgba(181, 18, 27, 0.4) 0%, transparent 70%);
  border-radius: 50%;
  pointer-events: none;
}

.bookstore-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  padding: 3px 8px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-pill);
  margin-bottom: 8px;
}

.bookstore-banner h3 {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 6px;
}

.bookstore-banner p {
  font-size: 13px;
  color: #CBD5E1;
  line-height: 1.4;
  margin-bottom: 14px;
}

.banner-actions {
  display: flex;
  gap: 10px;
}

.banner-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 14px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--trans-fast);
  border: none;
}

.banner-btn.primary {
  background: var(--primary);
  color: #FFFFFF;
}

.banner-btn.primary:active {
  background: var(--primary-dark);
}

.banner-btn.secondary {
  background: rgba(255, 255, 255, 0.15);
  color: #FFFFFF;
}

.banner-btn.secondary:hover {
  background: rgba(255, 255, 255, 0.25);
}

.inline-icon {
  width: 14px;
  height: 14px;
}

/* Empty States */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.empty-icon {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--bg-card-subtle);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
}

.empty-icon svg {
  width: 30px;
  height: 30px;
}

.empty-state h3 {
  font-size: 17px;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 6px;
}

.empty-state p {
  font-size: 14px;
  color: var(--text-muted);
  max-width: 320px;
  margin-bottom: 20px;
  line-height: 1.4;
}

.btn-action-primary {
  background: var(--primary);
  color: #FFFFFF;
  border: none;
  border-radius: var(--radius-pill);
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.clear-search-pill {
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-subtle);
  color: var(--text-sub);
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  cursor: pointer;
}

/* App Footer */
.app-footer {
  margin-top: 30px;
  padding: 20px 0;
  text-align: center;
  border-top: 1px solid var(--border-subtle);
}

.footer-university {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-sub);
}

.footer-note {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
}

.footer-note a {
  color: var(--primary);
  text-decoration: none;
}

.footer-copy {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 8px;
}

.footer-copy a {
  color: var(--primary);
  text-decoration: underline;
}

/* Bottom Tab Navigation Bar */
.bottom-nav-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: calc(64px + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--nav-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-around;
  z-index: 50;
}

.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  height: 100%;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  transition: color var(--trans-fast);
}

.nav-icon {
  width: 22px;
  height: 22px;
}

.nav-label {
  font-size: 11px;
  font-weight: 600;
}

.nav-item.active {
  color: var(--primary);
}

.nav-item.active .nav-icon {
  stroke: var(--primary);
}

/* Modals & Bottom Sheets */
.modal-backdrop, .sheet-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.modal-backdrop.visible, .sheet-backdrop.visible {
  opacity: 1;
  pointer-events: auto;
}

.modal-card, .sheet-card {
  width: 100%;
  max-height: 85%;
  background: var(--bg-card);
  border-radius: 24px 24px 0 0;
  padding: 24px;
  padding-bottom: calc(24px + env(safe-area-inset-bottom));
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  overflow-y: auto;
}

.modal-backdrop.visible .modal-card,
.sheet-backdrop.visible .sheet-card {
  transform: translateY(0);
}

.modal-header, .sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.modal-header h3 {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-main);
}

.modal-close-icon, .sheet-close-btn {
  background: none;
  border: none;
  font-size: 28px;
  color: var(--text-muted);
  cursor: pointer;
  line-height: 1;
  padding: 4px;
}

.modal-desc {
  font-size: 14px;
  color: var(--text-sub);
  line-height: 1.5;
  margin-bottom: 14px;
}

.modal-url-box {
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  margin-bottom: 20px;
  overflow-x: auto;
}

.modal-url-box code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12px;
  color: var(--primary);
  word-break: break-all;
}

.modal-footer-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.modal-btn {
  width: 100%;
  height: 46px;
  border-radius: var(--radius-md);
  border: none;
  font-size: 14px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  transition: all var(--trans-fast);
}

.modal-btn.primary {
  background: var(--primary);
  color: #FFFFFF;
  box-shadow: 0 4px 12px var(--primary-glow);
}

.modal-secondary-row {
  display: flex;
  gap: 10px;
}

.modal-btn.secondary {
  flex: 1;
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
}

.modal-fav-toggle-btn {
  width: 100%;
  padding: 10px;
  background: none;
  border: 1px dashed var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-sub);
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  margin-top: 4px;
}

/* Emergency Sheet Styles */
.sheet-title-group {
  display: flex;
  align-items: center;
  gap: 12px;
}

.sheet-icon-red {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--primary-light);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.sheet-icon-red svg {
  width: 22px;
  height: 22px;
}

.sheet-title-group h3 {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-main);
}

.sheet-title-group p {
  font-size: 12px;
  color: var(--text-muted);
}

.sheet-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.help-contact-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px;
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
}

.help-item-info h4 {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-main);
}

.help-item-info p {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.4;
  margin-top: 2px;
}

.contact-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 14px;
  border-radius: var(--radius-pill);
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  border: none;
  white-space: nowrap;
}

.contact-action-btn.email {
  background: var(--primary);
  color: #FFFFFF;
}

.contact-action-btn.call {
  background: #0284C7;
  color: #FFFFFF;
}

.contact-action-btn.neutral {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
}

/* Toast Notifications */
.toast {
  position: absolute;
  bottom: calc(76px + env(safe-area-inset-bottom));
  left: 16px;
  right: 16px;
  background: #1E293B;
  color: #F8FAFC;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
  z-index: 90;
  opacity: 0;
  transform: translateY(20px);
  pointer-events: none;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.toast-btn {
  background: var(--primary);
  color: #FFFFFF;
  border: none;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.toast-btn.hidden {
  display: none;
}

/* Keyframes */
@keyframes slideDown {
  from {
    transform: translateY(-100%);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}
