/* ========================================
   Sheik Dos Pisos — Design System
   Dark/Gold premium theme
   ======================================== */

:root {
  --bg-primary: #0a0a0a;
  --bg-secondary: #141414;
  --bg-card: #1a1a1a;
  --bg-card-hover: #222;
  --bg-input: #1e1e1e;
  --gold: #c9a84c;
  --gold-light: #dfc373;
  --gold-dark: #9e7e2e;
  --text-primary: #f0f0f0;
  --text-secondary: #999;
  --text-muted: #666;
  --border: #2a2a2a;
  --border-light: #333;
  --success: #22c55e;
  --error: #ef4444;
  --warning: #f59e0b;
  --info: #3b82f6;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 4px 24px rgba(0,0,0,0.4);
  --transition: 0.2s ease;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--gold); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--gold-light); }

img { max-width: 100%; height: auto; }

/* ========================================
   UTILITIES
   ======================================== */
.container { max-width: 1200px; margin: 0 auto; padding: 0 24px; }
.text-center { text-align: center; }
.text-gold { color: var(--gold); }
.text-muted { color: var(--text-secondary); }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mt-4 { margin-top: 32px; }
.mb-2 { margin-bottom: 16px; }
.mb-4 { margin-bottom: 32px; }
.hidden { display: none !important; }

/* ========================================
   BUTTONS
   ======================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 28px;
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
}

.btn-gold {
  background: linear-gradient(135deg, var(--gold), var(--gold-dark));
  color: #000;
}
.btn-gold:hover {
  background: linear-gradient(135deg, var(--gold-light), var(--gold));
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(201,168,76,0.3);
}

.btn-outline {
  background: transparent;
  border: 2px solid var(--gold);
  color: var(--gold);
}
.btn-outline:hover {
  background: var(--gold);
  color: #000;
}

.btn-sm { padding: 8px 16px; font-size: 0.85rem; }
.btn-danger { background: var(--error); color: #fff; }
.btn-danger:hover { background: #dc2626; }

/* ========================================
   LANDING PAGE — HEADER
   ======================================== */
.landing-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: rgba(10,10,10,0.9);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 16px 0;
}

.landing-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--gold);
  letter-spacing: 1px;
}
.logo span { color: var(--text-primary); font-weight: 400; }

.nav-links { display: flex; gap: 32px; align-items: center; }
.nav-links a { color: var(--text-secondary); font-size: 0.9rem; font-weight: 500; }
.nav-links a:hover { color: var(--gold); }

.mobile-menu-btn {
  display: none;
  background: none;
  border: none;
  color: var(--text-primary);
  font-size: 1.5rem;
  cursor: pointer;
}

/* ========================================
   HERO
   ======================================== */
.hero {
  min-height: 100vh;
  display: flex;
  align-items: center;
  padding: 120px 0 80px;
  background:
    radial-gradient(ellipse at 30% 50%, rgba(201,168,76,0.08) 0%, transparent 60%),
    var(--bg-primary);
}

.hero-content { max-width: 700px; }

.hero h1 {
  font-size: clamp(2.5rem, 5vw, 4rem);
  font-weight: 800;
  line-height: 1.1;
  margin-bottom: 24px;
}

.hero p {
  font-size: 1.15rem;
  color: var(--text-secondary);
  margin-bottom: 32px;
  max-width: 520px;
}

.hero-buttons { display: flex; gap: 16px; flex-wrap: wrap; }

.hero-badge {
  display: inline-block;
  background: rgba(201,168,76,0.1);
  border: 1px solid rgba(201,168,76,0.3);
  color: var(--gold);
  padding: 6px 16px;
  border-radius: 50px;
  font-size: 0.8rem;
  font-weight: 600;
  margin-bottom: 24px;
  letter-spacing: 1px;
  text-transform: uppercase;
}

/* ========================================
   SECTIONS
   ======================================== */
.section {
  padding: 100px 0;
}

.section-alt {
  background: var(--bg-secondary);
}

.section-title {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 12px;
}

.section-subtitle {
  color: var(--text-secondary);
  font-size: 1.05rem;
  margin-bottom: 48px;
  max-width: 600px;
}

.section-subtitle.centered {
  margin-left: auto;
  margin-right: auto;
}

/* ========================================
   PRODUCT GRID
   ======================================== */
.price-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 20px;
}

.price-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 20px;
  text-align: center;
  transition: all var(--transition);
}
.price-card:hover {
  border-color: var(--gold);
  transform: translateY(-4px);
  box-shadow: var(--shadow);
}

.price-card .price {
  font-size: 2rem;
  font-weight: 800;
  color: var(--gold);
}
.price-card .price small {
  font-size: 0.9rem;
  font-weight: 400;
  color: var(--text-secondary);
}
.price-card .label {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-top: 8px;
}

/* ========================================
   PRODUCT TYPES
   ======================================== */
.types-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
}

.type-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px 24px;
  transition: all var(--transition);
}
.type-card:hover {
  border-color: var(--gold);
  box-shadow: var(--shadow);
}

.type-card .icon {
  font-size: 2.5rem;
  margin-bottom: 16px;
}
.type-card h3 {
  font-size: 1.1rem;
  margin-bottom: 8px;
}
.type-card p {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

/* ========================================
   LOCATION
   ======================================== */
.location-content {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 48px;
  align-items: center;
}

.location-info h3 {
  font-size: 1.3rem;
  margin-bottom: 16px;
}

.location-detail {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 20px;
}

.location-detail .icon {
  font-size: 1.4rem;
  color: var(--gold);
  flex-shrink: 0;
}
.location-detail p { color: var(--text-secondary); font-size: 0.95rem; }
.location-detail strong { color: var(--text-primary); }

.map-placeholder {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  height: 320px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.map-placeholder iframe {
  width: 100%;
  height: 100%;
  border: none;
  filter: grayscale(0.8) brightness(0.7);
}

/* ========================================
   CTA
   ======================================== */
.cta-section {
  text-align: center;
  padding: 100px 0;
  background:
    radial-gradient(ellipse at center, rgba(201,168,76,0.1) 0%, transparent 70%),
    var(--bg-primary);
}

.cta-section h2 {
  font-size: 2.2rem;
  margin-bottom: 16px;
}

.cta-section p {
  color: var(--text-secondary);
  font-size: 1.1rem;
  margin-bottom: 32px;
}

/* ========================================
   FOOTER
   ======================================== */
.landing-footer {
  border-top: 1px solid var(--border);
  padding: 40px 0;
  text-align: center;
}

.footer-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
}

.footer-content p {
  color: var(--text-muted);
  font-size: 0.85rem;
}

.footer-links { display: flex; gap: 24px; }
.footer-links a { color: var(--text-muted); font-size: 0.85rem; }
.footer-links a:hover { color: var(--gold); }

/* ========================================
   LOGIN PAGE
   ======================================== */
.login-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(ellipse at center, rgba(201,168,76,0.06) 0%, transparent 60%),
    var(--bg-primary);
}

.login-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 48px 40px;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow);
}

.login-card h1 {
  font-size: 1.5rem;
  margin-bottom: 8px;
}

.login-card .subtitle {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-bottom: 32px;
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.form-group input {
  width: 100%;
  padding: 12px 16px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 0.95rem;
  transition: border-color var(--transition);
}

.form-group input:focus {
  outline: none;
  border-color: var(--gold);
}

.form-group input::placeholder { color: var(--text-muted); }

.login-error {
  background: rgba(239,68,68,0.1);
  border: 1px solid rgba(239,68,68,0.3);
  color: var(--error);
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  margin-bottom: 20px;
  display: none;
}

.login-card .btn { width: 100%; margin-top: 8px; }

/* ========================================
   ADMIN DASHBOARD
   ======================================== */
.admin-layout {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  width: 260px;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  padding: 24px 0;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
}

.sidebar-logo {
  padding: 0 24px;
  margin-bottom: 32px;
}
.sidebar-logo h2 {
  font-size: 1.1rem;
  color: var(--gold);
}
.sidebar-logo p {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.sidebar-nav { flex: 1; }

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 24px;
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 500;
  transition: all var(--transition);
  border-left: 3px solid transparent;
}
.sidebar-nav a:hover,
.sidebar-nav a.active {
  color: var(--gold);
  background: rgba(201,168,76,0.05);
  border-left-color: var(--gold);
}

.sidebar-nav .icon { font-size: 1.2rem; width: 20px; text-align: center; }

.sidebar-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
}

.sidebar-footer .btn { width: 100%; }

/* Main content */
.admin-main {
  flex: 1;
  padding: 32px;
  overflow-y: auto;
}

.admin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 32px;
}

.admin-header h1 { font-size: 1.5rem; }

.admin-header .user-info {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text-secondary);
  font-size: 0.9rem;
}

/* Stats cards */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  margin-bottom: 32px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  transition: all var(--transition);
}
.stat-card:hover {
  border-color: var(--border-light);
}

.stat-card .label {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.stat-card .value {
  font-size: 2rem;
  font-weight: 700;
}

.stat-card .value.gold { color: var(--gold); }
.stat-card .value.green { color: var(--success); }
.stat-card .value.blue { color: var(--info); }

/* Instance cards */
.instances-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
  margin-bottom: 32px;
}

.instance-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
}

.instance-card .header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.instance-card .name {
  font-weight: 600;
  font-size: 1rem;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 50px;
  font-size: 0.75rem;
  font-weight: 600;
}

.status-badge.open {
  background: rgba(34,197,94,0.1);
  color: var(--success);
}

.status-badge.close,
.status-badge.disconnected {
  background: rgba(239,68,68,0.1);
  color: var(--error);
}

.status-badge.connecting {
  background: rgba(245,158,11,0.1);
  color: var(--warning);
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

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

/* Tables */
.admin-table-wrapper {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 32px;
}

.table-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
}

.table-header h3 { font-size: 1rem; }

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

.admin-table th {
  text-align: left;
  padding: 12px 24px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border);
}

.admin-table td {
  padding: 14px 24px;
  font-size: 0.9rem;
  border-bottom: 1px solid var(--border);
  color: var(--text-secondary);
}

.admin-table tr:last-child td { border-bottom: none; }
.admin-table tr:hover td { background: rgba(255,255,255,0.02); }

.phase-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 50px;
  font-size: 0.75rem;
  font-weight: 500;
  background: rgba(201,168,76,0.1);
  color: var(--gold);
}

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
  width: 90%;
  max-width: 440px;
  box-shadow: var(--shadow);
}

.modal h3 { margin-bottom: 20px; }

.modal .qr-container {
  background: #fff;
  border-radius: var(--radius-sm);
  padding: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 280px;
}

.modal .qr-container img { max-width: 256px; }

.modal-close {
  margin-top: 20px;
  width: 100%;
}

/* Loading spinner */
.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Toast notification */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px 24px;
  font-size: 0.9rem;
  box-shadow: var(--shadow);
  z-index: 2000;
  transform: translateY(100px);
  opacity: 0;
  transition: all 0.3s ease;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

.toast.success { border-left: 3px solid var(--success); }
.toast.error { border-left: 3px solid var(--error); }

/* ========================================
   RESPONSIVE
   ======================================== */
@media (max-width: 768px) {
  .nav-links { display: none; }
  .mobile-menu-btn { display: block; }

  .hero { padding: 100px 0 60px; }
  .hero h1 { font-size: 2rem; }
  .hero-buttons { flex-direction: column; }

  .location-content { grid-template-columns: 1fr; }

  .login-card { margin: 16px; padding: 32px 24px; }

  .sidebar { display: none; }
  .admin-main { padding: 16px; }

  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .instances-grid { grid-template-columns: 1fr; }

  .admin-table { font-size: 0.8rem; }
  .admin-table th, .admin-table td { padding: 10px 12px; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .price-grid { grid-template-columns: repeat(2, 1fr); }
  .types-grid { grid-template-columns: 1fr; }
}
