/* CSS Variables for EtnaMonitor Tech Theme */
:root {
  --bg: #070B1A;
  --card: #0F1A30;
  --card-hover: #172640;
  --text: #F4F8FF;
  --muted: #C0CAE6;
  --accent: #00D2FF;
  --success: #22C55E;
  --warning: #FACC15;
  --error: #F87171;
  --border: #1F2A44;
  --shadow: rgba(2, 8, 20, 0.65);
  --gradient: linear-gradient(135deg, rgba(15, 26, 48, 0.92) 0%, rgba(31, 48, 82, 0.98) 100%);
}

/* Base Styles */
* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  line-height: 1.6;
}

/* Navbar with Logo */
.navbar {
  position: sticky;
  top: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 20px;
  background: rgba(7, 12, 28, 0.9);
  backdrop-filter: blur(24px);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 12px 30px rgba(4, 10, 24, 0.65);
  z-index: 1000;
}

.brand {
  display: flex;
  align-items: center;
  font-weight: 700;
  font-size: 1.2rem;
  color: var(--text);
}

/* Remove old emoji styling - replaced with actual logo */
.brand::before {
  display: none;
}

.navbar a,
.navbar .nav-link {
  color: var(--muted);
  text-decoration: none;
  margin-left: 14px;
  padding: 8px 12px;
  border-radius: 6px;
  transition: all 0.3s ease;
}

.navbar a:hover,
.navbar .nav-link:hover,
.navbar .nav-link:focus {
  color: var(--text);
  background: rgba(0, 210, 255, 0.08);
  box-shadow: 0 8px 18px rgba(0, 210, 255, 0.15);
  transform: translateY(-1px);
}

.navbar .nav-link {
  background: transparent;
  border: none;
  font: inherit;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}

.nav-dropdown {
  position: relative;
  display: inline-flex;
  align-items: stretch;
}

.nav-dropdown .nav-dropdown-toggle {
  padding-right: 34px;
}

.nav-dropdown .nav-dropdown-toggle i {
  font-size: 0.65rem;
  transition: transform 0.25s ease;
}

.nav-dropdown.open .nav-dropdown-toggle i {
  transform: rotate(180deg);
}

.nav-dropdown-menu {
  position: absolute;
  top: calc(100% + 12px);
  right: 0;
  background: rgba(7, 12, 28, 0.95);
  border-radius: 14px;
  border: 1px solid var(--border);
  box-shadow: 0 18px 40px var(--shadow);
  padding: 12px;
  min-width: 220px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: all 0.25s ease;
  z-index: 1200;
}

.nav-dropdown.open .nav-dropdown-menu,
.nav-dropdown:focus-within .nav-dropdown-menu {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.nav-dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  color: var(--muted);
  text-decoration: none;
  font-size: 0.95rem;
  transition: all 0.25s ease;
  background: transparent;
}

.nav-dropdown-item:hover,
.nav-dropdown-item:focus,
.nav-dropdown-item.active {
  color: var(--text);
  background: rgba(0, 210, 255, 0.08);
  box-shadow: 0 12px 26px rgba(0, 210, 255, 0.18);
}

@media (max-width: 992px) {
  .nav-dropdown {
    width: 100%;
  }

  .nav-dropdown .nav-link {
    width: 100%;
    justify-content: space-between;
  }

  .nav-dropdown-menu {
    position: static;
    margin-top: 10px;
    width: 100%;
    box-shadow: none;
    transform: none;
    background: rgba(15, 26, 48, 0.85);
  }
}

/* Container and Layout */
.container {
  max-width: 1200px;
  margin: 24px auto;
  padding: 0 16px;
  width: 100%;
  box-sizing: border-box;
}

/* Card System with 3D Effects */
.card {
  background: var(--gradient);
  padding: 24px;
  border-radius: 16px;
  box-shadow: 0 18px 40px var(--shadow);
  border: 1px solid var(--border);
  margin-bottom: 24px;
  transition: all 0.3s ease;
  animation: fadeIn 0.6s ease-out;
}

.card:hover {
  transform: translateY(-6px);
  box-shadow: 0 24px 60px rgba(3, 17, 38, 0.65);
  background: var(--card-hover);
}

.card h2 {
  margin-top: 0;
  margin-bottom: 16px;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Grid Layouts */
.grid {
  display: grid;
  gap: 24px;
  grid-template-columns: 1fr;
}

.grid-2 {
  grid-template-columns: 1.2fr 0.8fr;
}

.grid-3 {
  grid-template-columns: repeat(3, 1fr);
}

/* iOS Safari Compatibility */
* {
  -webkit-box-sizing: border-box;
  -moz-box-sizing: border-box;
  box-sizing: border-box;
}

body {
  -webkit-text-size-adjust: 100%;
  -ms-text-size-adjust: 100%;
  text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* iOS Safe Area Support */
.navbar {
  padding-top: env(safe-area-inset-top);
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
}

.container {
  padding-left: max(16px, env(safe-area-inset-left));
  padding-right: max(16px, env(safe-area-inset-right));
  width: 100%;
  box-sizing: border-box;
}

/* Responsive Design - Moved to theme.css to avoid conflicts */

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 12px 20px;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.3s ease;
  font-size: 0.9rem;
}

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

.btn-secondary {
  background: var(--card);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-danger {
  background: var(--error);
  color: white;
}

.btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.8rem;
  margin-right: 8px;
}

/* Account Info */
.account-info p {
  margin: 8px 0;
}

.badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
}

.badge.premium {
  background: rgba(251, 191, 36, 0.2);
  color: var(--warning);
}

.badge.free {
  background: rgba(156, 163, 175, 0.2);
  color: var(--muted);
}

/* Status Display */
.status-display {
  text-align: center;
  padding: 20px;
}

.current-value {
  font-size: 2.5rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.current-value .unit {
  font-size: 1rem;
  color: var(--muted);
  margin-left: 4px;
}

.threshold-info {
  color: var(--muted);
  margin-top: 8px;
}

/* Status Indicators */
.status-indicator {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 0.9rem;
  font-weight: 600;
  margin: 8px 0;
}

.status-above {
  background: rgba(239, 68, 68, 0.2);
  color: var(--error);
}

.status-below {
  background: rgba(74, 222, 128, 0.2);
  color: var(--success);
}

.status-connected {
  background: rgba(74, 222, 128, 0.2);
  color: var(--success);
}

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

/* Premium Invite */
.premium-invite {
  background: rgba(251, 191, 36, 0.1);
  padding: 16px;
  border-radius: 8px;
  border: 1px solid rgba(251, 191, 36, 0.2);
  margin-top: 16px;
}

.premium-invite h3 {
  margin-top: 0;
  color: var(--warning);
}

.premium-invite ul {
  margin: 12px 0;
  padding-left: 20px;
}

.premium-invite li {
  margin: 4px 0;
  color: var(--muted);
}

/* Event Log */
.events-list {
  max-height: 300px;
  overflow-y: auto;
}

.event-item {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  gap: 12px;
  padding: 12px;
  border-bottom: 1px solid var(--border);
  align-items: center;
}

.event-time {
  font-size: 0.8rem;
  color: var(--muted);
}

.event-type {
  font-weight: 600;
  color: var(--text);
}

.event-message {
  font-size: 0.9rem;
  color: var(--muted);
}

.event-value {
  font-weight: 600;
  color: var(--success);
}

/* No Data Display */
.no-data {
  text-align: center;
  padding: 40px;
  color: var(--muted);
}

.no-data i {
  font-size: 2rem;
  margin-bottom: 12px;
  display: block;
}

/* Tables */
.table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 16px;
}

.table th,
.table td {
  padding: 12px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.table th {
  background: var(--card);
  font-weight: 600;
  color: var(--text);
}

.table td {
  color: var(--muted);
}

/* Forms */
.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  margin-bottom: 4px;
  font-weight: 500;
}

.form-group input {
  width: 100%;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--card);
  color: var(--text);
}

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

/* Alerts */
.alert {
  padding: 12px 16px;
  border-radius: 6px;
  margin-bottom: 16px;
}

.alert-success {
  background: rgba(74, 222, 128, 0.1);
  color: var(--success);
  border: 1px solid rgba(74, 222, 128, 0.2);
}

.alert-error {
  background: rgba(239, 68, 68, 0.1);
  color: var(--error);
  border: 1px solid rgba(239, 68, 68, 0.2);
}

/* Animations */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
