@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&display=swap');

:root {
  --primary: #0071e3;
  --primary-hover: #0077ed;
  --bg: #000000; /* Apple Black */
  --card-bg: #1c1c1e; /* Apple Dark Gray */
  --card-bg-elevated: #2c2c2e;
  --text: #f5f5f7;
  --text-secondary: #86868b;
  --border: #38383a;
  --success: #32d74b;
  --error: #ff453a;
  --font-main: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-accent: 'Plus Jakarta Sans', sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-font-smoothing: antialiased;
}

body {
  background-color: var(--bg);
  color: var(--text);
  font-family: var(--font-main);
  line-height: 1.47059;
  font-weight: 400;
  letter-spacing: -0.022em;
}

.auth-container {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  padding: 20px;
}

.glass-card {
  background: var(--card-bg);
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 4px 6px rgba(0,0,0,0.02), 0 10px 40px rgba(0,0,0,0.04);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.login-card {
  width: 100%;
  max-width: 400px;
  padding: 48px 40px;
  text-align: center;
}

.logo-text {
  font-family: var(--font-accent);
  font-size: 2.2rem;
  font-weight: 700;
  letter-spacing: -0.04em;
  margin-bottom: 8px;
  color: var(--text);
}

.logo-sub {
  color: var(--text-secondary);
  font-size: 1.1rem;
  margin-bottom: 40px;
  display: block;
}

h1, h2, h3 {
  font-family: var(--font-accent);
  letter-spacing: -0.02em;
}

.input-group {
  margin-bottom: 20px;
  text-align: left;
}

label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
  margin-left: 4px;
}

input, select, textarea {
  width: 100%;
  background: var(--card-bg-elevated);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px;
  color: var(--text);
  font-size: 17px;
  outline: none;
  transition: all 0.2s ease-in-out;
}

input:focus, select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(0, 113, 227, 0.1);
}

/* Premium Phone Input */
.phone-input-container {
  display: flex;
  align-items: center;
  background: var(--card-bg-elevated);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0;
  transition: all 0.2s ease-in-out;
  width: 100%;
  overflow: hidden;
}

.phone-input-container:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(0, 113, 227, 0.1);
}

.phone-prefix, .phone-prefix-select {
  flex: 0 0 95px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 10px;
  border: none;
  border-right: 1px solid var(--border);
  color: var(--text);
  font-weight: 600;
  height: 44px;
  background: transparent;
  outline: none;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  -webkit-user-select: none;
  user-select: none;
  font-family: var(--font-main);
  font-size: 13px;
}

.phone-prefix-select option {
  background: var(--card-bg-elevated);
  color: var(--text);
}

.phone-input-container {
  height: 44px; /* Harmonized container height */
}

.phone-input-container input {
  height: 42px;
  border: none !important;
  background: transparent !important;
  box-shadow: none !important;
  flex: 1;
  padding: 0 12px !important;
  font-size: 16px;
}

.btn {
  width: 100%;
  padding: 16px;
  border-radius: 12px;
  border: none;
  font-size: 17px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
}

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

.btn-primary:hover {
  background-color: var(--primary-hover);
}

/* Dashboard Layout */
.dashboard-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 100vh;
}

.sidebar {
  background: var(--card-bg);
  border-right: 1px solid var(--border);
  padding: 40px 20px;
  display: flex;
  flex-direction: column;
}

.nav-links {
  margin-top: 32px;
  flex-grow: 1;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: 10px;
  color: var(--text-secondary);
  text-decoration: none;
  transition: all 0.2s;
  margin-bottom: 4px;
  cursor: pointer;
  font-weight: 500;
}

.nav-item:hover {
  background: var(--bg);
  color: var(--text);
}

.nav-item.active {
  background: rgba(0, 113, 227, 0.08);
  color: var(--primary);
}

.sidebar-footer {
  margin-top: auto;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

.main-content {
  padding: 48px 64px;
  max-width: 1400px;
}

.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 48px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 24px;
  margin-bottom: 48px;
}

.stat-card {
  padding: 24px;
  border: none;
  background: var(--card-bg);
}

.stat-card .label {
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 8px;
  display: block;
}

.stat-card .value {
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--text);
}

/* Services Grid */
.services-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 24px;
}

.service-card {
  padding: 32px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  transition: all 0.4s cubic-bezier(0.12, 0, 0.39, 0);
  border-radius: 20px;
}

.service-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 20px 40px rgba(0,0,0,0.08);
}

.service-card h3 {
  margin-bottom: 8px;
  font-weight: 700;
}

.service-card p {
  color: var(--text-secondary);
  font-size: 15px;
  margin-bottom: 20px;
  line-height: 1.5;
}

.badge {
  display: inline-block;
  padding: 6px 12px;
  border-radius: 100px;
  font-size: 12px;
  font-weight: 600;
}

.badge-credits {
  background: var(--bg);
  color: var(--text);
}

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

.modal {
  padding: 32px;
  position: relative;
}

.close-btn {
  position: absolute;
  top: 16px;
  right: 20px;
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 28px;
  cursor: pointer;
  transition: color 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
}

.close-btn:hover {
  color: var(--text);
  background: rgba(255,255,255,0.05);
}

.mobile-header {
  display: none;
  background: var(--card-bg);
  padding: 8px 16px !important;
  border-bottom: 1px solid var(--border);
  align-items: center;
  justify-content: flex-start !important; /* Alineado a la izquierda */
  position: sticky;
  top: 0;
  z-index: 1001;
  gap: 12px !important;
}

.menu-toggle {
  background: none;
  border: none;
  color: var(--text);
  font-size: 24px;
  cursor: pointer;
  order: -1 !important; /* Garantizar que está a la izquierda */
  padding: 4px !important;
}

/* Utils */
.flex { display: flex; align-items: center; gap: 8px; }
.justify-between { justify-content: space-between; }
.mb-20 { margin-bottom: 20px; }

/* Table */
.table-container {
  background: var(--card-bg);
  border-radius: 20px;
  padding: 8px;
  overflow: hidden;
  border: 1px solid var(--border);
}

table {
  width: 100%;
  border-collapse: collapse;
}

th {
  background: var(--card-bg-elevated);
  padding: 16px;
  text-align: left;
  font-size: 12px;
  text-transform: uppercase;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border);
}

td {
  padding: 16px;
  border-bottom: 1px solid var(--border);
}

@media (max-width: 768px) {
  .dashboard-layout { 
    display: block !important; 
  }
  
  .mobile-header { 
    display: flex; 
    padding: 10px 18px !important; 
    height: auto;
    min-height: 50px;
    position: sticky;
    top: 0;
    z-index: 1001;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
  }

  .sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1500;
  }

  .sidebar.active + .sidebar-overlay {
    display: block;
  }

  .sidebar { 
    position: fixed !important;
    top: 0;
    left: 0;
    width: 260px !important;
    height: 100vh !important;
    z-index: 2000 !important;
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 20px 0 50px rgba(0,0,0,0.5);
    background: rgba(28, 28, 30, 0.85) !important;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    display: flex !important;
    flex-direction: column;
    padding: 30px 20px !important;
  }

  .sidebar.active {
    transform: translateX(0) !important;
  }

  .main-content { 
    padding: 20px !important;
    width: 100% !important;
    margin-top: 0 !important;
    padding-top: 70px !important; /* Compensar altura del mobile-header */
  }
  
  .top-bar { 
    flex-direction: column; 
    align-items: flex-start; 
    gap: 16px; 
    margin-bottom: 32px;
  }
}

/* Corrección Maestra de Layout para Computadora */
@media (min-width: 769px) {
  .dashboard-layout {
    display: grid !important;
    grid-template-columns: 260px 1fr !important;
    grid-template-rows: auto !important;
  }

  .sidebar { 
    grid-column: 1 !important; 
    grid-row: 1 !important; 
    display: flex !important;
    position: relative !important;
    transform: none !important;
  }
  
  .main-content { 
    grid-column: 2 !important; 
    grid-row: 1 !important; 
    margin-top: 0 !important;
    padding-top: 48px !important;
  }

  .mobile-header { 
    display: none !important; 
  }
}
/* Admin Utility Classes */
.admin-grid { display: grid; grid-template-columns: 1fr; gap: 30px; }
.action-bar { margin-bottom: 24px; display: flex; gap: 12px; flex-wrap: wrap; }
.view { animation: fadeIn 0.3s ease-out; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

.terminal-box {
    background: #000;
    color: #32d74b;
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', monospace;
    padding: 20px;
    border-radius: 12px;
    height: 400px;
    overflow-y: auto;
    font-size: 13px;
    line-height: 1.5;
    border: 1px solid var(--border);
    box-shadow: inset 0 0 10px rgba(0,0,0,0.5);
}

.terminal-header {
    background: var(--card-bg-elevated);
    padding: 8px 16px;
    border-radius: 12px 12px 0 0;
    border: 1px solid var(--border);
    border-bottom: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    color: var(--text-secondary);
}

.pricing-grid {
    display: grid; 
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); 
    gap: 12px;
}

.z-100 { z-index: 100 !important; }
.w-auto { width: auto !important; }
.flex-row { flex-direction: row !important; align-items: center !important; gap: 10px !important; }
.checkbox-large { width: 20px !important; height: 20px !important; cursor: pointer; }
.m-0 { margin: 0 !important; }
.mb-10 { margin-bottom: 10px !important; }
.mb-0 { margin-bottom: 0 !important; }
.block { display: block !important; }
.fw-600 { font-weight: 600 !important; }
.p-32 { padding: 32px !important; }
.mw-600 { max-width: 600px !important; }
.gap-16 { gap: 16px !important; }
.gap-8 { gap: 8px !important; }

.grid-2-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.btn-sm { padding: 6px 12px !important; font-size: 13px !important; width: auto !important; margin-right: 4px; }
.btn-success { background: var(--success) !important; color: #fff !important; }
.btn-success:hover { opacity: 0.9; }

.badge-phone { 
    background: var(--card-bg-elevated); 
    border: 1px solid var(--border); 
    display: flex; 
    align-items: center; 
    gap: 8px; 
    padding: 6px 12px;
}

.delete-phone-btn { 
    color: var(--error); 
    cursor: pointer; 
    font-weight: bold; 
    font-size: 16px; 
    line-height:1; 
}

.delete-phone-btn:hover { transform: scale(1.2); }

.modal-large { max-width: 650px !important; }

.modal-large { max-width: 650px !important; }
.modal-xl { max-width: 850px !important; }
.modal-large, .modal-xl { max-height: 90vh; overflow-y: auto; }

.admin-section-box {
    margin-top: 10px; 
    padding: 20px; 
    background: var(--bg); 
    border-radius: 16px; 
    margin-bottom: 24px;
    border: 1px solid var(--border);
}

.logout-btn { background: #f2f2f7 !important; color: var(--error) !important; }
.logout-btn:hover { background: #e5e5ea !important; }
.btn-error { background: var(--error) !important; color: #fff !important; }
.btn-square { width: 44px !important; height: 44px !important; padding: 0 !important; }
.hr-separator { margin: 32px 0; border: none; border-top: 1px solid var(--border); }
.text-error { color: var(--error) !important; }
.desc-text { color: var(--text-secondary); font-size: 14px; }
.phones-list { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 8px; }

@media (max-width: 600px) {
    .grid-2-col { grid-template-columns: 1fr; }
}
