/* ==========================================================================
   DigMeet Barcelona - Modern Glassmorphism, Dark/Light Mode & Sidebar System
   ========================================================================== */

:root {
  --bg-primary: #0a0e17;
  --bg-secondary: #121927;
  --bg-card: rgba(22, 31, 49, 0.75);
  --bg-sidebar: #0d1320;
  --sidebar-text: #94a3b8;
  --sidebar-text-active: #00d2ff;
  
  --accent-cyan: #00d2ff;
  --accent-blue: #3a7bd5;
  --accent-purple: #7f00ff;
  --accent-danger: #ff4757;
  --accent-success: #2ed573;
  --accent-warning: #ffa502;

  --text-main: #f1f5f9;
  --text-muted: #94a3b8;
  --border-color: rgba(255, 255, 255, 0.1);
  --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);

  --font-family: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 24px;
}

[data-theme="light"] {
  --bg-primary: #f8fafc;
  --bg-secondary: #ffffff;
  --bg-card: #ffffff;
  --bg-sidebar: #ffffff;
  --sidebar-text: #334155;
  --sidebar-text-active: #0284c7;
  
  --accent-cyan: #0284c7;
  --accent-purple: #7e22ce;

  --text-main: #0f172a;
  --text-muted: #475569;
  --border-color: #cbd5e1;
  --glass-shadow: 0 4px 20px 0 rgba(0, 0, 0, 0.06);
}

.timeline-session-box {
  background: rgba(15, 23, 42, 0.75);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 1.25rem;
  transition: all 0.2s ease;
}

.transcript-code-box {
  font-size: 0.85rem;
  color: var(--text-main);
  font-family: monospace;
  white-space: pre-wrap;
  background: rgba(0, 0, 0, 0.4);
  padding: 0.85rem;
  border-radius: 6px;
  line-height: 1.6;
  transition: all 0.3s ease;
}

.transcript-code-box.collapsed-preview {
  max-height: 76px;
  overflow: hidden;
  position: relative;
}

.transcript-code-box.collapsed-preview::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 40px;
  background: linear-gradient(180deg, rgba(15, 23, 42, 0) 0%, rgba(15, 23, 42, 0.95) 100%);
  pointer-events: none;
}

[data-theme="light"] .transcript-code-box.collapsed-preview::after {
  background: linear-gradient(180deg, rgba(241, 245, 249, 0) 0%, rgba(241, 245, 249, 0.98) 100%);
}

.transcript-code-box.expanded-full {
  max-height: 600px;
  overflow-y: auto;
}

.transcript-code-box.expanded-full::after {
  display: none;
}

.ai-summary-box {
  background: rgba(168, 85, 247, 0.12);
  border: 1px solid rgba(168, 85, 247, 0.35);
  border-radius: var(--radius-sm);
  padding: 0.9rem 1.1rem;
  font-size: 0.9rem;
  color: #e056fd;
  margin-bottom: 0.85rem;
  line-height: 1.5;
}

[data-theme="light"] .timeline-session-box {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.04);
}

[data-theme="light"] .transcript-code-box {
  background: #f1f5f9;
  color: #0f172a;
  border: 1px solid #cbd5e1;
}

[data-theme="light"] .ai-summary-box {
  background: #f3e8ff;
  border: 1px solid #d8b4fe;
  color: #6b21a8;
  font-weight: 600;
}

/* Calendar & Agenda Adaptive Classes */
.calendar-day-box {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-color);
  min-height: 70px;
  padding: 0.5rem;
  border-radius: var(--radius-sm);
  text-align: left;
}

.calendar-day-box.is-holiday {
  background: rgba(245, 158, 11, 0.18);
  border: 1px solid #f59e0b;
}

.calendar-day-box.has-app {
  background: rgba(16, 185, 129, 0.18);
  border: 1px solid #10b981;
}

[data-theme="light"] .calendar-day-box {
  background: #ffffff;
  border: 1px solid #cbd5e1;
}

[data-theme="light"] .calendar-day-box.is-holiday {
  background: #fef3c7;
  border: 1px solid #f59e0b;
}

[data-theme="light"] .calendar-day-box.has-app {
  background: #d1fae5;
  border: 1px solid #10b981;
}

.cal-text-holiday {
  color: #b45309;
  font-weight: 700;
}

.cal-text-app {
  color: #047857;
  font-weight: 700;
}

[data-theme="dark"] .cal-text-holiday {
  color: #ffeaa7;
}

[data-theme="dark"] .cal-text-app {
  color: #7bed9f;
}

/* Patient Details CRM Adaptive Classes */
.patient-profile-banner {
  padding: 1.5rem;
  margin-bottom: 1.75rem;
  border: 1px solid var(--accent-cyan);
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, rgba(0, 210, 255, 0.08), rgba(127, 0, 255, 0.08));
}

.patient-profile-banner span.label-muted {
  font-size: 0.8rem;
  color: var(--text-muted);
  display: block;
  font-weight: 600;
  margin-bottom: 0.2rem;
}

.patient-profile-banner span.val-highlight {
  color: #a855f7;
  font-weight: 700;
}

.appointment-item-box {
  background: rgba(15, 23, 42, 0.75);
  border: 1px solid var(--border-color);
  padding: 0.85rem 1rem;
  border-radius: var(--radius-sm);
  transition: all 0.2s ease;
}

.task-item-box {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(15, 23, 42, 0.6);
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  transition: all 0.2s ease;
}

[data-theme="light"] .patient-profile-banner {
  background: linear-gradient(135deg, #e0f2fe, #f3e8ff);
  border: 1px solid #7dd3fc;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.04);
}

[data-theme="light"] .patient-profile-banner span.val-highlight {
  color: #6b21a8;
  font-weight: 700;
}

[data-theme="light"] .appointment-item-box {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
}

[data-theme="light"] .task-item-box {
  background: #f8fafc;
  border: 1px solid #cbd5e1;
}

[data-theme="light"] .task-input-form-control {
  background: #ffffff !important;
  color: #0f172a !important;
  border: 1px solid #cbd5e1 !important;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

a {
  text-decoration: none;
}

body {
  background-color: var(--bg-primary);
  color: var(--text-main);
  font-family: var(--font-family);
  min-height: 100vh;
  overflow-x: hidden;
}

/* Overall App Sidebar Layout */
.app-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 100vh;
}

/* Left Vertical Sidebar (GetDigDesk Style) */
.app-sidebar {
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 1.5rem 1rem;
  color: var(--text-main);
  position: sticky;
  top: 0;
  height: 100vh;
  transition: background-color 0.25s ease, border-color 0.25s ease;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--text-main);
  text-decoration: none;
  margin-bottom: 2rem;
  padding: 0 0.5rem;
}

.sidebar-brand span.highlight {
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-blue));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  flex: 1;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  color: var(--sidebar-text);
  font-weight: 600;
  font-size: 0.95rem;
  text-decoration: none !important;
  transition: all 0.2s ease;
}

.sidebar-link:hover {
  background: rgba(0, 210, 255, 0.08);
  color: var(--text-main);
}

.sidebar-link.active {
  background: linear-gradient(135deg, rgba(0, 210, 255, 0.15), rgba(58, 123, 213, 0.2));
  border: 1px solid var(--accent-cyan);
  color: var(--sidebar-text-active) !important;
  box-shadow: 0 4px 15px rgba(0, 210, 255, 0.2);
}

.sidebar-footer {
  border-top: 1px solid var(--border-color);
  padding-top: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

/* Content Area */
.app-main-content {
  padding: 2rem;
  max-width: 1300px;
}

/* Header & Badges */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 2rem;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text-main);
  text-decoration: none !important;
}

.brand-logo span.highlight {
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-blue));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.badge-group {
  display: flex;
  gap: 0.75rem;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8rem;
  padding: 0.4rem 0.8rem;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
}

.badge.bcn {
  border-color: rgba(255, 165, 2, 0.3);
  color: #ffeaa7;
}

.badge.gdpr {
  border-color: rgba(46, 213, 115, 0.3);
  color: #7bed9f;
}

[data-theme="light"] .badge {
  background: rgba(0, 0, 0, 0.05);
  border-color: #cbd5e1;
  color: #334155;
  font-weight: 600;
}

[data-theme="light"] .badge.bcn {
  background: rgba(217, 119, 6, 0.12);
  border-color: rgba(217, 119, 6, 0.4);
  color: #92400e;
  font-weight: 700;
}

[data-theme="light"] .badge.gdpr {
  background: rgba(16, 185, 129, 0.12);
  border-color: rgba(16, 185, 129, 0.4);
  color: #065f46;
  font-weight: 700;
}

/* Hero Container */
.hero-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 3.5rem 1.5rem;
  max-width: 1240px;
  width: 95%;
  margin: 0 auto;
}

.hero-title {
  font-size: 3rem;
  font-weight: 800;
  line-height: 1.2;
  margin-bottom: 1rem;
}

.hero-subtitle {
  font-size: 1.2rem;
  color: var(--text-muted);
  margin-bottom: 2.5rem;
  max-width: 650px;
}

.action-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.5rem;
  width: 100%;
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 2rem;
  box-shadow: var(--glass-shadow);
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.card:hover {
  transform: translateY(-4px);
  border-color: var(--accent-cyan);
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  text-align: left;
  margin-bottom: 1.25rem;
}

.form-group label {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.form-input {
  width: 100%;
  padding: 0.8rem 1rem;
  border-radius: var(--radius-sm);
  background: rgba(0, 0, 0, 0.15);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  font-size: 1rem;
  outline: none;
  transition: border-color 0.2s;
}

.form-input:focus {
  border-color: var(--accent-cyan);
}

/* Select Dropdown Contrast System */
select.form-input {
  background-color: #121927;
  color: var(--text-main);
  cursor: pointer;
}

select.form-input option {
  background-color: #0f172a;
  color: #f8fafc;
  padding: 0.5rem;
}

[data-theme="light"] select.form-input {
  background-color: #ffffff;
  color: #0f172a;
}

[data-theme="light"] select.form-input option {
  background-color: #ffffff;
  color: #0f172a;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.85rem 1.5rem;
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  text-decoration: none !important;
  transition: all 0.2s ease;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-blue));
  color: #fff;
  box-shadow: 0 4px 15px rgba(0, 210, 255, 0.3);
}

.btn-primary:hover {
  opacity: 0.95;
  box-shadow: 0 6px 20px rgba(0, 210, 255, 0.45);
}

.btn-danger {
  background: var(--accent-danger);
  color: #fff;
}

.btn-digdesk {
  background: linear-gradient(135deg, #f0932b, #eb4d4b);
  color: #fff;
}

.btn-plan-basic {
  background: rgba(0, 210, 255, 0.15);
  border: 1px solid var(--accent-cyan);
  color: var(--accent-cyan) !important;
  font-weight: 700;
}

.btn-plan-basic:hover {
  background: rgba(0, 210, 255, 0.25);
  color: #ffffff !important;
}

.btn-plan-clinic {
  background: rgba(127, 0, 255, 0.15);
  border: 1px solid var(--accent-purple);
  color: #a855f7 !important;
  font-weight: 700;
}

.btn-plan-clinic:hover {
  background: rgba(127, 0, 255, 0.25);
  color: #ffffff !important;
}

[data-theme="light"] .btn-plan-basic {
  background: #e0f2fe;
  border: 1px solid #0284c7;
  color: #0284c7 !important;
  font-weight: 700;
}

[data-theme="light"] .btn-plan-basic:hover {
  background: #0284c7;
  color: #ffffff !important;
}

[data-theme="light"] .btn-plan-clinic {
  background: #f3e8ff;
  border: 1px solid #7e22ce;
  color: #7e22ce !important;
  font-weight: 700;
}

[data-theme="light"] .btn-plan-clinic:hover {
  background: #7e22ce;
  color: #ffffff !important;
}

/* Meeting Room View Layout Fix */
.room-container {
  display: grid;
  grid-template-columns: 1fr 340px;
  height: calc(100vh - 65px);
  padding: 0.85rem 1rem;
  gap: 1rem;
  box-sizing: border-box;
  overflow: hidden;
  position: relative;
  background: var(--bg-main);
  transition: grid-template-columns 0.3s ease;
}

.room-container.chat-collapsed {
  grid-template-columns: 1fr 0px;
  gap: 0;
}

.video-section {
  display: flex;
  flex-direction: column;
  position: relative;
  background: #090d16;
  padding: 1rem;
  height: 100%;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  box-shadow: 0 10px 30px rgba(0,0,0,0.4);
  overflow: hidden;
}

.video-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1rem;
  flex: 1;
  width: 100%;
  height: 100%;
  align-content: center;
  justify-content: center;
}

.video-tile {
  position: relative;
  background: #111827;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 2px solid rgba(0, 210, 255, 0.3);
  box-shadow: 0 12px 35px rgba(0,0,0,0.5);
  max-width: 96%;
  max-height: 82vh;
  margin: auto;
  aspect-ratio: 16 / 9;
  display: flex;
  align-items: center;
  justify-content: center;
}

.video-tile video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.controls-bar {
  position: absolute;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 0.75rem;
  background: rgba(15, 23, 38, 0.85);
  padding: 0.75rem 1.25rem;
  border-radius: 40px;
  border: 1px solid var(--border-color);
  backdrop-filter: blur(16px);
  z-index: 100;
}

.control-btn {
  width: 46px;
  height: 46px;
  min-width: 46px;
  min-height: 46px;
  flex-shrink: 0;
  border-radius: 50%;
  border: 1px solid var(--border-color);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.control-btn.btn-digdesk {
  width: auto;
  min-width: max-content;
  border-radius: 24px;
}

.sidebar-panel {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: 0 10px 30px rgba(0,0,0,0.4);
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  transition: opacity 0.2s ease;
}

.sidebar-panel.hidden,
.room-container.chat-collapsed .sidebar-panel {
  display: none !important;
  opacity: 0;
  pointer-events: none;
}

.sidebar-header {
  padding: 1rem;
  border-bottom: 1px solid var(--border-color);
  font-weight: 600;
}

.chat-messages {
  flex: 1;
  padding: 1rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.chat-bubble {
  background: rgba(255, 255, 255, 0.05);
  border-radius: var(--radius-sm);
  padding: 0.6rem 0.85rem;
  font-size: 0.9rem;
}

.chat-input-area {
  padding: 1rem 1rem 1.25rem 1rem;
  margin-bottom: 0.4rem;
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--bg-secondary);
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  z-index: 200;
}

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

.modal-content {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.75rem;
  max-width: 500px;
  width: 90%;
  max-height: 88vh;
  overflow-y: auto;
  box-shadow: var(--glass-shadow);
  position: relative;
}

/* ==========================================================================
   Mobile Responsive System (@media max-width: 900px & 768px)
   ========================================================================== */

/* Mobile Navigation Header bar for SaaS Panel & Client Portal */
.mobile-top-bar {
  display: none;
  height: 56px;
  background: var(--bg-sidebar);
  border-bottom: 1px solid var(--border-color);
  padding: 0 1rem;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 150;
}

.mobile-nav-toggle {
  background: none;
  border: none;
  color: var(--text-main);
  font-size: 1.4rem;
  cursor: pointer;
  padding: 0.25rem 0.5rem;
  border-radius: 6px;
}

.mobile-nav-toggle:hover {
  background: rgba(255, 255, 255, 0.1);
}

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

.sidebar-backdrop.active {
  display: block;
}

@media (max-width: 900px) {
  .mobile-top-bar {
    display: flex;
  }

  .app-layout {
    display: block !important;
    width: 100% !important;
  }

  .app-main-content {
    width: 100% !important;
    margin-left: 0 !important;
    padding: 1rem !important;
  }

  .app-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 280px;
    z-index: 180;
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 10px 0 30px rgba(0, 0, 0, 0.5);
  }

  .app-sidebar.open {
    transform: translateX(0);
  }

  .main-content {
    margin-left: 0 !important;
    padding: 1rem !important;
    width: 100% !important;
  }

  /* Grid layout responsive collapses */
  .grid-2, .grid-3, .grid-4, .stats-grid, .wizard-grid {
    grid-template-columns: 1fr !important;
  }

  .table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .card {
    padding: 1.1rem !important;
  }
}

@media (max-width: 768px) {
  /* Video Room Mobile Optimizations */
  .room-container {
    display: flex !important;
    flex-direction: column !important;
    overflow-y: auto !important;
    height: calc(100vh - 60px) !important;
  }

  .video-section {
    position: relative !important;
    flex: none !important;
    height: 46vh !important;
    min-height: 250px !important;
    width: 100% !important;
  }

  .sidebar-panel#chatPanel {
    width: 100% !important;
    max-width: 100% !important;
    height: auto !important;
    flex: 1 !important;
    min-height: 280px !important;
  }

  .controls-bar {
    position: absolute !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    bottom: 0.75rem !important;
    width: 92vw !important;
    max-width: 92vw !important;
    overflow-x: auto !important;
    justify-content: flex-start !important;
    padding: 0.4rem 0.65rem !important;
    gap: 0.5rem !important;
    border-radius: 30px !important;
    -webkit-overflow-scrolling: touch;
  }

  .controls-bar::-webkit-scrollbar {
    display: none;
  }

  .control-btn {
    flex-shrink: 0 !important;
    width: 44px !important;
    height: 44px !important;
  }

  #subtitlesBanner {
    bottom: 5.5rem !important;
    max-width: 92% !important;
    font-size: 0.88rem !important;
    padding: 0.5rem 0.85rem !important;
  }

  .app-header {
    padding: 0.5rem 0.75rem !important;
    flex-wrap: wrap !important;
    gap: 0.4rem !important;
  }

  .badge.bcn, .mobile-hide-badge {
    display: none !important;
  }
}
