@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap');

:root {
  --primary: #25D366;
  --primary-dark: #128C7E;
  --secondary: #075E54;
  --dark: #111827;
  --dark-light: #1F2937;
  --light: #F3F4F6;
  --white: #FFFFFF;
  --danger: #EF4444;
  --danger-light: #FEE2E2;
  --text-main: #1F2937;
  --text-muted: #6B7280;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --radius: 12px;
  --transition: all 0.3s ease;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Poppins', sans-serif;
}

body {
  background-color: var(--light);
  color: var(--text-main);
  min-height: 100vh;
}

a {
  text-decoration: none;
  color: var(--primary-dark);
}

ul {
  list-style: none;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius);
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  border: none;
  gap: 0.5rem;
  font-size: 0.95rem;
}

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

.btn-primary:hover {
  background-color: var(--primary-dark);
  box-shadow: 0 4px 12px rgba(37, 211, 102, 0.3);
}

.btn-outline {
  border: 1px solid var(--primary);
  color: var(--primary);
  background: transparent;
}

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

.btn-outline-light {
  border: 1px solid rgba(255,255,255,0.5);
  color: var(--white);
  background: transparent;
}

.btn-outline-light:hover {
  background: rgba(255,255,255,0.1);
}

.btn-danger {
  background-color: var(--danger);
  color: var(--white);
}
.btn-danger:hover {
  background-color: #dc2626;
}

.btn-block {
  width: 100%;
}

.card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow);
  transition: var(--transition);
  margin-bottom: 1.5rem;
}

.card:hover {
  box-shadow: var(--shadow-lg);
}

.form-group {
  margin-bottom: 1.25rem;
}

.form-label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 500;
  font-size: 0.9rem;
  color: var(--dark-light);
}

.form-control {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1px solid #D1D5DB;
  border-radius: 8px;
  font-size: 0.95rem;
  transition: var(--transition);
  background: #fff;
}

.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 211, 102, 0.2);
}

/* Auth Layout */
.auth-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  background: linear-gradient(135deg, var(--dark) 0%, var(--dark-light) 100%);
}

.auth-card {
  width: 100%;
  max-width: 450px;
  background: var(--white);
  border-radius: 16px;
  padding: 2.5rem 2rem;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.5);
}

.auth-header {
  text-align: center;
  margin-bottom: 2rem;
}

.auth-logo {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--dark);
}

.auth-logo i {
  color: var(--primary);
}

/* Dashboard Layout */
.app-container {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 260px;
  background-color: var(--dark);
  color: var(--white);
  display: flex;
  flex-direction: column;
  transition: var(--transition);
  position: fixed;
  height: 100vh;
  z-index: 100;
}

.sidebar-header {
  padding: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--white);
}

.sidebar-logo i {
  color: var(--primary);
  font-size: 1.5rem;
}

.sidebar-close {
  display: none;
  background: transparent;
  border: none;
  color: var(--white);
  font-size: 1.25rem;
  cursor: pointer;
}

.sidebar-menu {
  padding: 1.5rem 1rem;
  flex: 1;
  overflow-y: auto;
}

.menu-item {
  margin-bottom: 0.5rem;
}

.menu-link {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.875rem 1rem;
  border-radius: 8px;
  color: rgba(255, 255, 255, 0.7);
  transition: var(--transition);
  font-weight: 500;
}

.menu-link i {
  width: 20px;
  text-align: center;
  font-size: 1.1rem;
}

.menu-link:hover, .menu-link.active {
  background-color: rgba(37, 211, 102, 0.1);
  color: var(--primary);
}

.sidebar-footer {
  padding: 1.5rem;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.main-content {
  flex: 1;
  margin-left: 260px;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  transition: var(--transition);
}

.topbar {
  background: var(--white);
  padding: 1rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: 0;
  z-index: 90;
}

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

.menu-toggle {
  display: none;
  background: transparent;
  border: none;
  font-size: 1.5rem;
  color: var(--dark);
  cursor: pointer;
}

.page-title h1 {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--dark);
}

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

.topbar-right {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.wallet-badge {
  background: rgba(37, 211, 102, 0.1);
  color: var(--primary-dark);
  padding: 0.5rem 1rem;
  border-radius: 20px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.user-profile {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.avatar {
  width: 40px;
  height: 40px;
  background: var(--primary);
  color: var(--white);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 1.1rem;
}

.content-area {
  padding: 2rem;
  flex: 1;
}

.alert-banner {
  background-color: var(--danger-light);
  color: var(--danger);
  padding: 1rem 1.5rem;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 2rem;
  font-weight: 500;
  border: 1px solid rgba(239, 68, 68, 0.2);
}

.alert-banner i {
  font-size: 1.5rem;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.stat-card {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  margin-bottom: 0;
}

.stat-icon {
  width: 60px;
  height: 60px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.75rem;
}

.stat-icon.green { background: rgba(37, 211, 102, 0.1); color: var(--primary); }
.stat-icon.blue { background: rgba(59, 130, 246, 0.1); color: #3B82F6; }
.stat-icon.purple { background: rgba(139, 92, 246, 0.1); color: #8B5CF6; }
.stat-icon.orange { background: rgba(249, 115, 22, 0.1); color: #F97316; }

.stat-info h3 {
  font-size: 0.9rem;
  color: var(--text-muted);
  font-weight: 500;
}

.stat-info p {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--dark);
  margin-top: 0.25rem;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 1.5rem;
}

.card-header {
  margin-bottom: 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.card-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--dark);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.quick-actions-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.action-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 1.5rem;
  background: var(--light);
  border-radius: var(--radius);
  color: var(--dark);
  font-weight: 500;
  transition: var(--transition);
  border: 1px solid transparent;
}

.action-btn i {
  font-size: 1.5rem;
  color: var(--primary);
}

.action-btn:hover {
  background: var(--white);
  border-color: var(--primary);
  color: var(--primary);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.rate-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-top: 1rem;
}

.rate-card {
  background: var(--light);
  padding: 1rem;
  border-radius: 8px;
  text-align: center;
}

.rate-card span {
  display: block;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
}

.rate-card strong {
  font-size: 1.1rem;
  color: var(--dark);
}

.empty-state {
  text-align: center;
  padding: 2rem 0;
}

.empty-state i {
  font-size: 3rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
  opacity: 0.3;
}

.empty-state p {
  color: var(--text-muted);
  margin-bottom: 1.5rem;
}

.device-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.device-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem;
  background: var(--light);
  border-radius: var(--radius);
  border-left: 4px solid var(--primary);
}
.device-info h4 { font-size: 1rem; color: var(--dark); }
.device-info p { font-size: 0.85rem; color: var(--text-muted); }
.device-status {
  padding: 0.25rem 0.75rem;
  background: rgba(37, 211, 102, 0.1);
  color: var(--primary);
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
}

.gradient-card-purple {
  background: linear-gradient(135deg, #8B5CF6 0%, #6D28D9 100%);
  color: var(--white);
}

.gradient-card-purple .card-title,
.gradient-card-purple .text-muted {
  color: rgba(255, 255, 255, 0.9);
}

.gradient-card-green {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: var(--white);
}

.gradient-card-green .card-title {
  color: var(--white);
}

.ref-code-box {
  background: rgba(255, 255, 255, 0.2);
  padding: 1rem;
  border-radius: 8px;
  text-align: center;
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: 2px;
  margin: 1rem 0;
  border: 1px dashed rgba(255, 255, 255, 0.5);
}

.info-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.info-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--light);
}

.info-item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.info-label {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.info-value {
  font-weight: 500;
  color: var(--dark);
}

.badge {
  padding: 0.25rem 0.75rem;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
}

.badge-success {
  background: rgba(37, 211, 102, 0.1);
  color: var(--primary);
}

.table-responsive {
  overflow-x: auto;
}
table {
  width: 100%;
  border-collapse: collapse;
}
th, td {
  padding: 1rem;
  text-align: left;
  border-bottom: 1px solid var(--light);
}
th {
  font-weight: 600;
  color: var(--dark-light);
  background: #F9FAFB;
}

.modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
}
.modal.active {
  display: flex;
}
.modal-content {
  background: var(--white);
  border-radius: var(--radius);
  width: 100%;
  max-width: 400px;
  padding: 2rem;
  text-align: center;
  position: relative;
  animation: modalFadeIn 0.3s ease;
}
@keyframes modalFadeIn {
  from { opacity: 0; transform: translateY(-20px); }
  to { opacity: 1; transform: translateY(0); }
}

.close-modal {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: transparent;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--text-muted);
}
.qr-container {
  margin: 1.5rem 0;
  padding: 1rem;
  border: 1px solid var(--light);
  border-radius: 8px;
  background: #fff;
}
.qr-container img {
  max-width: 100%;
  height: auto;
}

.input-group {
  display: flex;
}
.input-group .form-control {
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
}
.input-group .btn {
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
}

@media (max-width: 992px) {
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.active {
    transform: translateX(0);
    box-shadow: var(--shadow-lg);
  }
  .main-content {
    margin-left: 0;
  }
  .menu-toggle, .sidebar-close {
    display: block;
  }
  .rate-cards {
    grid-template-columns: 1fr;
  }
  .topbar {
    padding: 1rem;
  }
  .content-area {
    padding: 1rem;
  }
  .quick-actions-grid {
    grid-template-columns: 1fr;
  }
}
