/*
Theme Name: FX Now
Theme URI: https://fx-now.dev
Author: fx-now
Author URI: https://fx-now.dev
Description: 달러/원 환율 실시간 차트와 글로벌 뉴스 기반 환율 변동 원인 분석 서비스
Version: 1.0.0
Requires at least: 6.0
Requires PHP: 8.0
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: fx-now
*/

/* ===================================
   1. CSS Custom Properties (Design Tokens)
   =================================== */
:root {
  /* — Color Palette (Dark Mode First) — */
  --fx-bg-primary:    #0a0e17;
  --fx-bg-secondary:  #111827;
  --fx-bg-card:       #1a2035;
  --fx-bg-card-hover: #1f2a45;
  --fx-border:        #2a3452;
  --fx-border-light:  #374265;

  --fx-text-primary:   #e8ecf4;
  --fx-text-secondary: #8b95b0;
  --fx-text-muted:     #5a6480;

  --fx-accent:        #3b82f6;
  --fx-accent-hover:  #60a5fa;
  --fx-accent-glow:   rgba(59, 130, 246, 0.25);

  --fx-green:         #22c55e;
  --fx-green-bg:      rgba(34, 197, 94, 0.12);
  --fx-red:           #ef4444;
  --fx-red-bg:        rgba(239, 68, 68, 0.12);
  --fx-amber:         #f59e0b;
  --fx-amber-bg:      rgba(245, 158, 11, 0.12);

  /* — Typography — */
  --fx-font-sans:   'Inter', 'Pretendard', -apple-system, BlinkMacSystemFont, sans-serif;
  --fx-font-mono:   'JetBrains Mono', 'Fira Code', monospace;
  --fx-font-size-xs:   0.75rem;
  --fx-font-size-sm:   0.8125rem;
  --fx-font-size-base: 0.875rem;
  --fx-font-size-lg:   1rem;
  --fx-font-size-xl:   1.25rem;
  --fx-font-size-2xl:  1.5rem;
  --fx-font-size-3xl:  2rem;

  /* — Spacing — */
  --fx-gap-xs:  4px;
  --fx-gap-sm:  8px;
  --fx-gap-md:  12px;
  --fx-gap-lg:  16px;
  --fx-gap-xl:  24px;
  --fx-gap-2xl: 32px;

  /* — Radius — */
  --fx-radius-sm:   6px;
  --fx-radius-md:   10px;
  --fx-radius-lg:   14px;
  --fx-radius-full: 9999px;

  /* — Transitions — */
  --fx-transition: 200ms cubic-bezier(0.4, 0, 0.2, 1);
  --fx-transition-slow: 400ms cubic-bezier(0.4, 0, 0.2, 1);

  /* — Shadows — */
  --fx-shadow-sm:  0 1px 2px rgba(0, 0, 0, 0.3);
  --fx-shadow-md:  0 4px 12px rgba(0, 0, 0, 0.4);
  --fx-shadow-lg:  0 8px 32px rgba(0, 0, 0, 0.5);
  --fx-shadow-glow: 0 0 20px var(--fx-accent-glow);

  /* — Layout — */
  --fx-header-height: 56px;
  --fx-timeline-width: 380px;
}


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

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--fx-font-sans);
  font-size: var(--fx-font-size-base);
  color: var(--fx-text-primary);
  background: var(--fx-bg-primary);
  line-height: 1.6;
  overflow: hidden;
  height: 100vh;
}

a {
  color: var(--fx-accent);
  text-decoration: none;
  transition: color var(--fx-transition);
}
a:hover {
  color: var(--fx-accent-hover);
}

/* ===================================
   3. App Layout
   =================================== */
#fx-app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

/* — Header — */
.fx-header {
  height: var(--fx-header-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--fx-gap-xl);
  background: var(--fx-bg-secondary);
  border-bottom: 1px solid var(--fx-border);
  flex-shrink: 0;
  z-index: 100;
}

.fx-header__logo {
  display: flex;
  align-items: center;
  gap: var(--fx-gap-sm);
  font-size: var(--fx-font-size-lg);
  font-weight: 700;
  letter-spacing: -0.02em;
}

.fx-header__logo-icon {
  width: 28px;
  height: 28px;
  background: linear-gradient(135deg, var(--fx-accent), #818cf8);
  border-radius: var(--fx-radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
}

.fx-header__rate {
  display: flex;
  align-items: center;
  gap: var(--fx-gap-lg);
}

.fx-header__rate-value {
  font-family: var(--fx-font-mono);
  font-size: var(--fx-font-size-2xl);
  font-weight: 700;
  letter-spacing: -0.03em;
}

.fx-header__rate-change {
  display: flex;
  align-items: center;
  gap: var(--fx-gap-xs);
  padding: 4px 10px;
  border-radius: var(--fx-radius-full);
  font-family: var(--fx-font-mono);
  font-size: var(--fx-font-size-sm);
  font-weight: 600;
}

.fx-header__rate-change.up {
  background: var(--fx-red-bg);
  color: var(--fx-red);
}

.fx-header__rate-change.down {
  background: var(--fx-green-bg);
  color: var(--fx-green);
}

.fx-header__clock {
  display: flex;
  align-items: center;
  gap: var(--fx-gap-sm);
  background: var(--fx-bg-primary);
  padding: 4px 12px;
  border-radius: var(--fx-radius-sm);
  border: 1px solid var(--fx-border);
  margin-left: auto;
  margin-right: var(--fx-gap-xl);
}

.fx-header__clock-label {
  font-size: 10px;
  font-weight: 800;
  color: var(--fx-accent);
  background: var(--fx-accent-glow);
  padding: 1px 4px;
  border-radius: 2px;
}

.fx-header__clock-time {
  font-family: var(--fx-font-mono);
  font-size: var(--fx-font-size-sm);
  font-weight: 600;
  color: var(--fx-text-secondary);
  min-width: 65px;
}

.fx-header__controls {
  display: flex;
  align-items: center;
  gap: var(--fx-gap-md);
}

/* — Interval Toggle — */
.fx-interval-toggle {
  display: flex;
  background: var(--fx-bg-primary);
  border-radius: var(--fx-radius-sm);
  padding: 2px;
  border: 1px solid var(--fx-border);
}

.fx-interval-toggle__btn {
  padding: 5px 14px;
  border: none;
  background: none;
  color: var(--fx-text-secondary);
  font-family: var(--fx-font-sans);
  font-size: var(--fx-font-size-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-radius: 4px;
  cursor: pointer;
  transition: all var(--fx-transition);
}

.fx-interval-toggle__btn.active {
  background: var(--fx-accent);
  color: #fff;
  box-shadow: var(--fx-shadow-glow);
}

.fx-interval-toggle__btn:hover:not(.active) {
  color: var(--fx-text-primary);
  background: var(--fx-bg-card);
}

/* — Main Content — */
.fx-main {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* — Chart Area — */
.fx-chart {
  flex: 1;
  position: relative;
  border-right: 1px solid var(--fx-border);
  min-width: 0;
}

.fx-chart__legend {
  position: absolute;
  top: 15px;
  left: 15px;
  z-index: 10;
  pointer-events: none;
  font-family: var(--fx-font-mono);
  background: rgba(10, 14, 23, 0.7);
  padding: 8px 12px;
  border-radius: var(--fx-radius-sm);
  border: 1px solid var(--fx-border);
  backdrop-filter: blur(4px);
}

.fx-chart__legend-row {
  display: flex;
  align-items: center;
  gap: var(--fx-gap-md);
  font-size: var(--fx-font-size-xs);
  white-space: nowrap;
}

.fx-chart__legend-time {
  color: var(--fx-text-primary);
  font-weight: 700;
  margin-right: var(--fx-gap-sm);
  padding-right: var(--fx-gap-sm);
  border-right: 1px solid var(--fx-border);
}

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

.fx-chart__legend-val {
  color: var(--fx-text-secondary);
  font-weight: 600;
  min-width: 65px;
}

.fx-chart__container {
  width: 100%;
  height: 100%;
}

/* — Timeline Panel — */
.fx-timeline {
  width: var(--fx-timeline-width);
  display: flex;
  flex-direction: column;
  background: var(--fx-bg-secondary);
  flex-shrink: 0;
}

.fx-timeline__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--fx-gap-lg) var(--fx-gap-xl);
  border-bottom: 1px solid var(--fx-border);
  flex-shrink: 0;
}

.fx-timeline__title {
  font-size: var(--fx-font-size-sm);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--fx-text-secondary);
}

.fx-timeline__count {
  font-size: var(--fx-font-size-xs);
  color: var(--fx-text-muted);
  background: var(--fx-bg-primary);
  padding: 2px 8px;
  border-radius: var(--fx-radius-full);
}

.fx-timeline__list {
  flex: 1;
  overflow-y: auto;
  padding: var(--fx-gap-md);
  scroll-behavior: smooth;
}

/* Custom scrollbar */
.fx-timeline__list::-webkit-scrollbar {
  width: 5px;
}
.fx-timeline__list::-webkit-scrollbar-track {
  background: transparent;
}
.fx-timeline__list::-webkit-scrollbar-thumb {
  background: var(--fx-border);
  border-radius: var(--fx-radius-full);
}

/* ===================================
   4. News Card
   =================================== */
.fx-news-card {
  padding: var(--fx-gap-lg);
  border-radius: var(--fx-radius-md);
  background: var(--fx-bg-card);
  border: 1px solid transparent;
  margin-bottom: var(--fx-gap-md);
  cursor: pointer;
  transition: all var(--fx-transition);
  position: relative;
}

.fx-news-card:hover {
  background: var(--fx-bg-card-hover);
  border-color: var(--fx-border-light);
  transform: translateX(-2px);
}

.fx-news-card.highlighted {
  border-color: var(--fx-accent);
  box-shadow: var(--fx-shadow-glow);
  animation: fx-highlight-pulse 1.5s ease-in-out 3;
}

@keyframes fx-highlight-pulse {
  0%, 100% { box-shadow: var(--fx-shadow-glow); }
  50% { box-shadow: 0 0 30px var(--fx-accent-glow), 0 0 60px rgba(59, 130, 246, 0.1); }
}

.fx-news-card__meta {
  display: flex;
  align-items: center;
  gap: var(--fx-gap-sm);
  margin-bottom: var(--fx-gap-sm);
}

.fx-news-card__time {
  font-family: var(--fx-font-mono);
  font-size: var(--fx-font-size-xs);
  color: var(--fx-text-muted);
}

.fx-news-card__lang {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  padding: 1px 5px;
  border-radius: 3px;
  letter-spacing: 0.05em;
}

.fx-news-card__lang.en {
  background: rgba(59, 130, 246, 0.15);
  color: var(--fx-accent);
}

.fx-news-card__lang.ko {
  background: rgba(245, 158, 11, 0.15);
  color: var(--fx-amber);
}

.fx-news-card__score {
  margin-left: auto;
  font-family: var(--fx-font-mono);
  font-size: var(--fx-font-size-xs);
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 3px;
}

.fx-news-card__score.high {
  background: var(--fx-red-bg);
  color: var(--fx-red);
}

.fx-news-card__score.mid {
  background: var(--fx-amber-bg);
  color: var(--fx-amber);
}

.fx-news-card__title {
  font-size: var(--fx-font-size-base);
  font-weight: 600;
  line-height: 1.45;
  margin-bottom: var(--fx-gap-sm);
  color: var(--fx-text-primary);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.fx-news-card__summary {
  font-size: var(--fx-font-size-sm);
  color: var(--fx-text-secondary);
  line-height: 1.55;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.fx-news-card__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: var(--fx-gap-md);
  padding-top: var(--fx-gap-md);
  border-top: 1px solid var(--fx-border);
}

.fx-news-card__source {
  font-size: var(--fx-font-size-xs);
  color: var(--fx-text-muted);
}

.fx-news-card__rate {
  display: flex;
  align-items: center;
  gap: var(--fx-gap-xs);
  font-family: var(--fx-font-mono);
  font-size: var(--fx-font-size-xs);
  color: var(--fx-text-secondary);
}

.fx-news-card__rate-icon {
  font-size: 11px;
}

/* ===================================
   5. Loading States
   =================================== */
.fx-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--fx-gap-lg);
  height: 100%;
  color: var(--fx-text-muted);
}

.fx-loading__spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--fx-border);
  border-top-color: var(--fx-accent);
  border-radius: 50%;
  animation: fx-spin 0.8s linear infinite;
}

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

/* ===================================
   6. Responsive
   =================================== */
@media (max-width: 960px) {
  :root {
    --fx-timeline-width: 320px;
  }
}

@media (max-width: 768px) {
  .fx-main {
    flex-direction: column;
  }

  .fx-chart {
    border-right: none;
    border-bottom: 1px solid var(--fx-border);
    height: 50vh;
    flex: none;
  }

  .fx-timeline {
    width: 100%;
    flex: 1;
  }
}
