/* ==========================================================================
   DigMeet Barcelona - Mobile Application Style System (iOS & Android)
   ========================================================================== */

:root {
  --bg-main: #0a0e17;
  --bg-secondary: #121927;
  --bg-card: rgba(22, 31, 49, 0.85);
  --bg-glass: rgba(18, 25, 39, 0.7);
  
  --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.12);
  --glass-shadow: 0 10px 30px 0 rgba(0, 0, 0, 0.45);

  --font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 24px;

  --sat: env(safe-area-inset-top, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
  --sal: env(safe-area-inset-left, 0px);
  --sar: env(safe-area-inset-right, 0px);
}

[data-theme="light"] {
  --bg-main: #f8fafc;
  --bg-secondary: #ffffff;
  --bg-card: rgba(255, 255, 255, 0.95);
  --bg-glass: rgba(241, 245, 249, 0.85);
  
  --accent-cyan: #0284c7;
  --accent-purple: #7e22ce;

  --text-main: #0f172a;
  --text-muted: #64748b;
  --border-color: #cbd5e1;
  --glass-shadow: 0 8px 25px 0 rgba(0, 0, 0, 0.08);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

input, textarea, button, select {
  user-select: auto;
  font-family: inherit;
}

body {
  background-color: var(--bg-main);
  color: var(--text-main);
  font-family: var(--font-family);
  min-height: 100vh;
  min-height: -webkit-fill-available;
  overflow-x: hidden;
  padding-top: var(--sat);
  padding-bottom: var(--sab);
  padding-left: var(--sal);
  padding-right: var(--sar);
  display: flex;
  flex-direction: column;
}

/* Responsive Dark / Light Logo switching */
.digmeet-logo-dark {
  display: inline-block !important;
}
.digmeet-logo-light {
  display: none !important;
}
[data-theme="light"] .digmeet-logo-dark {
  display: none !important;
}
[data-theme="light"] .digmeet-logo-light {
  display: inline-block !important;
}

/* App Header */
.mobile-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.85rem 1.25rem;
  background: var(--bg-glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 100;
}

.brand-wrapper {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.icon-btn {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

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

/* Tabs Navigation */
.mobile-tabs {
  display: flex;
  margin: 1.25rem 1.25rem 0.5rem 1.25rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 4px;
}

.tab-btn {
  flex: 1;
  padding: 0.65rem 0.75rem;
  font-size: 0.85rem;
  font-weight: 700;
  text-align: center;
  background: transparent;
  color: var(--text-muted);
  border: none;
  border-radius: 9px;
  cursor: pointer;
  transition: all 0.25s ease;
}

.tab-btn.active {
  background: var(--accent-cyan);
  color: #0b0f19;
  box-shadow: 0 4px 12px rgba(0, 210, 255, 0.35);
}

[data-theme="light"] .tab-btn.active {
  background: #0284c7;
  color: #ffffff;
}

/* Container Views */
.view-container {
  flex: 1;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  max-width: 520px;
  margin: 0 auto;
  width: 100%;
}

.card-box {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  box-shadow: var(--glass-shadow);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  margin-bottom: 1.25rem;
}

.form-group {
  margin-bottom: 1.2rem;
}

.form-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 0.45rem;
}

.form-input {
  width: 100%;
  padding: 0.85rem 1rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  font-size: 1rem;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-input:focus {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 0 3px rgba(0, 210, 255, 0.2);
}

.room-input {
  font-size: 1.4rem;
  font-weight: 800;
  text-align: center;
  letter-spacing: 3px;
  text-transform: lowercase;
  color: var(--accent-cyan);
}

/* Buttons */
.btn-main {
  width: 100%;
  padding: 0.95rem 1.25rem;
  font-size: 1.05rem;
  font-weight: 800;
  border-radius: 14px;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  background: linear-gradient(135deg, #00d2ff, #3a7bd5);
  color: #0a0e17;
  box-shadow: 0 8px 25px rgba(0, 210, 255, 0.4);
  transition: all 0.2s ease;
}

[data-theme="light"] .btn-main {
  color: #ffffff;
  background: linear-gradient(135deg, #0284c7, #2563eb);
}

.btn-main:active {
  transform: scale(0.97);
}

.btn-secondary {
  width: 100%;
  padding: 0.75rem 1rem;
  font-size: 0.9rem;
  font-weight: 700;
  border-radius: 12px;
  border: 1px solid var(--border-color);
  background: var(--bg-secondary);
  color: var(--text-main);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 0.75rem;
  transition: all 0.2s ease;
}

[data-theme="light"] .btn-secondary {
  background: #ffffff;
  border-color: #cbd5e1;
  color: #0f172a;
}

/* Download Cards & App Hub (Adaptive Dark / Light) */
.download-card {
  background: rgba(15, 23, 42, 0.65);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 1.25rem;
  margin-bottom: 1rem;
  transition: all 0.25s ease;
}

[data-theme="light"] .download-card {
  background: #ffffff;
  border-color: #e2e8f0;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.05);
}

.download-card.card-android {
  border-color: rgba(46, 213, 115, 0.4);
}
[data-theme="light"] .download-card.card-android {
  border-color: rgba(22, 163, 74, 0.35);
}

.download-card.card-ios {
  border-color: rgba(0, 210, 255, 0.4);
}
[data-theme="light"] .download-card.card-ios {
  border-color: rgba(2, 132, 199, 0.35);
}

.badge-soon {
  display: inline-block;
  padding: 0.22rem 0.65rem;
  font-size: 0.72rem;
  font-weight: 800;
  border-radius: 20px;
}

.badge-soon.badge-android {
  background: rgba(46, 213, 115, 0.15);
  color: #2ed573;
  border: 1px solid #2ed573;
}
[data-theme="light"] .badge-soon.badge-android {
  background: rgba(22, 163, 74, 0.12);
  color: #15803d;
  border-color: #16a34a;
}

.badge-soon.badge-ios {
  background: rgba(0, 210, 255, 0.15);
  color: var(--accent-cyan);
  border: 1px solid var(--accent-cyan);
}
[data-theme="light"] .badge-soon.badge-ios {
  background: rgba(2, 132, 199, 0.12);
  color: #0284c7;
  border-color: #0284c7;
}

.instruction-box {
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 0.75rem 0.95rem;
  border-radius: 10px;
  font-size: 0.8rem;
  color: var(--text-main);
  line-height: 1.55;
}
[data-theme="light"] .instruction-box {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  color: #1e293b;
}

.btn-download-apk {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.75rem 1rem;
  border-radius: 12px;
  font-size: 0.9rem;
  font-weight: 800;
  text-decoration: none;
  background: rgba(46, 213, 115, 0.15);
  color: #2ed573;
  border: 1px solid #2ed573;
  transition: all 0.2s ease;
}
[data-theme="light"] .btn-download-apk {
  background: rgba(22, 163, 74, 0.12);
  color: #15803d;
  border-color: #16a34a;
}
.btn-download-apk:hover {
  transform: translateY(-2px);
  filter: brightness(1.1);
}

/* AV Preview Box */
.av-preview-container {
  position: relative;
  width: 100%;
  height: 180px;
  background: #000;
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 1.25rem;
  border: 1px solid var(--border-color);
}

.av-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scaleX(-1); /* Mirror self preview */
}

.av-overlay-controls {
  position: absolute;
  bottom: 10px;
  left: 0;
  right: 0;
  display: flex;
  justify-content: center;
  gap: 0.75rem;
}

.av-chip-btn {
  background: rgba(15, 23, 42, 0.75);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  padding: 0.35rem 0.75rem;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
}

.av-chip-btn.muted {
  background: rgba(255, 71, 87, 0.85);
  border-color: #ff4757;
}

/* In-Call Fullscreen Overlay */
.call-fullscreen-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: #000;
  z-index: 9999;
  display: none;
  flex-direction: column;
}

.call-fullscreen-overlay.active {
  display: flex;
}

.call-iframe {
  width: 100%;
  height: 100%;
  border: none;
  flex: 1;
}

.call-floating-bar {
  position: absolute;
  bottom: calc(var(--sab) + 1.25rem);
  left: 50%;
  transform: translateX(-50%);
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  padding: 0.6rem 1rem;
  border-radius: 35px;
  display: flex;
  align-items: center;
  gap: 1rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
  z-index: 10000;
}

.call-btn-circle {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  transition: all 0.2s ease;
}

.call-btn-circle:active {
  transform: scale(0.9);
}

.call-btn-circle.hangup {
  background: #ff4757;
  color: #fff;
  box-shadow: 0 4px 15px rgba(255, 71, 87, 0.5);
}

/* History chips */
.recent-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 0.6rem;
}

.recent-chip {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  padding: 0.35rem 0.75rem;
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--accent-cyan);
  cursor: pointer;
}

/* Language modal */
.modal-backdrop {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.65);
  backdrop-filter: blur(6px);
  z-index: 2000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
}

.modal-backdrop.show {
  display: flex;
}

.modal-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  width: 100%;
  max-width: 380px;
  max-height: 80vh;
  overflow-y: auto;
}
