/* ========== TEMA CLARO (padrão) ========== */
:root[data-theme="light"] {
  --bg: #f5f7fa;
  --bg-card: #ffffff;
  --text: #1a1a1a;
  --text-muted: #6b7280;
  --border: #e5e7eb;
  --primary: #1a73e8;
  --primary-hover: #1557b0;
  --header-bg: var(--header-color, #1a73e8);
  --header-text: #ffffff;
}

/* ========== TEMA ESCURO ========== */
:root[data-theme="dark"] {
  --bg: #1a1a1a;
  --bg-card: #2d2d2d;
  --text: #f5f7fa;
  --text-muted: #9ca3af;
  --border: #404040;
  --primary: #60a5fa;
  --primary-hover: #3b82f6;
  --header-bg: var(--header-color, #1e293b);
  --header-text: #ffffff;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  transition: background 0.3s, color 0.3s;
}

/* ========== LOGIN ========== */
.login-container {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  padding: 20px;
}

.login-card {
  background: var(--bg-card);
  padding: 40px;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  width: 100%;
  max-width: 400px;
  text-align: center;
}

.login-card h1 {
  margin-bottom: 8px;
  color: var(--primary);
}

.login-card p {
  margin-bottom: 24px;
  color: var(--text-muted);
}

.login-card input {
  width: 100%;
  padding: 12px;
  margin-bottom: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  background: var(--bg);
  color: var(--text);
}

.login-card .btn-primary {
  width: 100%;
  margin-top: 8px;
  background: #1a73e8 !important;
  color: #ffffff !important;
  font-weight: 600;
  font-size: 16px;
  padding: 14px;
}

.login-card .btn-primary:hover {
  background: #1557b0 !important;
}

.error-msg {
  background: #fee;
  color: #c00;
  padding: 12px;
  border-radius: 6px;
  margin-bottom: 12px;
  font-size: 14px;
}

/* ========== HEADER ========== */
#main-header {
  background: var(--header-bg);
  color: var(--header-text);
  padding: 16px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  transition: background 0.3s;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

#header-logo-container img,
#login-logo-container img {
  max-height: 60px;
  max-width: 320px;
  object-fit: contain;
  image-rendering: -webkit-optimize-contrast;
  image-rendering: high-quality;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  -webkit-transform: translateZ(0);
  transform: translateZ(0);
  filter: none;
  -webkit-font-smoothing: antialiased;
}

#header-logo-container {
  display: flex;
  align-items: center;
}

#login-logo-container {
  display: flex;
  justify-content: center;
  margin-bottom: 16px;
}

#header-title {
  font-size: 20px;
  font-weight: 600;
}

#header-title.hide {
  display: none;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.btn-logout {
  background: rgba(255,255,255,0.2);
  color: var(--header-text);
  border: none;
  padding: 8px 16px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  transition: background 0.2s;
}

.btn-logout:hover {
  background: rgba(255,255,255,0.3);
}

/* ========== TOGGLE DARK MODE ========== */
.theme-toggle {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.theme-toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  width: 50px;
  height: 24px;
  background: rgba(255,255,255,0.3);
  border-radius: 24px;
  position: relative;
  transition: 0.3s;
}

.toggle-slider:before {
  content: "";
  position: absolute;
  width: 18px;
  height: 18px;
  left: 3px;
  top: 3px;
  background: white;
  border-radius: 50%;
  transition: 0.3s;
}

.theme-toggle input:checked + .toggle-slider {
  background: rgba(255,255,255,0.5);
}

.theme-toggle input:checked + .toggle-slider:before {
  transform: translateX(26px);
}

.toggle-label {
  font-size: 18px;
}

/* ========== TABS ========== */
.tabs {
  display: flex;
  background: var(--bg-card);
  border-bottom: 2px solid var(--border);
  padding: 0 24px;
}

.tab-btn {
  background: none;
  border: none;
  padding: 16px 24px;
  font-size: 15px;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 3px solid transparent;
  transition: all 0.2s;
}

.tab-btn:hover {
  color: var(--text);
}

.tab-btn.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

/* ========== MAIN ========== */
main {
  padding: 24px;
  max-width: 1200px;
  margin: 0 auto;
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

h2 {
  margin-bottom: 24px;
  font-size: 24px;
}

/* ========== CARDS ========== */
.card {
  background: var(--bg-card);
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 20px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.card h3 {
  margin-bottom: 16px;
  font-size: 18px;
  color: var(--primary);
}

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

.metric-value {
  font-size: 32px;
  font-weight: 700;
  color: var(--primary);
  margin-top: 8px;
}

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

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

.form-group input,
.form-group select {
  width: 100%;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 14px;
  background: var(--bg);
  color: var(--text);
}

.form-group small {
  display: block;
  margin-top: 4px;
  color: var(--text-muted);
  font-size: 12px;
}

/* ========== BUTTONS ========== */
.btn-primary {
  background: var(--primary);
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

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

.btn-danger {
  background: #dc2626;
  color: white;
  border: none;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
  transition: background 0.2s;
}

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

/* ========== WEBHOOK URL ========== */
.webhook-url {
  background: var(--bg);
  padding: 12px;
  border-radius: 6px;
  margin-top: 12px;
}

.webhook-url code {
  display: block;
  font-size: 12px;
  word-break: break-all;
  margin: 8px 0;
  color: var(--text-muted);
}

.webhook-url button {
  margin-top: 8px;
}

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

table th {
  background: var(--bg);
  padding: 12px;
  text-align: left;
  font-weight: 600;
  border-bottom: 2px solid var(--border);
}

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

table tr:hover {
  background: var(--bg);
}
