/* ========== 深淺色主題變數 ========== */
:root {
  /* 深色主題 (預設) */
  --bg-primary: #0b0b0b;
  --bg-secondary: rgba(18, 18, 18, 0.8);
  --bg-card: #151515;
  --bg-input: #0f0f0f;
  --bg-member: #1a1a1a;
  --border-light: rgba(243, 199, 117, 0.2);
  --border-medium: #2a2a2a;
  --border-member: #2e2e2e;
  --text-primary: #e0e0e0;
  --text-secondary: #aaa;
  --text-muted: #bbb;
  --gold: #f3c775;
  --gold-glow: rgba(243, 199, 117, 0.3);
  --online-green: #4caf50;
  --offline-gray: #9e9e9e;
  --tab-inactive-bg: rgba(20, 20, 20, 0.5);
  --shadow-color: rgba(0, 0, 0, 0.7);
}

[data-theme="light"] {
  --bg-primary: #f5f5f5;
  --bg-secondary: rgba(255, 255, 255, 0.9);
  --bg-card: #fafafa;
  --bg-input: #ffffff;
  --bg-member: #f0f0f0;
  --border-light: rgba(212, 160, 23, 0.2);
  --border-medium: #ddd;
  --border-member: #e0e0e0;
  --text-primary: #1a1a1a;
  --text-secondary: #666;
  --text-muted: #555;
  --gold: #d4a017;
  --gold-glow: rgba(212, 160, 23, 0.15);
  --online-green: #2e7d32;
  --offline-gray: #757575;
  --tab-inactive-bg: rgba(255, 255, 255, 0.7);
  --shadow-color: rgba(0, 0, 0, 0.1);
}

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

body {
  background-color: var(--bg-primary);
  font-family: 'Inter', 'Poppins', sans-serif;
  color: var(--text-primary);
  line-height: 1.5;
  min-height: 100vh;
  position: relative;
  transition: background-color 0.3s ease, color 0.3s ease;
  overflow-y: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

body::-webkit-scrollbar {
  display: none;
}

.bg-glow {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle at 30% 20%, var(--gold-glow) 0%, transparent 50%);
  pointer-events: none;
  z-index: 0;
  transition: background 0.3s ease;
}


/* ========== 主體 ========== */
.app-wrapper {
  position: relative;
  z-index: 2;
  max-width: 1280px;
  margin: 0 auto;
  padding: 20px 24px 40px;
}

.navbar {
  padding: 12px 0 20px;
  border-bottom: 1px solid var(--border-light);
  margin-bottom: 28px;
  backdrop-filter: blur(4px);
  transition: border-color 0.3s ease;
}

.nav-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  position: relative;
}

/* ========== Logo 放大 ========== */
.logo {
  display: flex;
  align-items: center;
  gap: 16px;
}

.logo-img {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  border: 3px solid var(--gold);
  object-fit: cover;
  background: #1a1a1a;
  box-shadow: 0 0 20px var(--gold-glow);
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.logo-fallback {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: #2e2e2e;
  color: var(--gold);
  font-weight: bold;
  font-size: 2.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 3px solid var(--gold);
}

.logo-text {
  font-size: 2.4rem;
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--text-primary);
  transition: color 0.3s ease;
}

.logo-text span {
  font-weight: 300;
  color: var(--text-secondary);
  font-size: 1.3rem;
}

/* ========== 其他樣式保持不變 ========== */
.nav-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.theme-toggle {
  background: var(--tab-inactive-bg);
  border: 1.5px solid var(--border-light);
  color: var(--gold);
  font-size: 1.2rem;
  padding: 8px 16px;
  border-radius: 40px;
  cursor: pointer;
  transition: all 0.3s ease;
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
}

.theme-toggle:hover {
  border-color: var(--gold);
  background: var(--gold-glow);
  transform: scale(1.05);
}

[data-theme="dark"] .theme-toggle .fa-sun {
  display: inline-block;
}

[data-theme="dark"] .theme-toggle .fa-moon {
  display: none;
}

[data-theme="light"] .theme-toggle .fa-sun {
  display: none;
}

[data-theme="light"] .theme-toggle .fa-moon {
  display: inline-block;
}

.menu-toggle {
  display: none;
  background: var(--tab-inactive-bg);
  border: 1.5px solid var(--border-light);
  color: var(--gold);
  font-size: 1.5rem;
  padding: 8px 16px;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s;
  backdrop-filter: blur(4px);
}

.menu-toggle:hover {
  background: var(--gold-glow);
  border-color: var(--gold);
}

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tab-btn {
  background: var(--tab-inactive-bg);
  border: 1.5px solid var(--border-light);
  color: var(--text-muted);
  font-size: 1rem;
  font-weight: 500;
  padding: 10px 22px;
  border-radius: 40px;
  cursor: pointer;
  transition: all 0.3s ease;
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: inherit;
}

.tab-btn i {
  color: var(--gold);
  opacity: 0.8;
}

.tab-btn:hover {
  border-color: var(--gold);
  color: var(--gold);
  background: var(--gold-glow);
  transform: translateY(-1px);
}

.tab-btn.active {
  background: var(--gold);
  border-color: var(--gold);
  color: var(--bg-primary);
  font-weight: 600;
  box-shadow: 0 0 15px var(--gold-glow);
}

.tab-btn.active i {
  color: var(--bg-primary);
}

.content-panel {
  margin-top: 10px;
  min-height: 480px;
  position: relative;
}

.tab-content {
  display: none;
  width: 100%;
  opacity: 0;
  transition: opacity 0.3s ease;
}

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

.sub-content-container {
  position: relative;
}

.sub-content {
  display: none;
  opacity: 0;
  transition: opacity 0.25s ease;
}

.sub-content.active {
  display: block;
  opacity: 1;
}

.card {
  background: var(--bg-secondary);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border-light);
  border-radius: 10px;
  padding: 28px 26px;
  box-shadow: 0 10px 30px -10px var(--shadow-color);
  margin-bottom: 24px;
  transition: border 0.3s, box-shadow 0.3s, background 0.3s;
}

.card:hover {
  border-color: var(--gold);
  box-shadow: 0 12px 28px -8px var(--gold-glow);
}

.card-title {
  font-size: 1.8rem;
  font-weight: 600;
  margin-bottom: 20px;
  color: var(--gold);
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px dashed var(--border-light);
  padding-bottom: 14px;
}

.btn-gold {
  background: var(--tab-inactive-bg);
  border: 1.5px solid var(--gold);
  color: var(--gold);
  padding: 10px 20px;
  border-radius: 30px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  backdrop-filter: blur(4px);
  font-family: inherit;
  font-size: 0.95rem;
  text-decoration: none;
  position: relative;
  z-index: 10;
}

.btn-gold:hover {
  background: var(--gold);
  color: var(--bg-primary);
  transform: scale(1.02);
}

.btn-gold.small {
  padding: 8px 18px;
  font-size: 0.9rem;
}

.ip-box {
  background: var(--bg-input);
  border-radius: 10px;
  padding: 16px 20px;
  border: 1px solid var(--border-medium);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 15px;
  margin: 18px 0 10px;
  transition: background 0.3s, border-color 0.3s;
}

.ip-box .btn-gold {
  flex-shrink: 0;
}

.ip-info {
  display: flex;
  flex-direction: column;
  flex: 1;
}

.ip-label {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--text-secondary);
}

.ip-address {
  font-family: 'Courier New', monospace;
  font-size: 1.3rem;
  font-weight: 600;
  color: var(--gold);
  word-break: break-all;
}

.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}

.feature-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  color: var(--text-primary);
}

.feature-item i {
  color: var(--gold);
  font-size: 1.2rem;
}

.status-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
  margin-top: 10px;
}

.status-item {
  background: var(--bg-card);
  border-radius: 10px;
  padding: 18px;
  border-left: 4px solid var(--gold);
  transition: background 0.3s;
}

.online-indicator {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--online-green);
  box-shadow: 0 0 8px var(--online-green);
  margin-right: 8px;
}

.offline-indicator {
  background: var(--offline-gray);
  box-shadow: none;
}

.sub-tabs {
  display: flex;
  gap: 10px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.sub-tab {
  background: none;
  border: 1px solid var(--border-medium);
  color: var(--text-muted);
  padding: 8px 22px;
  border-radius: 30px;
  font-weight: 500;
  cursor: pointer;
  transition: 0.2s;
  font-family: inherit;
}

.sub-tab.active {
  background: var(--gold);
  border-color: var(--gold);
  color: var(--bg-primary);
}

.rule-list {
  list-style: none;
}

.rule-list li {
  padding: 10px 0;
  border-bottom: 1px solid var(--border-medium);
  display: flex;
  align-items: baseline;
  gap: 12px;
  color: var(--text-primary);
}

.rule-list i {
  color: var(--gold);
  width: 22px;
  text-align: center;
}

.announce-item {
  padding: 16px 0;
  border-bottom: 1px solid var(--border-medium);
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
}

.announce-date {
  color: var(--gold);
  font-weight: 500;
  margin-right: 18px;
  min-width: 100px;
}

.announce-images {
  width: 100%;
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.announce-img {
  max-width: 100%;
  max-height: 400px;
  border-radius: 8px;
  border: 1px solid var(--border-medium);
  object-fit: cover;
  cursor: pointer;
  transition: transform 0.2s;
}

.announce-img:hover {
  transform: scale(1.02);
}

.member-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 18px;
  max-height: 600px;
  overflow-y: auto;
  padding-right: 6px;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.member-list::-webkit-scrollbar {
  display: none;
}

.member-item {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--bg-member);
  padding: 8px 14px;
  border-radius: 40px;
  border: 1px solid var(--border-member);
  transition: border 0.15s, background 0.3s;
  min-width: 0;
}

.member-name {
  display: block;
  overflow-wrap: break-word;
  word-break: break-word;
  flex: 1;
  min-width: 0;
}

.member-item:hover {
  border-color: var(--gold);
}

.member-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #2a2a2a;
  border: 2px solid var(--gold);
  object-fit: cover;
}

.avatar-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  background: #2e2e2e;
  color: var(--gold);
  font-weight: bold;
  font-size: 1.2rem;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 2px solid var(--gold);
}


.discord-widget-info {
  display: flex;
  gap: 24px;
  align-items: center;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.toast-msg {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-secondary);
  border: 1px solid var(--gold);
  color: var(--gold);
  padding: 10px 24px;
  border-radius: 40px;
  z-index: 9999;
  opacity: 0;
  transition: opacity 0.2s, background 0.3s;
  pointer-events: none;
  font-weight: 500;
}

.toast-msg.show {
  opacity: 1;
}

.loading-text {
  color: var(--text-secondary);
  padding: 8px 0;
}

/* ========== 手機響應式 ========== */
@media (max-width: 768px) {
  .nav-actions {
    margin-left: auto;
  }
  
  .menu-toggle {
    display: block;
  }
  
  .tabs {
    display: none;
    width: 100%;
    flex-direction: column;
    gap: 6px;
    margin-top: 12px;
  }
  
  .tabs.show {
    display: flex;
  }
  
  .tab-btn {
    width: 100%;
    justify-content: center;
  }
  
  .nav-container {
    flex-direction: row;
    flex-wrap: wrap;
  }

  .modal-card {
    max-width: 95%;
  }
  
  /* 手機版 Logo 調整 */
  .logo-img {
    width: 56px;
    height: 56px;
  }
  
  .logo-fallback {
    width: 56px;
    height: 56px;
    font-size: 1.8rem;
  }
  
  .logo-text {
    font-size: 1.8rem;
  }
  
  .logo-text span {
    font-size: 1rem;
  }
}

@media (max-width: 640px) {
  .app-wrapper {
    padding: 12px 16px 30px;
  }
  
  /* 手機版 Logo 進一步調整 */
  .logo-img {
    width: 48px;
    height: 48px;
  }
  
  .logo-fallback {
    width: 48px;
    height: 48px;
    font-size: 1.5rem;
  }
  
  .logo-text {
    font-size: 1.5rem;
  }
  
  .logo-text span {
    font-size: 0.9rem;
  }
  
  .card {
    padding: 20px 16px;
  }
  
  .card-title {
    font-size: 1.5rem;
  }
  
  .ip-address {
    font-size: 1rem;
  }
  
  .announce-item {
    flex-direction: column;
    gap: 6px;
  }
  
  .announce-date {
    min-width: auto;
  }

  .modal-header {
    padding: 16px 18px;
  }

  .modal-body {
    padding: 16px 18px;
  }

  .modal-footer {
    padding: 12px 18px 18px;
  }
  
  .theme-toggle {
    padding: 6px 12px;
    font-size: 1rem;
  }
  
  .ip-box {
    padding: 12px 16px;
  }
  
  .btn-gold.small {
    padding: 10px 18px;
  }
}

.lightbox-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.85);
  z-index: 99999;
  display: none;
  align-items: center;
  justify-content: center;
  cursor: zoom-out;
}

.lightbox-overlay.show {
  display: flex;
}

.lightbox-img {
  max-width: 90vw;
  max-height: 90vh;
  border-radius: 8px;
  object-fit: contain;
  cursor: default;
}

.lightbox-close {
  position: absolute;
  top: 20px;
  right: 30px;
  font-size: 2.5rem;
  color: #fff;
  cursor: pointer;
  opacity: 0.8;
  transition: opacity 0.2s;
}

.lightbox-close:hover {
  opacity: 1;
}

button,
.btn-gold,
.tab-btn,
.sub-tab,
.theme-toggle,
.menu-toggle,
.modal-close {
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
