/* Global Variables & Colors */
:root {
  --font-primary: 'Rubik', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  --font-english: 'Outfit', sans-serif;
  
  --bg-gradient: linear-gradient(135deg, #0f0c1b 0%, #15102a 50%, #06050b 100%);
  --panel-bg: rgba(22, 18, 45, 0.45);
  --panel-border: rgba(255, 255, 255, 0.08);
  --panel-glow: rgba(138, 92, 246, 0.1);
  
  --color-primary: #8b5cf6;     /* Violet */
  --color-primary-glow: rgba(139, 92, 246, 0.4);
  --color-secondary: #ec4899;   /* Pink */
  --color-accent: #f97316;      /* Orange */
  --color-success: #10b981;     /* Green */
  --color-warning: #f59e0b;     /* Amber */
  --color-danger: #ef4444;      /* Red */
  
  --text-main: #f3f4f6;
  --text-muted: #9ca3af;
  --text-dark: #1f2937;
  
  --wa-bg: #0b141a;
  --wa-incoming: #202c33;
  --wa-outgoing: #005c4b;
  --wa-text: #e9edef;
  --wa-header: #202c33;
}

/* Reset & Layout */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-primary);
  background: #080610;
  color: var(--text-main);
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
  line-height: 1.6;
}

/* Beautiful dynamic background */
.glass-bg {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--bg-gradient);
  z-index: -2;
}

.glass-bg::before {
  content: '';
  position: absolute;
  top: -10%;
  left: -10%;
  width: 50%;
  height: 50%;
  background: radial-gradient(circle, rgba(139, 92, 246, 0.15) 0%, transparent 70%);
  z-index: -1;
  filter: blur(80px);
}

.glass-bg::after {
  content: '';
  position: absolute;
  bottom: -10%;
  right: -10%;
  width: 60%;
  height: 60%;
  background: radial-gradient(circle, rgba(236, 72, 153, 0.08) 0%, transparent 60%);
  z-index: -1;
  filter: blur(80px);
}

/* Container */
.app-container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 20px;
}

/* Header */
.main-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px;
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: 20px;
  backdrop-filter: blur(12px);
  margin-bottom: 25px;
  box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
}

.logo-area {
  display: flex;
  align-items: center;
  gap: 15px;
}

.shield-icon {
  font-size: 2.2rem;
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-secondary) 100%);
  -webkit-background-clip: text;
  filter: drop-shadow(0 4px 10px rgba(139, 92, 246, 0.4));
}

.logo-text h1 {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.5px;
  background: linear-gradient(90deg, #fff, #c084fc);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.logo-text p {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.status-pills {
  display: flex;
  gap: 12px;
}

.status-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 30px;
  font-size: 0.85rem;
  font-weight: 500;
  transition: all 0.3s ease;
}

.status-pill:hover {
  background: rgba(255, 255, 255, 0.08);
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

.dot.pulse {
  animation: pulse 1.8s infinite;
}

.dot.green { background-color: var(--color-success); box-shadow: 0 0 10px var(--color-success); }
.dot.orange { background-color: var(--color-accent); box-shadow: 0 0 10px var(--color-accent); }
.dot.gray { background-color: #6b7280; }

@keyframes pulse {
  0% { transform: scale(0.9); opacity: 0.4; }
  50% { transform: scale(1.1); opacity: 1; }
  100% { transform: scale(0.9); opacity: 0.4; }
}

/* Metrics Grid */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 20px;
  margin-bottom: 25px;
}

.metric-card {
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: 20px;
  padding: 24px;
  backdrop-filter: blur(12px);
  position: relative;
  overflow: hidden;
  box-shadow: 0 8px 24px 0 rgba(0, 0, 0, 0.2);
  transition: transform 0.3s ease, border-color 0.3s ease;
}

.metric-card:hover {
  transform: translateY(-4px);
  border-color: rgba(139, 92, 246, 0.3);
}

.metric-card h3 {
  font-size: 0.95rem;
  color: var(--text-muted);
  font-weight: 500;
  margin-bottom: 12px;
}

.progress-details {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 10px;
}

.progress-val {
  font-size: 1.8rem;
  font-weight: 700;
  font-family: var(--font-english);
}

.progress-percent {
  font-size: 0.85rem;
  color: var(--color-primary);
  font-weight: 500;
}

.progress-bar-container {
  width: 100%;
  height: 8px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--color-primary) 0%, var(--color-secondary) 100%);
  border-radius: 10px;
  transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.progress-bar-fill.orange {
  background: linear-gradient(90deg, var(--color-accent) 0%, #facc15 100%);
}

.stats-mini-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 5px;
}

.mini-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: rgba(255, 255, 255, 0.03);
  padding: 10px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.04);
}

.mini-stat .num {
  font-size: 1.4rem;
  font-weight: 700;
  font-family: var(--font-english);
}

.mini-stat .lbl {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Tabs Navigation */
.nav-tabs {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding-bottom: 10px;
}

.tab-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.95rem;
  font-weight: 500;
  padding: 10px 20px;
  cursor: pointer;
  border-radius: 10px;
  transition: all 0.3s ease;
  font-family: var(--font-primary);
}

.tab-btn:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.04);
}

.tab-btn.active {
  color: #fff;
  background: var(--color-primary-glow);
  border: 1px solid rgba(139, 92, 246, 0.3);
  box-shadow: 0 4px 15px rgba(139, 92, 246, 0.15);
}

/* Content Panels */
.content-panel {
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: 20px;
  padding: 25px;
  backdrop-filter: blur(12px);
  min-height: 400px;
  box-shadow: 0 12px 40px 0 rgba(0, 0, 0, 0.3);
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
  animation: fadeIn 0.4s ease forwards;
}

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

/* Headers inside Panels */
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
}

.section-header h2 {
  font-size: 1.3rem;
  font-weight: 600;
}

.section-desc {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 20px;
  max-width: 800px;
}

/* Buttons */
.btn {
  font-family: var(--font-primary);
  font-weight: 500;
  font-size: 0.9rem;
  padding: 10px 20px;
  border-radius: 10px;
  cursor: pointer;
  border: none;
  transition: all 0.3s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn-primary {
  background: linear-gradient(135deg, var(--color-primary) 0%, #7c3aed 100%);
  color: #fff;
  box-shadow: 0 4px 15px rgba(139, 92, 246, 0.3);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(139, 92, 246, 0.5);
}

.btn-outline {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: var(--text-main);
}

.btn-outline:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.4);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.8rem;
  border-radius: 6px;
}

.btn-block {
  display: flex;
  width: 100%;
}

/* Forms & Inputs */
.form-group {
  margin-bottom: 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 15px;
}

label {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 500;
}

input[type="text"],
input[type="number"],
input[type="url"],
input[type="password"],
input[type="time"],
select,
textarea {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  padding: 12px;
  color: #fff;
  font-family: var(--font-primary);
  font-size: 0.9rem;
  outline: none;
  transition: all 0.3s ease;
}

input:focus,
select:focus,
textarea:focus {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--color-primary);
  box-shadow: 0 0 8px rgba(139, 92, 246, 0.2);
}

select option {
  background: #110e24;
  color: #fff;
}

textarea {
  resize: vertical;
  min-height: 80px;
}

/* Checkbox and Toggle Switches */
.form-group-checkbox {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
}

.form-group-checkbox input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--color-primary);
  cursor: pointer;
}

.toggle-switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  user-select: none;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: relative;
  width: 44px;
  height: 22px;
  background-color: rgba(255, 255, 255, 0.15);
  border-radius: 34px;
  transition: .3s;
}

.slider:before {
  position: absolute;
  content: "";
  height: 16px;
  width: 16px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  border-radius: 50%;
  transition: .3s;
}

.toggle-switch input:checked + .slider {
  background-color: var(--color-success);
}

.toggle-switch input:checked + .slider:before {
  transform: translateX(22px);
}

.toggle-label {
  font-size: 0.9rem;
  color: var(--text-main);
  font-weight: 500;
}

/* Logs Panel List */
.logs-container {
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 12px;
  padding: 15px;
  height: 380px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-size: 0.85rem;
}

.log-item {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
  align-items: start;
  padding: 8px 12px;
  border-radius: 8px;
  border-right: 3px solid #6b7280;
  background: rgba(255, 255, 255, 0.02);
  transition: background 0.3s ease;
}

.log-item:hover {
  background: rgba(255, 255, 255, 0.04);
}

.log-item.info { border-right-color: #3b82f6; color: #93c5fd; }
.log-item.success { border-right-color: var(--color-success); color: #6ee7b7; }
.log-item.warning { border-right-color: var(--color-warning); color: #fcd34d; }
.log-item.error { border-right-color: var(--color-danger); color: #fca5a5; }
.log-item.message { border-right-color: var(--color-primary); color: #c084fc; }

.log-time {
  font-family: var(--font-english);
  color: var(--text-muted);
  font-size: 0.8rem;
  white-space: nowrap;
}

.log-content {
  word-break: break-all;
}

.log-text-msg {
  display: block;
  font-style: italic;
  color: #fff;
  margin-top: 3px;
  background: rgba(255, 255, 255, 0.05);
  padding: 4px 8px;
  border-radius: 4px;
}

/* Contacts Table */
.table-container {
  overflow-x: auto;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.2);
}

.contacts-table {
  width: 100%;
  border-collapse: collapse;
  text-align: right;
  font-size: 0.9rem;
}

.contacts-table th,
.contacts-table td {
  padding: 14px 18px;
}

.contacts-table th {
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-muted);
  font-weight: 500;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.contacts-table td {
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.contacts-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.02);
}

.actions-cell {
  display: flex;
  gap: 8px;
}

/* Settings Form Grid */
.settings-grid-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 25px;
}

.settings-box {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 15px;
  padding: 20px;
}

.settings-box h3 {
  font-size: 1.05rem;
  margin-bottom: 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  padding-bottom: 8px;
  color: var(--color-primary);
}

.settings-footer {
  grid-column: 1 / -1;
  display: flex;
  justify-content: flex-end;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  padding-top: 15px;
  margin-top: 10px;
}

/* Simulator Layout */
.simulator-layout {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 30px;
  align-items: start;
}

@media (max-width: 900px) {
  .simulator-layout {
    grid-template-columns: 1fr;
  }
}

.sim-form {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 15px;
  padding: 20px;
}

/* Mock Phone View */
.mock-phone-wrapper {
  display: flex;
  justify-content: center;
  align-items: center;
}

.phone-screen {
  width: 320px;
  height: 480px;
  background: var(--wa-bg);
  border-radius: 36px;
  border: 8px solid #2f2b3a;
  box-shadow: 0 20px 50px rgba(0,0,0,0.5);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.phone-header {
  background: var(--wa-header);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  color: #fff;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.phone-info {
  display: flex;
  flex-direction: column;
}

.phone-name {
  font-size: 0.85rem;
  font-weight: 500;
}

.phone-status {
  font-size: 0.7rem;
  color: var(--color-success);
}

.phone-chat-body {
  flex: 1;
  padding: 15px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Chat bubble styling */
.chat-bubble {
  max-width: 80%;
  padding: 8px 12px;
  border-radius: 10px;
  font-size: 0.8rem;
  line-height: 1.4;
  word-break: break-word;
  color: var(--wa-text);
  position: relative;
}

.chat-bubble.incoming {
  background: var(--wa-incoming);
  align-self: flex-start;
  border-top-left-radius: 0;
}

.chat-bubble.outgoing {
  background: var(--wa-outgoing);
  align-self: flex-end;
  border-top-right-radius: 0;
}

.chat-bubble .msg-time {
  font-size: 0.6rem;
  color: rgba(255,255,255,0.4);
  float: left;
  margin-top: 4px;
  margin-right: 8px;
  font-family: var(--font-english);
}

.chat-bubble .msg-sender {
  font-size: 0.68rem;
  color: var(--color-secondary);
  font-weight: 500;
  display: block;
  margin-bottom: 2px;
}

.system-bubble {
  align-self: center;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.05);
  font-size: 0.72rem;
  padding: 6px 12px;
  border-radius: 8px;
  text-align: center;
  color: var(--text-muted);
  max-width: 90%;
}

/* Typing bubble animation */
.typing-bubble {
  display: flex;
  gap: 4px;
  padding: 10px 15px;
  background: var(--wa-incoming);
  align-self: flex-start;
  border-radius: 10px;
  border-top-left-radius: 0;
}

.typing-dot {
  width: 6px;
  height: 6px;
  background: #aebac1;
  border-radius: 50%;
  animation: typingBounce 1.4s infinite ease-in-out;
}

.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes typingBounce {
  0%, 80%, 100% { transform: translateY(0); }
  40% { transform: translateY(-4px); }
}

/* Modal styling */
.modal {
  display: none;
  position: fixed;
  z-index: 100;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(4px);
  align-items: center;
  justify-content: center;
}

.modal.open {
  display: flex;
}

.modal-content {
  background: #15112f;
  border: 1px solid var(--panel-border);
  border-radius: 18px;
  width: 90%;
  max-width: 500px;
  padding: 24px;
  box-shadow: 0 20px 40px rgba(0,0,0,0.5);
  animation: modalSlide 0.3s ease-out;
}

@keyframes modalSlide {
  from { transform: translateY(-30px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  padding-bottom: 10px;
}

.modal-close {
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--text-muted);
}

.modal-close:hover { color: #fff; }

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
}

/* General classes */
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.empty-state {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100%;
  color: var(--text-muted);
  font-style: italic;
}

/* Scrollbar styling */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.1);
}
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--color-primary-glow);
}

/* LTR override for numbers/ratios in Hebrew UI */
.ltr-text {
  direction: ltr;
  display: inline-block;
}

/* WhatsApp Status Story Card */
.status-story-card .status-story-content {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  height: calc(100% - 30px);
  gap: 15px;
}

.status-story-card .status-posted-lbl {
  font-size: 0.95rem;
  color: var(--text-secondary);
}

.status-story-card .status-posted-lbl strong {
  color: var(--text-primary);
}

.status-story-card .status-btn {
  margin-top: auto;
  align-self: flex-start;
  transition: all 0.2s ease;
  font-weight: 600;
  border-color: var(--color-primary);
  color: var(--color-primary);
}

.status-story-card .status-btn:hover {
  background: var(--color-primary-glow);
  color: var(--text-primary);
}
