/* ===== CSS Variables / Themes ===== */
:root,
[data-theme="dark"] {
  --bg-primary: #0f1117;
  --bg-secondary: #1a1d27;
  --bg-card: #1e2130;
  --bg-card-hover: #252840;
  --bg-input: #252840;
  --bg-navbar: #151722;
  --text-primary: #e4e6f0;
  --text-secondary: #8b8fa3;
  --text-muted: #5c5f73;
  --accent: #6c63ff;
  --accent-hover: #5a52e0;
  --accent-glow: rgba(108, 99, 255, 0.15);
  --success: #2ecc71;
  --danger: #e74c3c;
  --danger-hover: #c0392b;
  --warning: #f39c12;
  --border: #2a2d3e;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
  --radius: 12px;
  --radius-sm: 8px;
}

[data-theme="light"] {
  --bg-primary: #f0f2f5;
  --bg-secondary: #ffffff;
  --bg-card: #ffffff;
  --bg-card-hover: #f8f9fc;
  --bg-input: #f0f2f5;
  --bg-navbar: #ffffff;
  --text-primary: #1a1d27;
  --text-secondary: #5c5f73;
  --text-muted: #8b8fa3;
  --accent: #6c63ff;
  --accent-hover: #5a52e0;
  --accent-glow: rgba(108, 99, 255, 0.08);
  --border: #e2e5ed;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.04);
}

/* ===== Reset & Base ===== */
*, *::before, *::after {
  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-primary);
  color: var(--text-primary);
  min-height: 100vh;
  transition: background 0.3s, color 0.3s;
}

a { color: inherit; text-decoration: none; }
button { cursor: pointer; font-family: inherit; }

/* ===== Navbar ===== */
.navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  height: 60px;
  background: var(--bg-navbar);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}

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

.nav-icon {
  font-size: 22px;
  color: var(--accent);
}

.nav-title {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: var(--bg-input);
  color: var(--text-secondary);
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.nav-btn:hover {
  background: var(--accent-glow);
  color: var(--accent);
}

.profile-btn {
  position: relative;
  overflow: hidden;
}

.profile-btn img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

/* ===== Dashboard Layout ===== */
.dashboard {
  max-width: 1100px;
  margin: 0 auto;
  padding: 32px 24px;
  display: flex;
  flex-direction: column;
  gap: 32px;
}

.dashboard-section h2 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.dashboard-section h2 i {
  color: var(--accent);
}

/* ===== Cards Grid ===== */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}

.link-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px;
  background: var(--bg-card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  transition: all 0.25s ease;
  box-shadow: var(--shadow-sm);
}

.link-card:hover {
  background: var(--bg-card-hover);
  border-color: var(--accent);
  box-shadow: var(--shadow), 0 0 0 1px var(--accent);
  transform: translateY(-2px);
}

.card-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-sm);
  background: var(--accent-glow);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

.card-info h3 {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 2px;
}

.card-info p {
  font-size: 13px;
  color: var(--text-muted);
}

.card-arrow {
  margin-left: auto;
  color: var(--text-muted);
  font-size: 12px;
  transition: color 0.2s;
}

.link-card:hover .card-arrow {
  color: var(--accent);
}

/* ===== Minecraft Status ===== */
.mc-status-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 24px;
  box-shadow: var(--shadow-sm);
}

.mc-status-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.mc-status-indicator {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
}

.status-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  display: inline-block;
}

.status-dot.online {
  background: var(--success);
  box-shadow: 0 0 8px var(--success);
  animation: pulse 2s infinite;
}

.status-dot.offline {
  background: var(--danger);
  box-shadow: 0 0 8px var(--danger);
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.mc-status-details {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
}

.mc-detail {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.mc-label {
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.mc-value {
  font-size: 15px;
  font-weight: 500;
}

.mc-player-list {
  grid-column: 1 / -1;
  margin-top: 8px;
}

.mc-player-list .player-tag {
  display: inline-block;
  padding: 4px 10px;
  background: var(--accent-glow);
  color: var(--accent);
  border-radius: 20px;
  font-size: 13px;
  margin: 4px 4px 0 0;
}

/* ===== Wake on LAN ===== */
.wol-container {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.wol-devices {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 12px;
}

.wol-device-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 20px;
  background: var(--bg-card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.wol-device-info {
  flex: 1;
}

.wol-device-info h4 {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 2px;
}

.wol-device-info p {
  font-size: 12px;
  color: var(--text-muted);
  font-family: 'SF Mono', 'Courier New', monospace;
}

.wol-wake-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: var(--success);
  color: #fff;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  flex-shrink: 0;
}

.wol-wake-btn:hover {
  background: #27ae60;
  transform: scale(1.1);
  box-shadow: 0 0 12px rgba(46, 204, 113, 0.4);
}

.wol-wake-btn.sending {
  animation: spin 1s linear infinite;
}

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

.wol-delete-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.wol-delete-btn:hover {
  background: rgba(231, 76, 60, 0.1);
  color: var(--danger);
}

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

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

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

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

.btn-secondary:hover {
  border-color: var(--accent);
  color: var(--accent);
}

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

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

.btn-sm {
  padding: 6px 12px;
  font-size: 13px;
  border-radius: 6px;
  background: var(--bg-input);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

.btn-sm:hover {
  color: var(--accent);
  border-color: var(--accent);
}

.btn-block {
  width: 100%;
  justify-content: center;
}

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

.form-group label {
  display: block;
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 6px;
  font-weight: 500;
}

.form-group input[type="text"],
.form-group input[type="password"],
.form-group input[type="url"],
.form-group input[type="email"] {
  width: 100%;
  padding: 12px 16px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 14px;
  transition: border-color 0.2s;
  outline: none;
}

.form-group input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.form-group input[type="file"] {
  font-size: 13px;
  color: var(--text-secondary);
}

.input-row {
  display: flex;
  gap: 8px;
}

.input-row input {
  flex: 1;
}

/* ===== Login ===== */
.login-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: var(--bg-primary);
}

.login-container {
  width: 100%;
  max-width: 420px;
  padding: 24px;
}

.login-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 40px 32px;
  box-shadow: var(--shadow);
}

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

.login-logo {
  font-size: 48px;
  color: var(--accent);
  margin-bottom: 12px;
}

.login-header h1 {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 4px;
}

.login-subtitle {
  color: var(--text-muted);
  font-size: 14px;
}

.error-message {
  margin-top: 16px;
  padding: 12px 16px;
  background: rgba(231, 76, 60, 0.1);
  border: 1px solid rgba(231, 76, 60, 0.3);
  border-radius: var(--radius-sm);
  color: var(--danger);
  font-size: 13px;
  text-align: center;
}

.success-message {
  margin-top: 16px;
  padding: 12px 16px;
  background: rgba(46, 204, 113, 0.1);
  border: 1px solid rgba(46, 204, 113, 0.3);
  border-radius: var(--radius-sm);
  color: var(--success);
  font-size: 13px;
  text-align: center;
}

/* ===== Modal ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 24px;
}

.modal {
  background: var(--bg-secondary);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  width: 100%;
  max-width: 520px;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: var(--shadow);
}

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

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

.modal-header h2 {
  font-size: 18px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}

.modal-header h2 i {
  color: var(--accent);
}

.modal-close {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: var(--bg-input);
  color: var(--text-secondary);
  font-size: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.modal-close:hover {
  background: rgba(231, 76, 60, 0.1);
  color: var(--danger);
}

.modal-body {
  padding: 24px;
}

.settings-group {
  margin-bottom: 28px;
  padding-bottom: 28px;
  border-bottom: 1px solid var(--border);
}

.settings-group:last-child {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}

.settings-group h3 {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 16px;
}

.settings-hint {
  font-size: 13px;
  color: var(--text-muted);
}

.profile-preview {
  text-align: center;
  margin-bottom: 16px;
  color: var(--text-muted);
}

.profile-preview img {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--border);
}

/* ===== Toast Notifications ===== */
.toast-container {
  position: fixed;
  top: 72px;
  right: 24px;
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  box-shadow: var(--shadow);
  animation: slideIn 0.3s ease, fadeOut 0.3s ease 2.7s;
  max-width: 350px;
}

.toast.success {
  background: var(--success);
  color: #fff;
}

.toast.error {
  background: var(--danger);
  color: #fff;
}

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

@keyframes fadeOut {
  to { opacity: 0; transform: translateX(50%); }
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
  .dashboard {
    padding: 20px 16px;
  }

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

  .wol-devices {
    grid-template-columns: 1fr;
  }

  .navbar {
    padding: 0 16px;
  }

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