/* ===================================
   Excel App - Global Styles
   =================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

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

:root {
  --bg-primary: #0a0a0f;
  --bg-secondary: #12121a;
  --glass-bg: rgba(255, 255, 255, 0.04);
  --glass-border: rgba(255, 255, 255, 0.08);

  --accent-primary: #7c3aed;
  --accent-secondary: #a855f7;

  --btn-equals-bg: linear-gradient(135deg, #7c3aed, #a855f7);

  --text-primary: #f8fafc;
  --text-secondary: rgba(248, 250, 252, 0.5);

  --shadow-glow: 0 0 40px rgba(124, 58, 237, 0.2);
  --shadow-card: 0 25px 60px rgba(0, 0, 0, 0.5);
}

body {
  font-family: 'Inter', sans-serif;
  background: var(--bg-primary);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

/* 背景動態光暈 */
body::before {
  content: '';
  position: fixed;
  top: -30%;
  left: -20%;
  width: 60%;
  height: 60%;
  background: radial-gradient(ellipse, rgba(124, 58, 237, 0.12) 0%, transparent 70%);
  pointer-events: none;
  animation: float1 8s ease-in-out infinite alternate;
}

body::after {
  content: '';
  position: fixed;
  bottom: -30%;
  right: -20%;
  width: 60%;
  height: 60%;
  background: radial-gradient(ellipse, rgba(168, 85, 247, 0.1) 0%, transparent 70%);
  pointer-events: none;
  animation: float2 10s ease-in-out infinite alternate;
}

@keyframes float1 {
  from { transform: translate(0, 0) scale(1); }
  to   { transform: translate(5%, 5%) scale(1.1); }
}

@keyframes float2 {
  from { transform: translate(0, 0) scale(1); }
  to   { transform: translate(-5%, -5%) scale(1.1); }
}

/* ===================================
   Page Title
   =================================== */

.page-title {
  text-align: center;
  margin-bottom: 2rem;
  z-index: 1;
}

.page-title h1 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

.page-title h1 span {
  background: linear-gradient(135deg, #7c3aed, #c084fc);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.page-title p {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-top: 0.5rem;
}

/* ===================================
   Card & Upload Zone
   =================================== */

.uploader-card {
  position: relative;
  z-index: 1;
  width: 380px;
  background: rgba(18, 18, 26, 0.8);
  border: 1px solid var(--glass-border);
  border-radius: 28px;
  padding: 30px 24px 24px;
  box-shadow: var(--shadow-card), var(--shadow-glow);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

.upload-zone {
  background: rgba(0, 0, 0, 0.3);
  border: 2px dashed rgba(124, 58, 237, 0.4);
  border-radius: 18px;
  padding: 40px 20px;
  margin-bottom: 20px;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
}

.upload-zone:hover {
  background: rgba(124, 58, 237, 0.05);
  border-color: rgba(124, 58, 237, 0.8);
}

.upload-zone.dragover {
  background: rgba(124, 58, 237, 0.15);
  border-color: #a855f7;
  transform: scale(1.02);
}

.upload-icon {
  font-size: 3rem;
  margin-bottom: 12px;
  opacity: 0.8;
  filter: drop-shadow(0 4px 10px rgba(124, 58, 237, 0.4));
}

.upload-title {
  color: var(--text-primary);
  font-weight: 500;
  font-size: 1rem;
  margin-bottom: 6px;
}

.upload-subtitle {
  color: var(--text-secondary);
  font-size: 0.75rem;
}

.selected-file {
  margin-top: 15px;
  padding: 8px 12px;
  background: rgba(34, 197, 94, 0.15);
  border-radius: 8px;
  border: 1px solid rgba(34, 197, 94, 0.3);
  color: #86efac;
  font-size: 0.8rem;
  word-break: break-all;
}

.selected-file span {
  font-weight: 600;
  color: #fff;
}

/* API 狀態指示燈 */
.api-status {
  position: absolute;
  top: 15px;
  right: 20px;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.7rem;
  color: var(--text-secondary);
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #6b7280;
  transition: background 0.3s ease, box-shadow 0.3s ease;
}

.status-dot.online {
  background: #22c55e;
  box-shadow: 0 0 8px rgba(34, 197, 94, 0.6);
}

.status-dot.loading {
  background: #f59e0b;
  animation: pulse 1s ease-in-out infinite;
}

.status-dot.error {
  background: #ef4444;
  box-shadow: 0 0 8px rgba(239, 68, 68, 0.4);
}

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

/* ===================================
   Buttons
   =================================== */

.btn {
  font-family: 'Inter', sans-serif;
  border: none;
  border-radius: 14px;
  cursor: pointer;
  font-size: 1rem;
  font-weight: 600;
  height: 55px;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  color: white;
  margin-top: 10px;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

.btn-equals {
  background: linear-gradient(135deg, #7c3aed, #a855f7);
  box-shadow: 0 4px 20px rgba(124, 58, 237, 0.4);
}

.btn-equals:not(:disabled):hover {
  background: linear-gradient(135deg, #6d28d9, #9333ea);
  transform: translateY(-2px);
  box-shadow: 0 8px 28px rgba(124, 58, 237, 0.5);
}

.btn-equals:not(:disabled):active {
  transform: translateY(0);
  box-shadow: 0 2px 12px rgba(124, 58, 237, 0.3);
}

/* ===================================
   Loading Spinner
   =================================== */

.spinner {
  display: none;
  width: 20px;
  height: 20px;
  border: 3px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.btn-equals.loading .spinner { display: block; }
.btn-equals.loading .btn-label { display: none; }
.btn-equals.loading { pointer-events: none; }

/* ===================================
   Footer
   =================================== */

.footer {
  position: fixed;
  bottom: 1.5rem;
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.3);
  z-index: 1;
}
