/* ============================================
   9CEX Exchange — Professional Dark Theme
   ============================================ */

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

/* === CSS Variables === */
:root {
  --bg-primary: #0B0E11;
  --bg-secondary: #1E2329;
  --bg-tertiary: #2B3139;
  --bg-card: #181A20;
  --bg-input: #2B3139;
  --bg-hover: #363C45;
  --border-color: #2B3139;
  --border-light: #363C45;

  --text-primary: #EAECEF;
  --text-secondary: #848E9C;
  --text-tertiary: #5E6673;
  --text-brand: #F0B90B;

  --brand: #F0B90B;
  --brand-hover: #FFD740;
  --green: #0ECB81;
  --green-bg: rgba(14, 203, 129, 0.1);
  --green-hover: #14E090;
  --red: #F6465D;
  --red-bg: rgba(246, 70, 93, 0.1);
  --red-hover: #FF5A6F;
  --blue: #0052FF;

  --font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;

  --transition: all 0.2s ease;
  
  --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.4);
  --shadow-xl: 0 20px 60px rgba(0, 0, 0, 0.5);
}

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

html {
  font-size: 14px;
}

body {
  font-family: var(--font);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.5;
  overflow-x: auto;
  overflow-y: auto;
  padding-top: 64px;
}

/* === Common Layout === */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
    width: 100%;
}

.section {
    padding: 80px 0;
    position: relative;
}

.section-title {
    font-size: 2.5rem;
    font-weight: 800;
    text-align: center;
    margin-bottom: 16px;
    letter-spacing: -1px;
    color: var(--text-primary);
}

.section-subtitle {
    font-size: 1.1rem;
    text-align: center;
    color: var(--text-secondary);
    max-width: 600px;
    margin: 0 auto 60px;
    line-height: 1.6;
}

/* === Scrollbar === */
::-webkit-scrollbar {
  width: 5px;
  height: 5px;
}

::-webkit-scrollbar-track {
  background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
  background: var(--bg-tertiary);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--bg-hover);
}

/* ============================================
   HEADER
   ============================================ */
.site-header {
    background: rgba(11, 14, 20, 0.95);
    backdrop-filter: blur(24px) saturate(180%);
    -webkit-backdrop-filter: blur(24px) saturate(180%);
    border-bottom: 1px solid rgba(32, 38, 48, 0.4);
    padding: 0 24px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 10000;
    transition: top 0.3s ease, background 0.3s ease, box-shadow 0.3s ease;
}

.site-header.scrolled {
    background: rgba(11, 14, 20, 0.95);
    box-shadow: var(--shadow-lg);
}

/* === Announcement Bar === */
.announce-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 8px 16px;
    background: linear-gradient(90deg, rgba(240, 185, 11, 0.08), rgba(14, 203, 129, 0.06), rgba(30, 136, 229, 0.05));
    border-bottom: 1px solid var(--border-color);
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.announce-bar a {
    color: var(--brand);
    font-weight: 600;
    text-decoration: none;
    border-bottom: 1px dashed rgba(240, 185, 11, 0.4);
}

.announce-bar a:hover {
    border-bottom-color: var(--brand-hover);
}

.announce-bar-close {
    position: absolute;
    right: 16px;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 4px 8px;
    cursor: pointer;
    transition: var(--transition);
}

.announce-bar-close:hover {
    background: var(--brand);
    color: #0B0E11;
    border-color: var(--brand);
}

.header-left {
  display: flex;
  align-items: center;
  gap: 32px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.5px;
}

.logo-icon {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, var(--brand), #FFD740);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 1.1rem;
  color: #0B0E11;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 4px;
  list-style: none;
}

.nav-links a {
  text-decoration: none;
  color: var(--text-secondary);
  padding: 8px 14px;
  border-radius: var(--radius-md);
  font-weight: 500;
  font-size: 0.93rem;
  transition: var(--transition);
  position: relative;
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--text-primary);
  background: var(--bg-tertiary);
}

.nav-links a.active::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 50%;
  transform: translateX(-50%);
  width: 20px;
  height: 2px;
  background: var(--brand);
  border-radius: 2px;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.header-btn {
  padding: 7px 16px;
  border: none;
  border-radius: var(--radius-md);
  font-family: var(--font);
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  transition: var(--transition);
}

.btn-ghost {
  background: transparent;
  color: var(--text-primary);
  border: 1px solid var(--border-light);
}

.btn-ghost:hover {
  background: var(--bg-tertiary);
  border-color: var(--text-secondary);
}

.btn-primary {
  background: var(--brand);
  color: #0B0E11;
}

.btn-primary:hover {
  background: var(--brand-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(240, 185, 11, 0.3);
}

.btn-login {
  background: transparent;
  color: var(--text-primary);
  border: 1px solid var(--border-light);
}

.btn-login:hover {
  background: var(--bg-tertiary);
  border-color: var(--text-secondary);
}

.btn-register {
  background: var(--brand);
  color: #0B0E11;
}

.btn-register:hover {
  background: var(--brand-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(240, 185, 11, 0.3);
}

.btn-icon {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition);
  font-size: 1.1rem;
}

.btn-icon:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

/* === Language Switcher === */
.lang-switcher-wrap {
    position: relative;
}

.lang-switcher {
    display: flex;
    align-items: center;
    gap: 6px;
    background: transparent;
    border: 1px solid transparent;
    padding: 6px 10px;
    border-radius: var(--radius-md);
    cursor: pointer;
    color: var(--text-secondary);
    transition: var(--transition);
}

.lang-switcher:hover {
    color: var(--text-primary);
    background: var(--bg-tertiary);
}

.lang-switcher-flag {
    display: inline-block;
    width: 20px;
    height: 14px;
    border-radius: 2px;
    overflow: hidden;
}

.lang-switcher-name {
    font-size: 0.85rem;
    font-weight: 500;
}

.lang-arrow {
    margin-left: 2px;
    color: var(--text-tertiary);
}

.lang-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    width: 200px;
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    z-index: 10001;
    overflow: hidden;
    padding: 4px;
}


.lang-switcher-wrap:hover .lang-dropdown {
    display: block;
    animation: fadeIn 0.2s ease;
}

.lang-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    width: 100%;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    text-align: left;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.lang-option:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.lang-option.active {
    color: var(--brand);
    background: rgba(240, 185, 11, 0.05);
}

.lang-flag {
    display: inline-block;
    width: 20px;
    height: 14px;
    border-radius: 2px;
    overflow: hidden;
}

/* === User Menu (Professional Edition) === */
.user-menu-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.user-menu-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(240, 185, 11, 0.1);
    border: 1px solid rgba(240, 185, 11, 0.3);
    border-radius: 8px;
    padding: 8px 14px;
    cursor: pointer;
    color: var(--text-primary);
    transition: var(--transition);
    font-family: var(--font);
}

.user-menu-btn:hover {
    background: rgba(240, 185, 11, 0.15);
    border-color: rgba(240, 185, 11, 0.5);
}

.user-menu-avatar {
    width: 30px;
    height: 30px;
    background: var(--brand);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9rem;
    color: #0B0E11;
    flex-shrink: 0;
}

.user-menu-email {
    font-size: 0.85rem;
    font-weight: 500;
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-menu-dropdown {
    display: none;
    position: absolute;
    right: 0;
    top: 100%;
    min-width: 220px;
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    overflow: hidden;
    z-index: 1000;
    box-shadow: var(--shadow-xl);
}

.user-menu-info {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
}

.user-menu-info .signed-in-as {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.user-menu-info .user-email {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--brand);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-menu-info .user-badge {
    font-size: 0.7rem;
    margin-top: 2px;
    color: var(--green);
    font-weight: 600;
}

.user-menu-link {
    display: block;
    padding: 12px 16px;
    color: var(--text-primary);
    text-decoration: none;
    font-size: 0.9rem;
    transition: background 0.2s;
}

.user-menu-link:hover {
    background: rgba(255,255,255,0.05);
}

.user-menu-link.admin-link {
    color: var(--brand);
    font-weight: 600;
}

.user-menu-divider {
    border-top: 1px solid var(--border-color);
}

.user-menu-link.logout-link {
    color: var(--red);
}

.user-menu-link.logout-link:hover {
    background: rgba(246, 70, 93, 0.08);
}

/* === Mobile Menu === */
.hamburger {
    display: none;
    flex-direction: column;
    justify-content: space-between;
    width: 24px;
    height: 18px;
    background: transparent;
    border: none;
    cursor: pointer;
    z-index: 10002;
}

.hamburger-line {
    width: 100%;
    height: 2px;
    background: var(--text-primary);
    border-radius: 2px;
    transition: var(--transition);
}

.mobile-menu {
    position: fixed;
    top: 0;
    left: -100%;
    width: 300px;
    height: 100vh;
    background: var(--bg-card);
    z-index: 10001;
    transition: left 0.3s ease;
    display: flex;
    flex-direction: column;
    padding: 20px;
    border-right: 1px solid var(--border-color);
    box-shadow: var(--shadow-xl);
}

.mobile-menu.open {
    left: 0;
}

.mobile-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 10000;
    display: none;
    backdrop-filter: blur(4px);
}

.mobile-overlay.open {
    display: block;
}

.mobile-menu-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 30px;
}

.mobile-nav {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.mobile-nav-link {
    font-size: 1.1rem;
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    transition: var(--transition);
}

.mobile-nav-link:hover,
.mobile-nav-link.active {
    color: var(--brand);
}

.mobile-menu-divider {
    height: 1px;
    background: var(--border-color);
    margin: 24px 0;
}

.mobile-menu-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.mobile-btn {
    padding: 12px;
    border-radius: var(--radius-md);
    text-align: center;
    font-weight: 600;
    text-decoration: none;
    transition: var(--transition);
}

.mobile-btn-primary {
    background: var(--brand);
    color: #0B0E11;
}

.mobile-btn-ghost {
    background: transparent;
    border: 1px solid var(--border-light);
    color: var(--text-primary);
}

.mobile-lang-section {
    margin-top: auto;
}

.mobile-lang-title {
    font-size: 0.85rem;
    color: var(--text-tertiary);
    margin-bottom: 12px;
    text-transform: uppercase;
}

.mobile-lang-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

@media (max-width: 768px) {
    .nav-links {
        display: none;
    }
    .hamburger {
        display: flex;
    }
    .site-header {
        padding: 0 16px;
    }
    .lang-switcher-wrap {
        display: none;
    }
}

/* ============================================
   TICKER BAR
   ============================================ */
.ticker-bar {
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  padding: 0 24px;
  height: 52px;
  display: flex;
  align-items: center;
  gap: 28px;
  overflow-x: auto;
  scrollbar-width: none; /* Firefox */
}
.ticker-bar::-webkit-scrollbar { display: none; }

.ticker-pair-name {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
  padding-right: 20px;
  border-right: 1px solid var(--border-color);
  white-space: nowrap;
}

.ticker-pair-name .pair-icon {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 800;
  color: #0B0E11;
}

.ticker-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  white-space: nowrap;
}

.ticker-label {
  font-size: 0.72rem;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.ticker-value {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}

.ticker-value.green {
  color: var(--green);
}

.ticker-value.red {
  color: var(--red);
}

.ticker-price-main {
  font-size: 1.35rem;
  font-weight: 700;
}

/* ============================================
   MAIN 3-COLUMN LAYOUT
   ============================================ */
.main-content {
  display: grid;
  grid-template-columns: 240px 1fr 300px;
  grid-template-rows: 1fr;
  gap: 1px;
  background: var(--border-color);
  height: calc(100vh - 108px);
  overflow: hidden;
}

/* ============================================
   FOOTER
   ============================================ */
.site-footer {
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    padding: 60px 0 20px;
    margin-top: auto;
}
.footer-top {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr 1fr;
    gap: 40px;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px 60px;
}
.footer-brand p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin: 16px 0 24px;
    max-width: 260px;
}
.footer-socials {
    display: flex;
    gap: 16px;
}
.social-icon {
    width: 36px;
    height: 36px;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: var(--transition);
}
.social-icon:hover {
    background: var(--brand);
    color: #000;
    transform: translateY(-2px);
}
.footer-col h4 {
    color: var(--text-primary);
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 20px;
}
.footer-col a {
    display: block;
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 12px;
    transition: var(--transition);
}
.footer-col a:hover {
    color: var(--brand);
}
.footer-bottom {
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
}
.footer-badges {
    display: flex;
    gap: 16px;
}
.footer-badge {
    font-size: 0.8rem;
    color: var(--text-secondary);
    background: var(--bg-tertiary);
    padding: 4px 10px;
    border-radius: var(--radius-sm);
}
.footer-link {
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin-right: 20px;
}
.footer-link:hover {
    color: var(--text-primary);
}
.footer-copyright {
    color: var(--text-tertiary);
    font-size: 0.85rem;
}
@media (max-width: 900px) {
    .footer-top {
        grid-template-columns: 1fr 1fr;
    }
    .footer-brand {
        grid-column: span 2;
    }
}
@media (max-width: 600px) {
    .footer-top {
        grid-template-columns: 1fr;
        gap: 30px;
    }
    .footer-brand {
        grid-column: span 1;
    }
    .footer-bottom {
        flex-direction: column;
        text-align: center;
    }
}

/* ============================================
   Toast & Modal System
   ============================================ */

/* Toast */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 999999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}
.toast {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    color: var(--text-primary);
    padding: 12px 20px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 300px;
    max-width: 400px;
    animation: slideIn 0.3s ease;
    border-left: 4px solid var(--brand);
    pointer-events: auto;
}
.toast.success { border-left-color: var(--green); }
.toast.error { border-left-color: var(--red); }
.toast.info { border-left-color: var(--blue); }

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

/* Modal */
.custom-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    z-index: 12000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    animation: fadeIn 0.2s forwards;
}
.custom-modal {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 400px;
    padding: 24px;
    box-shadow: var(--shadow-xl);
    transform: scale(0.9);
    animation: popIn 0.2s forwards;
}
.custom-modal h3 {
    margin-bottom: 12px;
    font-size: 1.2rem;
    color: var(--text-primary);
    font-weight: 700;
}
.custom-modal p {
    color: var(--text-secondary);
    margin-bottom: 24px;
    font-size: 0.95rem;
    line-height: 1.5;
}
.custom-modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}
.modal-btn {
    padding: 10px 20px;
    border-radius: var(--radius-md);
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: var(--transition);
    font-size: 0.9rem;
}
.modal-btn.cancel {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border-light);
}
.modal-btn.cancel:hover {
    color: var(--text-primary);
    border-color: var(--text-primary);
    background: var(--bg-hover);
}
.modal-btn.confirm {
    background: var(--brand);
    color: #000;
    border: 1px solid var(--brand);
}
.modal-btn.confirm:hover {
    background: var(--brand-hover);
    border-color: var(--brand-hover);
    transform: translateY(-1px);
}

@keyframes fadeIn { to { opacity: 1; } }
@keyframes popIn { to { transform: scale(1); } }
/* === Chart Context Menu === */
.chart-context-menu {
  background: #1e2329;
  border: 1px solid #2b3139;
  border-radius: 4px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
  padding: 4px 0;
  min-width: 180px;
  display: flex;
  flex-direction: column;
}

.chart-context-menu button {
  display: flex !important;
  align-items: center !important;
  width: 100% !important;
  padding: 8px 16px !important;
  background: transparent !important;
  border: none !important;
  color: #eaecef !important;
  font-size: 13px !important;
  cursor: pointer !important;
  text-align: left !important;
  gap: 10px !important;
  transition: background 0.2s;
}

.chart-context-menu button:hover {
  background: #2b3139 !important;
}

.chart-context-menu .icon {
  font-size: 14px;
  width: 18px;
  display: flex;
  justify-content: center;
}
