/* WattWächter Web Portal - CSS Styles */

:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-light: #3b82f6;
  --secondary: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --dark: #1f2937;
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-900: #111827;
  --white: #ffffff;
  --shadow: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.24);
  --shadow-lg: 0 10px 20px rgba(0,0,0,0.19), 0 6px 6px rgba(0,0,0,0.23);
  --radius: 8px;
}

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

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--gray-100);
  color: var(--dark);
  line-height: 1.6;
}

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

/* Sidebar */
.sidebar {
  width: 260px;
  background: var(--dark);
  color: var(--white);
  padding: 0;
  position: fixed;
  height: 100vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.sidebar-header {
  padding: 20px;
  border-bottom: 1px solid var(--gray-700);
  display: flex;
  align-items: center;
  gap: 12px;
}

.sidebar-logo {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
}

.sidebar-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.sidebar-title {
  font-size: 18px;
  font-weight: 600;
  color: rgb(17, 144, 249);
}

.sidebar-nav {
  padding: 16px 0;
  flex: 1;
}

.nav-section {
  padding: 8px 20px;
  font-size: 11px;
  text-transform: uppercase;
  color: var(--gray-400);
  letter-spacing: 1px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  color: var(--gray-300);
  text-decoration: none;
  transition: all 0.2s;
  border-left: 3px solid transparent;
}

.nav-item:hover {
  background: var(--gray-700);
  color: var(--white);
}

.nav-item.active {
  background: var(--gray-700);
  color: var(--white);
  border-left-color: var(--primary);
}

.nav-item svg {
  width: 20px;
  height: 20px;
  opacity: 0.7;
}

.nav-item.active svg {
  opacity: 1;
}

/* Main Content */
.main-content {
  flex: 1;
  margin-left: 260px;
  padding: 24px;
}

/* Header */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.page-title {
  font-size: 24px;
  font-weight: 600;
  color: var(--dark);
}

.header-actions {
  display: flex;
  gap: 12px;
}

/* Cards */
.card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  margin-bottom: 20px;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--gray-200);
}

.card-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--dark);
}

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

.stat-card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  display: flex;
  align-items: flex-start;
  gap: 16px;
}

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
}

.stat-icon.blue { background: #dbeafe; color: var(--primary); }
.stat-icon.green { background: #d1fae5; color: var(--secondary); }
.stat-icon.yellow { background: #fef3c7; color: var(--warning); }
.stat-icon.red { background: #fee2e2; color: var(--danger); }

.stat-content {
  flex: 1;
}

.stat-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--dark);
  line-height: 1.2;
}

.stat-label {
  font-size: 14px;
  color: var(--gray-500);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
  text-decoration: none;
}

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

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

.btn-primary:disabled {
  background: var(--gray-400);
  cursor: not-allowed;
}

.btn-secondary {
  background: var(--gray-200);
  color: var(--dark);
}

.btn-secondary:hover {
  background: var(--gray-300);
}

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

.btn-outline:hover {
  background: var(--gray-100);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 13px;
}

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

.btn-danger:hover {
  background: #dc2626;
}

/* Status Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
}

.badge-success {
  background: #d1fae5;
  color: #065f46;
}

.badge-warning {
  background: #fef3c7;
  color: #92400e;
}

.badge-danger {
  background: #fee2e2;
  color: #991b1b;
}

.badge-info {
  background: #dbeafe;
  color: #1e40af;
}

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

.form-label {
  display: block;
  margin-bottom: 6px;
  font-size: 14px;
  font-weight: 500;
  color: var(--gray-700);
}

.form-input {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius);
  font-size: 14px;
  transition: border-color 0.2s;
}

.form-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-input:disabled {
  background: var(--gray-100);
  cursor: not-allowed;
}

.form-hint {
  display: block;
  font-size: 12px;
  color: var(--gray-500);
  margin-top: 4px;
}

.form-select {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius);
  font-size: 14px;
  background: var(--white);
}

/* Device List */
.device-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.device-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px;
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
  color: inherit;
}

.device-item:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}

.device-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
}

.device-icon.electricity { background: #fef3c7; }
.device-icon.gas { background: #dbeafe; }
.device-icon.water { background: #d1fae5; }

.device-info {
  flex: 1;
}

.device-name {
  font-weight: 600;
  color: var(--dark);
}

.device-location {
  font-size: 13px;
  color: var(--gray-500);
}

.device-stats {
  text-align: right;
}

.device-value {
  font-size: 18px;
  font-weight: 600;
  color: var(--dark);
}

.device-unit {
  font-size: 12px;
  color: var(--gray-500);
}

/* Language Switcher */
.lang-switcher {
  position: absolute;
  top: 20px;
  right: 20px;
  display: flex;
  gap: 8px;
  z-index: 100;
}

.lang-btn {
  padding: 6px 12px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  background: rgba(255, 255, 255, 0.1);
  color: var(--white);
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.lang-btn:hover {
  background: rgba(255, 255, 255, 0.2);
}

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

/* Sidebar language switcher */
.sidebar .lang-switcher {
  position: static;
  padding: 12px 20px;
  border-top: 1px solid var(--gray-700);
}

.sidebar .lang-btn {
  flex: 1;
  text-align: center;
  border-color: var(--gray-600);
  background: transparent;
  color: var(--gray-300);
}

.sidebar .lang-btn:hover {
  background: var(--gray-700);
}

.sidebar .lang-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--white);
}

/* Login Page */
.login-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  position: relative;
}

.login-box {
  background: var(--white);
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
  padding: 40px;
  width: 100%;
  max-width: 420px;
}

.login-header {
  text-align: center;
  margin-bottom: 32px;
}

.login-logo {
  width: 64px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
  font-size: 32px;
}

.login-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.login-title {
  font-size: 24px;
  font-weight: 600;
  color: var(--dark);
}

.login-subtitle {
  color: var(--gray-500);
  margin-top: 8px;
}

.login-form .btn {
  width: 100%;
  justify-content: center;
  padding: 12px;
}

.login-footer {
  text-align: center;
  margin-top: 24px;
  color: var(--gray-500);
  font-size: 14px;
}

.login-footer a {
  color: var(--primary);
  text-decoration: none;
}

/* OTP specific styles */
.otp-section {
  display: none;
}

.otp-section.visible {
  display: block;
}

.email-section.hidden {
  display: none;
}

.register-section {
  display: none;
}

.register-section.visible {
  display: block;
}

.not-approved-section {
  display: none;
}

.not-approved-section.visible {
  display: block;
}

.otp-input {
  text-align: center;
  font-size: 24px;
  letter-spacing: 8px;
  font-weight: 600;
}

.otp-info {
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 16px;
}

.otp-info p {
  margin: 0;
  font-size: 14px;
  color: var(--gray-600);
}

.otp-info .email-display {
  font-weight: 600;
  color: var(--gray-900);
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 14px;
  color: var(--primary);
  cursor: pointer;
  margin-bottom: 16px;
}

.back-link:hover {
  text-decoration: underline;
}

/* User Menu */
.user-menu {
  padding: 16px 20px;
  border-top: 1px solid var(--gray-700);
  margin-top: auto;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px;
  margin: -8px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.2s;
  text-decoration: none;
  color: inherit;
}

.user-info:hover {
  background: var(--gray-700);
}

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

.user-name {
  font-size: 14px;
  font-weight: 500;
}

.user-email {
  font-size: 12px;
  color: var(--gray-400);
}

/* Sidebar Logout Button */
.sidebar .btn-logout {
  width: 100%;
  margin-top: 12px;
  background: transparent;
  border: 1px solid var(--gray-600);
  color: var(--gray-300);
  padding: 8px 12px;
  font-size: 13px;
}

.sidebar .btn-logout:hover {
  background: var(--gray-700);
  border-color: var(--gray-500);
  color: var(--white);
}

/* Alert */
.alert {
  padding: 16px;
  border-radius: var(--radius);
  margin-bottom: 20px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.alert-info {
  background: #dbeafe;
  color: #1e40af;
}

.alert-success {
  background: #d1fae5;
  color: #065f46;
}

.alert-warning {
  background: #fef3c7;
  color: #92400e;
}

.alert-danger {
  background: #fee2e2;
  color: #991b1b;
}

/* Loading Spinner */
.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--gray-300);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.spinner.white {
  border-color: rgba(255,255,255,0.3);
  border-top-color: white;
}

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

/* Empty State */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--gray-500);
}

.empty-state-icon {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.5;
}

.empty-state-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--dark);
  margin-bottom: 8px;
}

/* Device Cards Grid (Dashboard) */
.device-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}

.device-card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  cursor: pointer;
  transition: all 0.2s;
}

.device-card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}

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

.device-card-icon {
  width: 40px;
  height: 40px;
  background: #fef3c7;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
}

.device-card-name {
  font-size: 16px;
  font-weight: 600;
  color: var(--dark);
  margin-bottom: 4px;
}

.device-card-location {
  font-size: 13px;
  color: var(--gray-500);
  margin-bottom: 16px;
}

.device-card-stats {
  display: flex;
  gap: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--gray-200);
}

.device-card-stat {
  flex: 1;
}

.device-card-stat-value {
  font-size: 18px;
  font-weight: 600;
  color: var(--dark);
}

.device-card-stat-label {
  font-size: 12px;
  color: var(--gray-500);
}

/* Device card stats - row layout */
.device-card-stats-rows {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--gray-200);
}

.device-card-stat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.device-card-stat-row .device-card-stat-label {
  font-size: 13px;
  color: var(--gray-600);
}

.device-card-stat-row .device-card-stat-value {
  font-size: 14px;
  font-weight: 600;
  color: var(--dark);
  text-align: right;
  min-width: 120px;
}

/* Device Detail Page */
.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 24px;
}

.detail-card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
}

.detail-card-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--gray-500);
  margin-bottom: 16px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.detail-row {
  display: flex;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--gray-100);
}

.detail-row:last-child {
  border-bottom: none;
}

.detail-label {
  color: var(--gray-600);
  font-size: 14px;
}

.detail-value {
  color: var(--dark);
  font-weight: 500;
  font-size: 14px;
}

.live-value {
  font-size: 36px;
  font-weight: 700;
  color: var(--dark);
  line-height: 1.2;
}

.live-unit {
  font-size: 16px;
  color: var(--gray-500);
  margin-left: 4px;
}

.live-label {
  font-size: 14px;
  color: var(--gray-500);
  margin-top: 4px;
}

.chart-container {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  margin-bottom: 24px;
}

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

.chart-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--dark);
}

.chart-placeholder {
  height: 300px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--gray-50);
  border-radius: var(--radius);
  color: var(--gray-400);
  font-size: 14px;
}

.time-filter {
  display: flex;
  gap: 8px;
}

.time-btn {
  padding: 6px 12px;
  border: 1px solid var(--gray-300);
  background: var(--white);
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
  color: var(--gray-600);
  transition: all 0.2s;
}

.time-btn:hover {
  background: var(--gray-100);
}

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

/* Live View Indicator */
.chart-title {
  display: flex;
  align-items: center;
  gap: 12px;
}

.live-indicator {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: var(--gray-100);
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
  color: var(--gray-500);
  transition: all 0.3s;
}

.live-indicator.active {
  background: rgba(16, 185, 129, 0.15);
  color: var(--secondary);
}

.live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--gray-400);
  transition: all 0.3s;
}

.live-indicator.active .live-dot {
  background: var(--secondary);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.6;
    transform: scale(1.2);
  }
}

.live-status {
  font-size: 12px;
  color: var(--gray-500);
}

/* Chart Date Navigation */
.chart-date-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 16px;
  padding: 12px;
  background: var(--gray-50);
  border-radius: var(--radius);
  position: relative;
}

.nav-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: 1px solid var(--gray-300);
  background: var(--white);
  border-radius: 6px;
  cursor: pointer;
  color: var(--gray-600);
  transition: all 0.2s;
}

.nav-btn:hover:not(:disabled) {
  background: var(--gray-100);
  border-color: var(--gray-400);
}

.nav-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.nav-btn.today-btn {
  width: auto;
  padding: 0 12px;
  font-size: 13px;
  font-weight: 500;
}

.date-display {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: var(--white);
  border: 1px solid var(--gray-300);
  border-radius: 6px;
  cursor: pointer;
  min-width: 200px;
  justify-content: center;
  font-size: 14px;
  font-weight: 500;
  color: var(--dark);
  transition: all 0.2s;
}

.date-display:hover {
  background: var(--gray-50);
  border-color: var(--primary);
}

.date-display svg {
  color: var(--gray-500);
}

/* Detail Card Header Row */
.detail-card-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.detail-card-header-row .detail-card-title {
  margin-bottom: 0;
}

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

/* Modal */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}

.modal {
  background: var(--white);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 540px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
}

.modal.modal-sm {
  max-width: 440px;
}

.modal form {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

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

.modal-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--dark);
  margin: 0;
}

.modal-close {
  background: none;
  border: none;
  font-size: 24px;
  color: var(--gray-400);
  cursor: pointer;
  padding: 0;
  line-height: 1;
}

.modal-close:hover {
  color: var(--gray-600);
}

.modal-body {
  padding: 24px;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  flex-shrink: 0;
  gap: 12px;
  padding: 16px 24px;
  border-top: 1px solid var(--gray-200);
  background: var(--gray-50);
}

/* Form Sections */
.form-section {
  margin-bottom: 24px;
}

.form-section:last-child {
  margin-bottom: 0;
}

.form-section-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--gray-500);
  margin-bottom: 16px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.form-row {
  display: flex;
  gap: 12px;
}

.form-row .form-group {
  flex: 1;
}

textarea.form-input {
  resize: vertical;
  min-height: 60px;
}

/* Pairing Modal Styles */
.pairing-instructions {
  margin-bottom: 20px;
  color: var(--gray-600);
  font-size: 14px;
  line-height: 1.6;
}

.pairing-token-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 20px;
  padding: 16px;
  background: var(--gray-50);
  border: 2px dashed var(--gray-300);
  border-radius: var(--radius);
}

.pairing-token-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  text-align: center;
}

.pairing-token {
  font-size: 28px;
  font-weight: 700;
  font-family: 'Consolas', 'Monaco', monospace;
  letter-spacing: 2px;
  color: var(--primary);
  text-align: center;
  user-select: all;
}

.btn-copy {
  align-self: center;
}

.btn-success {
  background: var(--secondary) !important;
  border-color: var(--secondary) !important;
  color: var(--white) !important;
}

.pairing-timer {
  margin-bottom: 24px;
}

.timer-bar {
  height: 6px;
  background: var(--gray-200);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 8px;
}

.timer-progress {
  height: 100%;
  background: var(--primary);
  border-radius: 3px;
  transition: width 1s linear, background 0.3s;
}

.timer-text {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 13px;
  color: var(--gray-500);
}

.timer-text svg {
  opacity: 0.7;
}

.pairing-steps {
  margin-bottom: 20px;
}

.pairing-step {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--gray-100);
}

.pairing-step:last-child {
  border-bottom: none;
}

.step-number {
  width: 28px;
  height: 28px;
  background: var(--primary);
  color: var(--white);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 600;
  flex-shrink: 0;
}

.step-text {
  font-size: 14px;
  color: var(--gray-700);
  line-height: 1.5;
  padding-top: 3px;
}

.pairing-hint {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 16px;
  background: #dbeafe;
  border-radius: var(--radius);
  font-size: 13px;
  color: #1e40af;
}

.pairing-hint svg {
  flex-shrink: 0;
  margin-top: 1px;
}

/* Responsive */
@media (max-width: 768px) {
  .sidebar {
    width: 100%;
    height: auto;
    position: relative;
  }

  .main-content {
    margin-left: 0;
  }

  .app-container {
    flex-direction: column;
  }

  .page-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
  }

  .header-actions {
    width: 100%;
    flex-wrap: wrap;
  }

  .detail-grid {
    grid-template-columns: 1fr;
  }

  .device-cards {
    grid-template-columns: 1fr;
  }

  .stats-grid {
    grid-template-columns: 1fr 1fr;
  }
}

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

  .device-card-stats {
    flex-direction: column;
    gap: 12px;
  }

  .time-filter {
    flex-wrap: wrap;
  }

  .form-row {
    flex-direction: column;
    gap: 0;
  }

  .modal {
    max-height: 100vh;
    border-radius: 0;
  }

  .modal-overlay {
    padding: 0;
  }
}

/* Delete Device Modal */
.delete-warning {
  text-align: center;
  padding: 20px 0;
  margin-bottom: 16px;
}

.delete-warning .warning-icon {
  margin-bottom: 12px;
}

.delete-warning .warning-icon svg {
  stroke: var(--danger);
}

.delete-warning .warning-text {
  font-size: 16px;
  font-weight: 600;
  color: var(--danger);
  margin: 0;
}

.delete-description {
  font-size: 14px;
  color: var(--gray-700);
  margin-bottom: 12px;
}

.delete-list {
  margin: 0 0 16px 0;
  padding-left: 24px;
}

.delete-list li {
  font-size: 14px;
  color: var(--gray-600);
  padding: 4px 0;
}

.delete-note {
  font-size: 13px;
  color: var(--gray-500);
  font-style: italic;
  padding: 12px;
  background: var(--gray-50);
  border-radius: var(--radius);
  margin: 0;
}

.btn-danger:disabled {
  background: var(--gray-400);
  cursor: not-allowed;
}

/* Tariff Table */
.tariff-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

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

.tariff-table th {
  font-weight: 600;
  color: var(--gray-500);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background: var(--gray-50);
}

.tariff-table tbody tr:hover {
  background: var(--gray-50);
}

.tariff-table tbody tr:last-child td {
  border-bottom: none;
}

.tariff-row-active {
  background: rgba(16, 185, 129, 0.05);
}

.tariff-row-active:hover {
  background: rgba(16, 185, 129, 0.1) !important;
}

.tariff-actions {
  white-space: nowrap;
}

.tariff-actions .btn {
  margin-left: 4px;
}

.tariff-actions .btn:first-child {
  margin-left: 0;
}

/* Extra small buttons */
.btn-xs {
  padding: 4px 8px;
  font-size: 12px;
  gap: 4px;
}

/* Danger outline button */
.btn-danger-outline {
  border-color: var(--danger);
  color: var(--danger);
}

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

/* ==================== */
/* Legal Footer Styles  */
/* ==================== */

.legal-footer {
  background: var(--gray-100);
  border-top: 1px solid var(--gray-200);
  padding: 20px;
  margin-top: auto;
}

.legal-footer-content {
  max-width: 800px;
  margin: 0 auto;
  text-align: center;
}

.legal-footer-links {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.legal-footer-links a {
  color: var(--gray-500);
  text-decoration: none;
  font-size: 13px;
  transition: color 0.2s;
}

.legal-footer-links a:hover {
  color: var(--primary);
  text-decoration: underline;
}

.footer-divider {
  color: var(--gray-300);
  font-size: 12px;
}

.legal-footer-copyright {
  font-size: 12px;
  color: var(--gray-400);
}

/* Login page footer (blue background) */
.login-container .legal-footer {
  background: rgba(255, 255, 255, 0.1);
  border-top: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
}

.login-container .legal-footer-links a {
  color: rgba(255, 255, 255, 0.8);
}

.login-container .legal-footer-links a:hover {
  color: white;
}

.login-container .footer-divider {
  color: rgba(255, 255, 255, 0.4);
}

.login-container .legal-footer-copyright {
  color: rgba(255, 255, 255, 0.6);
}

/* Main content footer (with sidebar) */
.main-content .legal-footer {
  margin-left: 0;
}

/* Legal Pages */
.legal-page-container {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: linear-gradient(135deg, #1e3a8a 0%, #3b82f6 100%);
}

.legal-page-header {
  padding: 12px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: white;
  border-bottom: none;
  box-shadow: none;
  min-height: 70px;
}

.legal-page-header .back-to-app {
  order: -1;
  margin-left: 0;
  margin-right: auto;
}

.legal-page-header .logo {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--dark);
  text-decoration: none;
  transition: opacity 0.2s ease;
}

.legal-page-header .logo:hover {
  opacity: 0.8;
}

.legal-page-header .logo-icon {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
}

.legal-page-header .logo-icon img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.legal-page-header .logo-text {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--dark);
}

.back-to-app {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--primary);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  padding: 6px 12px;
  border-radius: 6px;
  transition: all 0.2s ease;
  border: 1px solid var(--primary);
  background: white;
}
}

.back-to-app:hover {
  background-color: rgba(59, 130, 246, 0.1);
  color: white;
}

.legal-page-content {
  flex: 1;
  padding: 48px 24px 24px;
  position: relative;
}

.legal-page-content::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 48px;
  background: linear-gradient(180deg, rgba(59, 130, 246, 0.1) 0%, rgba(59, 130, 246, 0.05) 100%);
  z-index: -1;
}

.legal-card {
  background: white;
  border-radius: 16px;
  padding: 40px;
  max-width: 900px;
  margin: 0 auto;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

.legal-card h1 {
  font-size: 1.75rem;
  color: var(--dark);
  margin-bottom: 8px;
}

.legal-card .last-updated {
  font-size: 13px;
  color: var(--gray-500);
  margin-bottom: 32px;
}

.legal-card h2 {
  font-size: 1.125rem;
  color: var(--dark);
  margin-top: 32px;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--gray-200);
}

.legal-card h3 {
  font-size: 1rem;
  color: var(--dark);
  margin-top: 24px;
  margin-bottom: 8px;
}

.legal-card p {
  color: var(--gray-600);
  line-height: 1.7;
  margin-bottom: 16px;
}

.legal-card ul, .legal-card ol {
  color: var(--gray-600);
  line-height: 1.7;
  margin-bottom: 16px;
  padding-left: 24px;
}

.legal-card li {
  margin-bottom: 8px;
}

.legal-card a {
  color: var(--primary);
  text-decoration: none;
}

.legal-card a:hover {
  text-decoration: underline;
}

.legal-card .company-info {
  background: var(--gray-50);
  padding: 20px;
  border-radius: 12px;
  margin: 24px 0;
}

.legal-card .company-info p {
  margin-bottom: 8px;
}

.legal-card .company-info p:last-child {
  margin-bottom: 0;
}

.legal-card .contact-info {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin: 24px 0;
}

.legal-card .contact-item {
  background: var(--gray-50);
  padding: 16px;
  border-radius: 8px;
}

.legal-card .contact-item .label {
  font-size: 12px;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 4px;
}

.legal-card .contact-item .value {
  font-weight: 500;
  color: var(--dark);
}

/* Licenses Table */
.licenses-table {
  width: 100%;
  border-collapse: collapse;
  margin: 24px 0;
}

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

.licenses-table th {
  background: var(--gray-50);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--gray-500);
}

.licenses-table td {
  font-size: 14px;
}

.licenses-table .package-name {
  font-family: 'SF Mono', SFMono-Regular, Consolas, monospace;
  font-size: 13px;
}

.license-badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 9999px;
  font-size: 11px;
  font-weight: 600;
}

.license-badge.mit {
  background: rgba(16, 185, 129, 0.15);
  color: #059669;
}

.license-badge.apache {
  background: rgba(37, 99, 235, 0.15);
  color: #1d4ed8;
}

.license-badge.isc {
  background: rgba(245, 158, 11, 0.15);
  color: #b45309;
}

/* Legal footer on legal pages */
.legal-page-container .legal-footer {
  background: rgba(255, 255, 255, 0.1);
  border-top: none;
}

.legal-page-container .legal-footer-links a {
  color: rgba(255, 255, 255, 0.8);
}

.legal-page-container .legal-footer-links a:hover {
  color: white;
}

.legal-page-container .footer-divider {
  color: rgba(255, 255, 255, 0.4);
}

.legal-page-container .legal-footer-copyright {
  color: rgba(255, 255, 255, 0.6);
}
