/* Modern Glassmorphic Dark Design System */
:root {
  --bg-color: #0f111a;
  --panel-bg: rgba(26, 29, 46, 0.6);
  --border-color: rgba(255, 255, 255, 0.08);
  --text-primary: #f1f3f9;
  --text-secondary: #9aa0b9;
  --accent-color: #7209b7;
  --accent-glow: rgba(114, 9, 183, 0.4);
  
  --wa-dark-bg: #0b141a;
  --wa-header-bg: #202c33;
  --wa-bubble-in: #202c33;
  --wa-bubble-out: #005c4b;
  --wa-text: #e9edef;
  --wa-input-bg: #2a3942;
  
  --status-online: #2ec4b6;
  --status-offline: #e63946;
  --status-searching: #ffb703;
  --status-accepted: #00b4d8;
  --status-completed: #2ec4b6;
  --status-cancelled: #e63946;
}

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

body {
  font-family: 'Plus Jakarta Sans', 'Outfit', system-ui, -apple-system, sans-serif;
  background-color: var(--bg-color);
  color: var(--text-primary);
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
  padding-bottom: 2rem;
}

/* Animated Neon Radial Gradients in Background */
.glass-bg {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: -1;
  background: radial-gradient(circle at 10% 20%, rgba(88, 28, 135, 0.15) 0%, transparent 40%),
              radial-gradient(circle at 90% 80%, rgba(6, 182, 212, 0.12) 0%, transparent 40%),
              radial-gradient(circle at 50% 50%, rgba(15, 17, 26, 1) 0%, rgba(10, 11, 18, 1) 100%);
  filter: blur(10px);
}

/* Header design */
.app-header {
  border-bottom: 1px solid var(--border-color);
  backdrop-filter: blur(20px);
  background-color: rgba(15, 17, 26, 0.8);
  position: sticky;
  top: 0;
  z-index: 100;
  padding: 1rem 2rem;
}

.header-content {
  max-width: 1600px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.brand {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.logo {
  font-size: 2.2rem;
  filter: drop-shadow(0 0 10px rgba(255, 183, 3, 0.5));
}

.brand h1 {
  font-family: 'Outfit', sans-serif;
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.5px;
  background: linear-gradient(135deg, #fff 30%, var(--text-secondary) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.subtitle {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.header-actions {
  display: flex;
  gap: 0.75rem;
}

/* Generic Button Styles */
.btn {
  padding: 0.6rem 1.2rem;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  border: 1px solid transparent;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.btn-primary {
  background-color: var(--accent-color);
  color: #fff;
  box-shadow: 0 4px 14px var(--accent-glow);
}

.btn-primary:hover {
  background-color: #8b10e6;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(114, 9, 183, 0.6);
}

.btn-secondary {
  background-color: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
  border-color: var(--border-color);
}

.btn-secondary:hover {
  background-color: rgba(255, 255, 255, 0.1);
  transform: translateY(-2px);
}

.btn-danger {
  background-color: rgba(230, 57, 70, 0.15);
  color: #ff4d6d;
  border-color: rgba(230, 57, 70, 0.3);
}

.btn-danger:hover {
  background-color: rgba(230, 57, 70, 0.3);
  transform: translateY(-2px);
}

/* Container Structure */
.app-container {
  max-width: 1600px;
  margin: 2rem auto;
  padding: 0 2rem;
  display: flex;
  flex-direction: column;
  gap: 2.5rem;
}

.section-title {
  font-family: 'Outfit', sans-serif;
  font-size: 1.25rem;
  margin-bottom: 1.25rem;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  font-weight: 600;
}

/* Double-Phone Simulator Grid */
.screens-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
  gap: 2rem;
}

/* Glassmorphic Phone Mockup Container */
.phone-mockup {
  height: 640px;
  background-color: var(--wa-dark-bg);
  border-radius: 36px;
  border: 4px solid #333b4d;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.phone-mockup:hover {
  transform: translateY(-5px);
  box-shadow: 0 30px 60px -10px rgba(114, 9, 183, 0.2);
}

/* Phone top notch and contact bar */
.phone-header {
  background-color: var(--wa-header-bg);
  padding: 1.25rem 1rem 0.75rem 1rem;
  position: relative;
  border-bottom: 1px solid rgba(0,0,0,0.2);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.phone-speaker {
  width: 50px;
  height: 5px;
  background-color: #555;
  border-radius: 10px;
  position: absolute;
  top: 6px;
  left: 50%;
  transform: translateX(-50%);
}

.chat-contact-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.chat-contact-info h3 {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--wa-text);
}

.chat-subtitle {
  font-size: 0.75rem;
  color: #8696a0;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: #8696a0;
  display: inline-block;
  box-shadow: 0 0 8px rgba(0,0,0,0.5);
}

.status-dot.online {
  background-color: var(--status-online);
  box-shadow: 0 0 10px var(--status-online);
  animation: blink 2s infinite ease-in-out;
}

@keyframes blink {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 1; }
}

.customer-picker-container {
  width: 100%;
}

.customer-picker-container select {
  width: 100%;
  background-color: #111b21;
  color: var(--wa-text);
  border: 1px solid #3b4a54;
  padding: 0.35rem 0.5rem;
  border-radius: 6px;
  font-size: 0.8rem;
  cursor: pointer;
  outline: none;
}

.driver-badge {
  position: absolute;
  right: 12px;
  top: 15px;
  background-color: #111b21;
  border: 1px solid #3b4a54;
  color: #8696a0;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.7rem;
  font-family: monospace;
}

/* WhatsApp Message Logs Feed area */
.phone-chat-body {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  background-image: radial-gradient(rgba(255,255,255,0.03) 1px, transparent 1px);
  background-size: 20px 20px;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

/* Scrollbar styling */
.phone-chat-body::-webkit-scrollbar {
  width: 4px;
}
.phone-chat-body::-webkit-scrollbar-thumb {
  background-color: rgba(255,255,255,0.15);
  border-radius: 10px;
}

/* WhatsApp Message Bubble */
.msg-bubble {
  max-width: 85%;
  padding: 0.65rem 0.85rem;
  border-radius: 10px;
  font-size: 0.85rem;
  line-height: 1.4;
  position: relative;
  animation: slideIn 0.2s cubic-bezier(0.1, 0.8, 0.25, 1);
  word-wrap: break-word;
}

@keyframes slideIn {
  from { transform: translateY(10px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.msg-bubble.inbound {
  background-color: var(--wa-bubble-in);
  color: var(--wa-text);
  align-self: flex-start;
  border-top-left-radius: 0;
}

.msg-bubble.outbound {
  background-color: var(--wa-bubble-out);
  color: var(--wa-text);
  align-self: flex-end;
  border-top-right-radius: 0;
}

.msg-time {
  display: block;
  text-align: right;
  font-size: 0.65rem;
  color: #8696a0;
  margin-top: 4px;
}

/* Interactive WhatsApp Button styling inside bubbles */
.wa-interactive-body {
  margin-bottom: 0.5rem;
  white-space: pre-line;
}

.wa-buttons-container {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 0.5rem;
  border-top: 1px solid rgba(255,255,255,0.08);
  padding-top: 0.5rem;
}

.wa-btn {
  background-color: rgba(255, 255, 255, 0.05);
  color: #00a884;
  border: 1px solid rgba(255,255,255,0.1);
  padding: 0.5rem;
  border-radius: 6px;
  font-weight: 600;
  text-align: center;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.wa-btn:hover {
  background-color: rgba(0, 168, 132, 0.15);
  border-color: #00a884;
}

/* Phone bottom entry bar */
.phone-input-bar {
  background-color: var(--wa-header-bg);
  padding: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  border-top: 1px solid rgba(0,0,0,0.2);
}

.phone-input-bar input {
  flex: 1;
  background-color: var(--wa-input-bg);
  border: none;
  color: var(--wa-text);
  padding: 0.6rem 0.85rem;
  border-radius: 20px;
  font-size: 0.85rem;
  outline: none;
}

.btn-icon {
  background: none;
  border: none;
  font-size: 1.2rem;
  cursor: pointer;
  transition: transform 0.2s ease;
}
.btn-icon:hover {
  transform: scale(1.2);
}

.btn-quick-action {
  background-color: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  color: var(--text-secondary);
  padding: 0.4rem 0.6rem;
  border-radius: 12px;
  font-size: 0.75rem;
  cursor: pointer;
}
.btn-quick-action:hover {
  background-color: rgba(255,255,255,0.1);
  color: var(--text-primary);
}

.btn-send {
  background-color: #00a884;
  color: white;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 20px;
  font-weight: 600;
  font-size: 0.8rem;
  cursor: pointer;
  transition: background-color 0.2s ease;
}
.btn-send:hover {
  background-color: #008f72;
}

/* Database Card View Section */
.database-section {
  display: flex;
  flex-direction: column;
}

.db-tables-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(500px, 1fr));
  gap: 2rem;
}

.db-table-card {
  background-color: var(--panel-bg);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 1.5rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
  display: flex;
  flex-direction: column;
}

.db-table-card.full-width {
  grid-column: 1 / -1;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 0.75rem;
}

.card-header h3 {
  font-family: 'Outfit', sans-serif;
  font-size: 1.1rem;
  font-weight: 600;
}

.db-badge {
  background-color: rgba(255,255,255,0.05);
  font-family: monospace;
  font-size: 0.75rem;
  color: var(--text-secondary);
  padding: 3px 8px;
  border-radius: 4px;
  border: 1px solid var(--border-color);
}

.table-wrapper {
  overflow-x: auto;
  max-height: 250px;
}

table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.85rem;
}

th {
  color: var(--text-secondary);
  font-weight: 600;
  padding: 0.75rem 0.5rem;
  border-bottom: 1px solid var(--border-color);
}

td {
  padding: 0.75rem 0.5rem;
  border-bottom: 1px solid rgba(255,255,255,0.03);
  color: var(--text-primary);
  white-space: nowrap;
  max-width: 250px;
  overflow: hidden;
  text-overflow: ellipsis;
}

tr:hover td {
  background-color: rgba(255, 255, 255, 0.02);
}

.empty-row {
  text-align: center;
  color: var(--text-secondary);
  font-style: italic;
  padding: 2rem 0;
}

/* Badges styled for database statuses */
.badge-status {
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
  display: inline-block;
  text-transform: capitalize;
}

.badge-status.searching {
  background-color: rgba(255, 183, 3, 0.15);
  color: var(--status-searching);
  border: 1px solid rgba(255, 183, 3, 0.3);
}

.badge-status.accepted {
  background-color: rgba(0, 180, 216, 0.15);
  color: var(--status-accepted);
  border: 1px solid rgba(0, 180, 216, 0.3);
}

.badge-status.completed {
  background-color: rgba(46, 196, 182, 0.15);
  color: var(--status-completed);
  border: 1px solid rgba(46, 196, 182, 0.3);
}

.badge-status.cancelled {
  background-color: rgba(230, 57, 70, 0.15);
  color: var(--status-cancelled);
  border: 1px solid rgba(230, 57, 70, 0.3);
}

.badge-status.online {
  background-color: rgba(46, 196, 182, 0.15);
  color: var(--status-online);
}

.badge-status.offline {
  background-color: rgba(230, 57, 70, 0.15);
  color: var(--status-offline);
}

.badge-lang {
  background-color: rgba(114, 9, 183, 0.15);
  color: #a29bfe;
  border: 1px solid rgba(114, 9, 183, 0.3);
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 0.75rem;
  text-transform: uppercase;
}

/* Footer layout */
.app-footer {
  max-width: 1600px;
  margin: 3rem auto 0 auto;
  padding: 1.5rem 2rem 0 2rem;
  border-top: 1px solid var(--border-color);
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-secondary);
}

/* Modals */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0,0,0,0.6);
  backdrop-filter: blur(5px);
  z-index: 1000;
  justify-content: center;
  align-items: center;
}

.modal.active {
  display: flex;
}

.modal-content {
  background-color: #1f2235;
  border: 1px solid var(--border-color);
  padding: 2rem;
  border-radius: 16px;
  width: 400px;
  box-shadow: 0 20px 40px rgba(0,0,0,0.5);
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.input-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

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

.input-group input {
  padding: 0.6rem;
  border-radius: 6px;
  border: 1px solid #333b4d;
  background-color: #111b21;
  color: #fff;
  outline: none;
}

.modal-buttons {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
}

/* Call Header Buttons & Call Simulator CSS */
.btn-call-header {
  background-color: #00a884;
  color: white;
  border: none;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: 10px;
  box-shadow: 0 0 8px rgba(0, 168, 132, 0.4);
  transition: all 0.2s ease;
  flex-shrink: 0;
}
.btn-call-header:hover {
  background-color: #008f72;
  transform: scale(1.05);
}

.call-modal-content {
  text-align: center;
  align-items: center;
  gap: 1.5rem;
  width: 420px;
  background: linear-gradient(145deg, #1b1e30, #141624);
}

.call-animation {
  position: relative;
  width: 80px;
  height: 80px;
  margin: 10px auto;
  display: flex;
  justify-content: center;
  align-items: center;
}

.ring-circle {
  position: absolute;
  width: 100%;
  height: 100%;
  background-color: rgba(6, 214, 160, 0.2);
  border-radius: 50%;
  animation: ring-pulse 1.8s infinite ease-in-out;
}

.ring-phone {
  font-size: 2.2rem;
  z-index: 2;
  animation: ring-wobble 0.6s infinite ease-in-out;
}

@keyframes ring-pulse {
  0% { transform: scale(0.9); opacity: 0.8; }
  100% { transform: scale(1.6); opacity: 0; }
}

@keyframes ring-wobble {
  0%, 100% { transform: rotate(0); }
  25% { transform: rotate(-15deg); }
  75% { transform: rotate(15deg); }
}

.call-details {
  width: 100%;
  background-color: rgba(0, 0, 0, 0.2);
  border-radius: 12px;
  padding: 1rem;
  text-align: left;
  border: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  font-size: 0.85rem;
}

.call-details p {
  display: flex;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  padding-bottom: 6px;
  margin: 0;
}

.call-details p:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.call-details span {
  color: var(--text-secondary);
  font-family: monospace;
}

/* Additional status badges */
.badge-status.timed_out {
  background-color: rgba(255, 140, 0, 0.15);
  color: #ff8c00;
  border: 1px solid rgba(255, 140, 0, 0.3);
}

.badge-status.pending {
  background-color: rgba(255, 183, 3, 0.15);
  color: var(--status-searching);
  border: 1px solid rgba(255, 183, 3, 0.3);
}

.badge-status.rejected {
  background-color: rgba(230, 57, 70, 0.15);
  color: var(--status-cancelled);
  border: 1px solid rgba(230, 57, 70, 0.3);
}

/* Force timeout button in trips table */
.btn-timeout {
  background-color: rgba(255, 140, 0, 0.15);
  color: #ff8c00;
  border: 1px solid rgba(255, 140, 0, 0.3);
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.btn-timeout:hover {
  background-color: rgba(255, 140, 0, 0.3);
  transform: scale(1.05);
}
