/* ==========================================================================
   TMH Corps Hub (tmhcorps.cn) Design System & Stylesheet
   ========================================================================== */

/* Design Tokens & CSS Variables */
:root {
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-heading: 'Outfit', var(--font-sans);
  --font-mono: 'JetBrains Mono', monospace;

  /* Colors */
  --bg-dark: #090d16;
  --bg-card: rgba(22, 31, 48, 0.65);
  --bg-card-hover: rgba(30, 42, 64, 0.85);
  --border-color: rgba(255, 255, 255, 0.08);
  --border-color-hover: rgba(59, 130, 246, 0.4);

  --text-main: #f3f4f6;
  --text-muted: #9ca3af;
  --text-dim: #6b7280;

  --accent-blue: #3b82f6;
  --accent-purple: #8b5cf6;
  --accent-emerald: #10b981;
  --accent-amber: #f59e0b;
  --accent-rose: #f43f5e;

  /* AliCloud & NAS Badges */
  --badge-aliyun-bg: rgba(51, 112, 255, 0.15);
  --badge-aliyun-color: #60a5fa;
  --badge-aliyun-border: rgba(96, 165, 250, 0.3);

  --badge-nas-pub-bg: rgba(16, 185, 129, 0.15);
  --badge-nas-pub-color: #34d399;
  --badge-nas-pub-border: rgba(52, 211, 153, 0.3);

  --badge-nas-priv-bg: rgba(244, 63, 94, 0.15);
  --badge-nas-priv-color: #fb7185;
  --badge-nas-priv-border: rgba(251, 113, 133, 0.3);

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 9999px;

  --shadow-subtle: 0 10px 30px -10px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 25px rgba(59, 130, 246, 0.25);
  --transition-fast: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-smooth: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Reset & Base Setup */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  width: 100%;
  min-height: 100vh;
  background-color: var(--bg-dark);
  color: var(--text-main);
  font-family: var(--font-sans);
  overflow-x: hidden;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* Ambient Animated Background Orbs */
.ambient-bg {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

.glow-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(120px);
  opacity: 0.35;
  animation: floatOrb 20s infinite alternate ease-in-out;
}

.orb-1 {
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, rgba(59, 130, 246, 0.6) 0%, rgba(139, 92, 246, 0) 70%);
  top: -100px;
  left: -100px;
}

.orb-2 {
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, rgba(139, 92, 246, 0.5) 0%, rgba(244, 63, 94, 0) 70%);
  bottom: -150px;
  right: -100px;
  animation-delay: -7s;
}

.orb-3 {
  width: 450px;
  height: 450px;
  background: radial-gradient(circle, rgba(16, 185, 129, 0.4) 0%, rgba(59, 130, 246, 0) 70%);
  top: 40%;
  left: 30%;
  animation-delay: -14s;
}

@keyframes floatOrb {
  0% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(60px, 40px) scale(1.1); }
  100% { transform: translate(-40px, 80px) scale(0.95); }
}

/* Glassmorphism Panel Component */
.glass-panel {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-subtle);
}

/* Main Container Layout */
.app-container {
  position: relative;
  z-index: 1;
  max-width: 1320px;
  margin: 0 auto;
  padding: 24px 32px 48px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header Navbar */
.header-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 28px;
  margin-bottom: 36px;
  border-radius: var(--radius-lg);
}

.brand-section {
  display: flex;
  align-items: center;
  gap: 14px;
}

.logo-icon {
  width: 44px;
  height: 44px;
  background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  box-shadow: 0 4px 15px rgba(59, 130, 246, 0.4);
}

.logo-icon i {
  width: 24px;
  height: 24px;
}

.brand-title {
  font-family: var(--font-heading);
  font-size: 1.4rem;
  font-weight: 800;
  letter-spacing: 0.5px;
  background: linear-gradient(90deg, #ffffff, #93c5fd);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-domain {
  font-size: 0.8rem;
  font-family: var(--font-mono);
  color: var(--accent-blue);
  background: rgba(59, 130, 246, 0.1);
  padding: 2px 8px;
  border-radius: var(--radius-full);
  border: 1px solid rgba(59, 130, 246, 0.2);
}

/* Time & Date Widget */
.time-widget {
  text-align: center;
}

.time-display {
  font-family: var(--font-mono);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: 1px;
}

.date-display {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* Header Action Buttons */
.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.btn-action {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  color: var(--text-main);
  font-size: 0.88rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition-fast);
}

.btn-action:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
  transform: translateY(-1px);
}

.btn-action i {
  width: 18px;
  height: 18px;
}

.btn-icon-only {
  padding: 10px;
  border-radius: 50%;
}

.admin-toggle-btn.unlocked {
  background: rgba(16, 185, 129, 0.15);
  border-color: rgba(16, 185, 129, 0.4);
  color: #34d399;
}

.admin-toggle-btn.unlocked i {
  color: #34d399;
}

/* Hero Section */
.hero-section {
  margin-bottom: 40px;
  text-align: center;
}

.greeting-box {
  margin-bottom: 28px;
}

.greeting-tag {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 2px;
  color: var(--accent-blue);
  background: rgba(59, 130, 246, 0.1);
  padding: 4px 14px;
  border-radius: var(--radius-full);
  margin-bottom: 12px;
  border: 1px solid rgba(59, 130, 246, 0.25);
}

.hero-title {
  font-family: var(--font-heading);
  font-size: 2.3rem;
  font-weight: 800;
  color: #fff;
  margin-bottom: 8px;
}

.hero-subtitle {
  font-size: 1.02rem;
  color: var(--text-muted);
  max-width: 640px;
  margin: 0 auto;
}

/* Global Search Bar */
.search-container {
  max-width: 680px;
  margin: 0 auto 28px;
  display: flex;
  align-items: center;
  padding: 8px 12px;
  border-radius: var(--radius-full);
  background: rgba(15, 23, 42, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.12);
  transition: var(--transition-smooth);
}

.search-container:focus-within {
  border-color: var(--accent-blue);
  box-shadow: 0 0 25px rgba(59, 130, 246, 0.3);
  transform: translateY(-2px);
}

.search-engine-selector {
  position: relative;
}

.engine-current-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-color);
  padding: 8px 14px;
  border-radius: var(--radius-full);
  color: var(--text-main);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition-fast);
}

.engine-current-btn:hover {
  background: rgba(255, 255, 255, 0.15);
}

.engine-current-btn i {
  width: 16px;
  height: 16px;
}

.chevron-icon {
  width: 14px !important;
  height: 14px !important;
  opacity: 0.7;
}

.engine-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  min-width: 160px;
  padding: 8px;
  z-index: 50;
  display: none;
  flex-direction: column;
  gap: 4px;
  border-radius: var(--radius-md);
  background: rgba(15, 23, 42, 0.95);
}

.engine-dropdown.show {
  display: flex;
  animation: fadeInDown 0.2s ease;
}

@keyframes fadeInDown {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

.engine-opt {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 0.85rem;
  cursor: pointer;
  transition: var(--transition-fast);
}

.engine-opt:hover, .engine-opt.active {
  background: rgba(59, 130, 246, 0.15);
  color: #fff;
}

.engine-opt i {
  width: 16px;
  height: 16px;
}

.search-input-wrapper {
  flex: 1;
  display: flex;
  align-items: center;
  padding: 0 12px;
}

#searchInput {
  width: 100%;
  background: transparent;
  border: none;
  outline: none;
  color: #fff;
  font-size: 1rem;
  font-family: var(--font-sans);
}

#searchInput::placeholder {
  color: var(--text-dim);
}

.search-clear-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
}

.search-clear-btn:hover {
  color: #fff;
}

.search-clear-btn i {
  width: 18px;
  height: 18px;
}

.search-submit-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--accent-blue);
  border: none;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition-fast);
}

.search-submit-btn:hover {
  background: #2563eb;
  transform: scale(1.05);
}

.search-submit-btn i {
  width: 20px;
  height: 20px;
}

/* Metrics Dashboard Bar */
.metrics-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 14px;
}

.metric-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-color);
  padding: 6px 16px;
  border-radius: var(--radius-full);
  font-size: 0.82rem;
}

.chip-icon {
  width: 14px;
  height: 14px;
  color: var(--accent-blue);
}

.metric-label {
  color: var(--text-muted);
}

.metric-val {
  color: var(--text-main);
  font-weight: 600;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #6b7280;
}

.dot.active {
  background: var(--accent-emerald);
  box-shadow: 0 0 10px var(--accent-emerald);
}

.lock-chip {
  border-color: rgba(244, 63, 94, 0.25);
  background: rgba(244, 63, 94, 0.05);
}

.lock-chip .chip-icon {
  color: var(--accent-rose);
}

/* Sections & Category Layout */
.sections-container {
  display: flex;
  flex-direction: column;
  gap: 40px;
  flex: 1;
}

.category-group {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.category-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.category-title-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
}

.category-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.06);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-blue);
}

.category-icon i {
  width: 20px;
  height: 20px;
}

.category-h3 {
  font-family: var(--font-heading);
  font-size: 1.25rem;
  font-weight: 700;
  color: #fff;
}

.category-desc {
  font-size: 0.85rem;
  color: var(--text-dim);
  margin-left: 8px;
}

.cat-badge {
  font-size: 0.75rem;
  font-family: var(--font-mono);
  font-weight: 600;
  padding: 4px 10px;
  border-radius: var(--radius-full);
}

.badge-aliyun {
  background: var(--badge-aliyun-bg);
  color: var(--badge-aliyun-color);
  border: 1px solid var(--badge-aliyun-border);
}

.badge-nas-public {
  background: var(--badge-nas-pub-bg);
  color: var(--badge-nas-pub-color);
  border: 1px solid var(--badge-nas-pub-border);
}

.badge-nas-private {
  background: var(--badge-nas-priv-bg);
  color: var(--badge-nas-priv-color);
  border: 1px solid var(--badge-nas-priv-border);
}

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

/* App Card Styling */
.app-card {
  position: relative;
  text-decoration: none;
  padding: 20px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 135px;
  transition: var(--transition-smooth);
  overflow: hidden;
}

.app-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: var(--card-color, var(--accent-blue));
  border-radius: var(--radius-sm) 0 0 var(--radius-sm);
  opacity: 0.7;
  transition: var(--transition-fast);
}

.app-card:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-color-hover);
  transform: translateY(-4px);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.4), var(--shadow-glow);
}

.app-card:hover::before {
  opacity: 1;
  width: 6px;
}

.card-top {
  display: flex;
  align-items: flex-start;
  gap: 14px;
}

.card-app-icon {
  width: 46px;
  height: 46px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--card-color, #fff);
  flex-shrink: 0;
  transition: var(--transition-fast);
}

.app-card:hover .card-app-icon {
  transform: scale(1.08) rotate(3deg);
  background: rgba(255, 255, 255, 0.1);
}

.card-app-icon i {
  width: 24px;
  height: 24px;
}

.card-meta {
  flex: 1;
}

.card-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}

.card-title {
  font-family: var(--font-heading);
  font-size: 1.08rem;
  font-weight: 700;
  color: #fff;
}

.external-arrow {
  width: 16px;
  height: 16px;
  color: var(--text-dim);
  opacity: 0;
  transform: translate(-4px, 4px);
  transition: var(--transition-fast);
}

.app-card:hover .external-arrow {
  opacity: 1;
  transform: translate(0, 0);
  color: var(--card-color, var(--accent-blue));
}

.card-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.4;
}

.card-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 14px;
  padding-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.04);
}

.card-tags {
  display: flex;
  align-items: center;
  gap: 6px;
}

.tag-pill {
  font-size: 0.72rem;
  color: var(--text-dim);
  background: rgba(255, 255, 255, 0.04);
  padding: 2px 8px;
  border-radius: var(--radius-sm);
}

.card-url-domain {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  color: var(--text-dim);
}

/* Footer Navigation */
.footer-left {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.icp-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--text-dim);
  font-size: 0.82rem;
  text-decoration: none;
  transition: var(--transition-fast);
}

.icp-link i {
  width: 14px;
  height: 14px;
}

.icp-link:hover {
  color: var(--accent-blue);
  text-decoration: underline;
}

.footer-nav {
  margin-top: 60px;
  padding-top: 24px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.footer-right {
  display: flex;
  align-items: center;
  gap: 20px;
}

.footer-link {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  color: var(--text-dim);
}

.sm-icon {
  width: 14px;
  height: 14px;
}

/* Modals & Overlays */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(5, 8, 15, 0.75);
  backdrop-filter: blur(8px);
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-overlay.show {
  display: flex;
  animation: fadeIn 0.25s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-card {
  position: relative;
  width: 100%;
  max-width: 440px;
  padding: 32px;
  border-radius: var(--radius-lg);
  background: rgba(17, 24, 39, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.15);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
}

.modal-close-btn {
  position: absolute;
  top: 20px;
  right: 20px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
}

.modal-close-btn:hover {
  color: #fff;
}

.modal-header {
  text-align: center;
  margin-bottom: 24px;
}

.modal-icon {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: rgba(59, 130, 246, 0.15);
  color: var(--accent-blue);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
  border: 1px solid rgba(59, 130, 246, 0.3);
}

.modal-icon i {
  width: 26px;
  height: 26px;
}

.modal-header h3 {
  font-family: var(--font-heading);
  font-size: 1.3rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 6px;
}

.modal-header p {
  font-size: 0.88rem;
  color: var(--text-muted);
}

.pin-input-group {
  margin-bottom: 24px;
}

#pinInput {
  width: 100%;
  padding: 14px 18px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: #fff;
  font-family: var(--font-mono);
  font-size: 1.2rem;
  letter-spacing: 4px;
  text-align: center;
  outline: none;
  transition: var(--transition-fast);
}

#pinInput:focus {
  border-color: var(--accent-blue);
  box-shadow: 0 0 15px rgba(59, 130, 246, 0.25);
}

.pin-error-msg {
  color: var(--accent-rose);
  font-size: 0.82rem;
  text-align: center;
  margin-top: 8px;
  display: none;
}

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

.btn-modal {
  flex: 1;
  padding: 12px;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: var(--transition-fast);
}

.btn-cancel {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-muted);
}

.btn-cancel:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

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

.btn-confirm:hover {
  background: #2563eb;
}

/* Settings Form Controls */
.settings-body {
  display: flex;
  flex-direction: column;
  gap: 20px;
  margin-bottom: 28px;
}

.setting-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.setting-item.vertical {
  flex-direction: column;
  align-items: flex-start;
}

.setting-info label {
  display: block;
  font-size: 0.92rem;
  font-weight: 600;
  color: #fff;
  margin-bottom: 2px;
}

.setting-info span {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.setting-input {
  width: 100%;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: #fff;
  font-size: 0.9rem;
  outline: none;
  margin-top: 8px;
}

.setting-input:focus {
  border-color: var(--accent-blue);
}

/* Custom Switch Toggle */
.switch {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 26px;
  flex-shrink: 0;
}

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

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(255, 255, 255, 0.15);
  transition: .3s;
  border-radius: 34px;
}

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

input:checked + .slider {
  background-color: var(--accent-blue);
}

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

/* Empty Search State */
.no-results {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

.no-results i {
  width: 48px;
  height: 48px;
  margin-bottom: 12px;
  opacity: 0.4;
}

.no-results h4 {
  font-size: 1.1rem;
  color: #fff;
  margin-bottom: 4px;
}

/* Responsive Breakpoints */
@media (max-width: 900px) {
  .app-container {
    padding: 16px 20px 32px;
  }

  .header-nav {
    flex-direction: column;
    gap: 16px;
    align-items: stretch;
    text-align: center;
  }

  .brand-section {
    justify-content: center;
  }

  .header-actions {
    justify-content: center;
  }

  .hero-title {
    font-size: 1.8rem;
  }

  .cards-grid {
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  }
}

@media (max-width: 600px) {
  .hero-title {
    font-size: 1.5rem;
  }

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

  .metrics-bar {
    display: none;
  }

  .footer-nav {
    flex-direction: column;
    gap: 12px;
    text-align: center;
  }
}
