/* ==================== RESET & BASE ==================== */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', sans-serif;
  font-weight: 300;
  background: #000;
  color: #e0e0e0;
  line-height: 1.5;
  padding: 24px;
}

#app {
  max-width: 900px;
  margin: 0 auto;
}

/* ==================== ALPINE HELPERS ==================== */
[x-cloak] {
  display: none !important;
}

/* ==================== LOGIN SCREEN ==================== */
#login-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 80vh;
}

.login-container {
  width: 100%;
  max-width: 400px;
  background: #0a0a0a;
  padding: 48px 40px;
  border-radius: 24px;
  border: 1px solid #2a2a2a;
  text-align: center;
}

.login-logo {
  width: 256px;
  margin-bottom: 8px;
}

.login-container h1 {
  font-weight: 300;
  font-size: 32px;
  letter-spacing: -0.5px;
  margin-bottom: 32px;
  color: #fff;
}

.login-container form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.login-container input {
  width: 100%;
  padding: 14px 20px;
  background: #000;
  border: 1px solid #3a3a3a;
  color: #fff;
  border-radius: 40px;
  font-size: 16px;
  font-weight: 300;
  outline: none;
  transition: border-color 0.2s;
}

.login-container input:focus {
  border-color: #fff;
}

.login-container button {
  width: 100%;
  padding: 14px;
  background: #fff;
  color: #000;
  border: none;
  border-radius: 40px;
  font-size: 16px;
  font-weight: 400;
  cursor: pointer;
  margin-top: 8px;
  transition: all 0.15s;
}

.login-container button:hover {
  background: #e0e0e0;
}

.login-container button:active {
  background: #000;
  color: #fff;
  outline: 1px solid #fff;
}

.error {
  color: #ff4d4d;
  margin-top: 16px;
  font-size: 14px;
  min-height: 20px;
}

/* ==================== DASHBOARD HEADER ==================== */
.dashboard-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 8px;
}

#blocklist-size {
  font-weight: 300;
  font-size: 48px;
  letter-spacing: -1px;
  color: #fff;
  margin: 0;
  line-height: 1.1;
}

.update-time {
  color: #888;
  font-size: 14px;
  margin-top: 4px;
  font-weight: 300;
}

/* ==================== DIVIDERS ==================== */
hr {
  border: none;
  margin: 20px 0;
}

hr.divider-strong {
  border-top: 1px solid #444;
}

hr.divider-light {
  border-top: 1px solid #2a2a2a;
  margin: 16px 0;
}

/* ==================== SECTION HEADINGS ==================== */
h2 {
  font-weight: 300;
  font-size: 28px;
  letter-spacing: -0.5px;
  color: #fff;
  margin: 32px 0 8px;
}

/* ==================== STATS ROW ==================== */
.stats-row {
  display: flex;
  gap: 40px;
  margin: 20px 0;
}

.stat-item {
  display: flex;
  flex-direction: column;
}

.stat-value {
  font-size: 36px;
  font-weight: 300;
  color: #fff;
}

.stat-label {
  font-size: 14px;
  color: #888;
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* ==================== PILL BUTTON ==================== */
.pill-button {
  background: transparent;
  color: #e0e0e0;
  border: 1px solid #444;
  padding: 8px 20px;
  border-radius: 40px;
  font-size: 14px;
  font-weight: 300;
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
}

.pill-button:hover {
  border-color: #fff;
  color: #fff;
}

.pill-button:active {
  background: #fff;
  color: #000;
}

/* ==================== INPUT FIELD ==================== */
.input-field {
  width: 100%;
  padding: 10px 14px;
  background: #0a0a0a;
  border: 1px solid #3a3a3a;
  color: #e0e0e0;
  border-radius: 30px;
  font-size: 14px;
  font-weight: 300;
  outline: none;
  transition: border-color 0.2s;
  font-family: inherit;
}

.input-field:focus {
  border-color: #fff;
}

/* ==================== PILL SELECT ==================== */
.pill-select {
  width: 100%;
  padding: 10px 40px 10px 14px;
  background: #0a0a0a;
  border: 1px solid #3a3a3a;
  color: #fff;
  border-radius: 30px;
  font-size: 14px;
  font-weight: 300;
  cursor: pointer;
  outline: none;
  transition: border-color 0.2s;
  appearance: none;
  -webkit-appearance: none;
  font-family: inherit;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23888888' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 16px;
}

.pill-select:focus {
  border-color: #fff;
}

.pill-select optgroup {
  background: #1a1a1a;
  color: #888;
  font-weight: 500;
}

.pill-select option {
  background: #0a0a0a;
  color: #e0e0e0;
  padding: 8px;
}

/* ==================== LOGS HEADER ==================== */
.logs-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.logs-controls {
  display: flex;
  align-items: center;
  gap: 16px;
}

.auto-refresh-label {
  color: #888;
  font-size: 14px;
  font-weight: 300;
}

/* ==================== LOGS TABLE ==================== */
.logs-table {
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid #2a2a2a;
}

.log-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  padding: 12px 20px;
  border-bottom: 1px solid #1a1a1a;
  font-size: 14px;
  gap: 16px;
}

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

.log-row.blocked {
  background: rgba(255, 80, 80, 0.08);
}

.log-row.allowlisted {
  background: rgba(80, 255, 120, 0.06);
}

.log-domain {
  font-weight: 400;
  word-break: break-all;
  overflow: hidden;
  text-overflow: ellipsis;
}

.log-status {
  text-align: right;
  text-transform: capitalize;
  white-space: nowrap;
}

.log-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  width: fit-content;
}

/* ==================== ICON ACTIONS ==================== */
.icon-action {
  width: 32px;
  height: 32px;
  border-radius: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s;
  border: 1px solid transparent;
}

.icon-action.allow {
  color: #4caf50;
  border-color: #4caf50;
}

.icon-action.deny {
  color: #f44336;
  border-color: #f44336;
}

.icon-action:hover.allow {
  background: #4caf50;
  color: #000;
}

.icon-action:hover.deny {
  background: #f44336;
  color: #000;
}

.icon-action:active {
  transform: scale(0.92);
}

.icon-action svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

/* ==================== PAGINATION ==================== */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 20px;
  margin: 20px 0;
}

.pagination span {
  color: #888;
  font-size: 14px;
}

.pagination button {
  background: transparent;
  border: 1px solid #444;
  color: #e0e0e0;
  padding: 8px 20px;
  border-radius: 40px;
  cursor: pointer;
  font-family: inherit;
  font-size: 14px;
  transition: all 0.15s;
}

.pagination button:hover:not(:disabled) {
  border-color: #fff;
  color: #fff;
}

.pagination button:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

/* ==================== SWITCH ==================== */
.switch {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 26px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: #2a2a2a;
  border-radius: 26px;
  transition: 0.2s;
  border: 1px solid #444;
}

.slider:before {
  position: absolute;
  content: "";
  height: 20px;
  width: 20px;
  left: 3px;
  bottom: 2px;
  background: #fff;
  border-radius: 50%;
  transition: 0.2s;
}

input:checked + .slider {
  background: #fff;
  border-color: #fff;
}

input:checked + .slider:before {
  transform: translateX(22px);
  background: #000;
}

/* ==================== LIST SECTIONS ==================== */
.list-section {
  margin: 32px 0;
  padding: 24px;
  border-radius: 24px;
}

.allowlist-section {
  background: rgba(76, 175, 80, 0.06);
  border: 1px solid rgba(76, 175, 80, 0.2);
}

.denylist-section {
  background: rgba(244, 67, 54, 0.06);
  border: 1px solid rgba(244, 67, 54, 0.2);
}

.list-section h2 {
  margin: 0;
  color: #fff;
}

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

.list-actions {
  display: flex;
  gap: 12px;
  align-items: center;
}

/* ==================== ICON BUTTON ==================== */
.icon-button {
  width: 40px;
  height: 40px;
  border-radius: 40px;
  background: transparent;
  border: 1px solid #555;
  color: #fff;
  font-size: 24px;
  font-weight: 300;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  font-family: inherit;
  line-height: 1;
}

.icon-button:hover {
  border-color: #fff;
  background: rgba(255, 255, 255, 0.05);
}

.icon-button:active {
  background: #fff;
  color: #000;
}

/* ==================== FOLDERS ==================== */
.folder {
  margin: 12px 0;
  padding: 12px;
  border-radius: 12px;
  margin-bottom: 12px;
}

.named-folder {
  border: 1px solid rgba(76, 175, 80, 0.15);
  background: rgba(76, 175, 80, 0.04);
}

.denylist-section .named-folder {
  background: rgba(244, 67, 54, 0.04);
  border-color: rgba(244, 67, 54, 0.15);
}

.root-folder {
  border: none;
  background: none;
  padding: 0;
}

.folder-summary {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
}

.folder-summary span:first-child {
  flex: 1;
  font-weight: 400;
}

.folder-count {
  color: #666;
  font-size: 13px;
  margin-right: 12px;
  min-width: 36px;
  text-align: right;
}

.folder-delete {
  background: none;
  border: none;
  color: #888;
  cursor: pointer;
  padding: 4px 8px;
  font-size: 14px;
  transition: color 0.15s;
}

.folder-delete:hover {
  color: #f44336;
}

.folder-content {
  padding: 8px 0;
}

.folder-content.hidden {
  display: none;
}

/* ==================== DOMAIN ITEMS ==================== */
.domain-add {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.domain-add input {
  flex: 1;
  padding: 8px 12px;
  background: #0a0a0a;
  border: 1px solid #3a3a3a;
  color: #fff;
  border-radius: 20px;
  font-size: 13px;
  outline: none;
  font-family: inherit;
  transition: border-color 0.2s;
}

.domain-add input:focus {
  border-color: #fff;
}

.domain-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid #1a1a1a;
}

.domain-item:last-child {
  border-bottom: none;
}

.domain-item span {
  font-weight: 300;
  word-break: break-all;
}

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

.domain-actions button {
  background: none;
  border: none;
  color: #888;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 14px;
  transition: color 0.15s;
  font-family: inherit;
}

.domain-actions button:hover {
  color: #fff;
}

/* ==================== SETTINGS ==================== */
.settings-container {
  margin: 20px 0;
}

.setting-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 0;
  border-bottom: 1px solid #1a1a1a;
  cursor: pointer;
}

.setting-item span {
  font-size: 16px;
}

.setting-item-full {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
  padding: 16px 0;
  border-bottom: 1px solid #1a1a1a;
}

.setting-item-full span {
  font-size: 16px;
}

/* ==================== TTL INPUT ==================== */
.ttl-input-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ttl-input {
  width: 100px;
  padding: 8px 12px;
  background: #0a0a0a;
  border: 1px solid #3a3a3a;
  color: #fff;
  border-radius: 30px;
  font-size: 14px;
  font-weight: 300;
  text-align: right;
  outline: none;
  transition: border-color 0.2s;
  font-family: inherit;
}

.ttl-input:focus {
  border-color: #38bdf8;
}

.ttl-input::-webkit-inner-spin-button,
.ttl-input::-webkit-outer-spin-button {
  opacity: 0.5;
  filter: invert(1);
}

.ttl-unit {
  color: #888;
  font-size: 14px;
  font-weight: 300;
}

/* ==================== LOGOUT ==================== */
.logout-link {
  text-align: center;
  margin: 40px 0;
  color: #666;
  text-decoration: underline;
  cursor: pointer;
  font-size: 14px;
  transition: color 0.15s;
}

.logout-link:hover {
  color: #aaa;
}

/* ==================== RESPONSIVE ==================== */
@media (max-width: 600px) {
  body {
    padding: 12px;
  }

  #blocklist-size {
    font-size: 32px;
  }

  .stats-row {
    gap: 20px;
    flex-wrap: wrap;
  }

  .stat-value {
    font-size: 24px;
  }

  .log-row {
    padding: 10px 12px;
    gap: 8px;
    font-size: 12px;
  }

  .list-section {
    padding: 16px;
  }

  .list-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .login-container {
    padding: 32px 24px;
  }
}
