/* ============================================================
   CryptoPlexTrade — Public Stylesheet
   Architecture: White-Dominant Clarity with Blue Ramp Accents
   Palette: #005baa (Royal Cobalt), #00a9e0 (Cyan), #ffffff (Canvas)
   ============================================================ */

/* --- Universal Box-Sizing & Viewport Containment --- */
*,
*::before,
*::after {
    box-sizing: border-box;
}

html,
body {
    overflow-x: hidden;
    width: 100%;
    max-width: 100vw;
}

/* --- Master Typography Imports --- */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600&family=Poppins:wght@400;500;600;700&display=swap');

/* --- Design Tokens & Color Matrix (Clarity White System) --- */
:root {
    /* Brand Colors */
    --primary-color: #005baa;
    --primary: #005baa;
    --primary-dark: #004685;
    --secondary-color: #00a9e0;
    --primary-light: #00a9e0;
    --bg-highlight: #f4f8fc;
    --primary-pale: #f4f8fc;
    --primary-soft: #e8f2fa;

    /* White-Dominant Surfaces */
    --bg: #ffffff;
    --bg-canvas: #f6f9fc;
    --bg-white: #ffffff;
    --bg-light: #f6f9fc;
    --bg-card: #ffffff;
    --surface-card: #ffffff;
    --surface-subtle: #f4f8fc;
    --surface-input: #ffffff;
    --dark-bg: #ffffff;
    --dark-surface: #f4f8fc;
    --dark-card: #ffffff;

    /* Crisp Precision Cool Borders */
    --border: #e2edf7;
    --border-light: #edf4fb;
    --border-medium: #d0e3f5;
    --border-mid: #d0e3f5;
    --border-glass: rgba(0, 91, 170, 0.08);

    /* Navy Ink Typographic Hierarchy */
    --text-primary: #0a192c;
    --text-1: #0a192c;
    --text-body: #3e5369;
    --text-2: #3e5369;
    --text-secondary: #6c8299;
    --text-3: #6c8299;
    --text-muted: #8fa4b8;

    /* Financial State Colors */
    --accent-green: #0e9f6e;
    --green: #0e9f6e;
    --accent-red: #e5484d;
    --red: #e5484d;
    --accent-orange: #f59e0b;
    --orange: #f59e0b;

    /* Elevation */
    --shadow-subtle: 0 1px 3px rgba(11, 45, 90, 0.04);
    --shadow-medium: 0 4px 16px rgba(11, 45, 90, 0.06);
    --shadow-blue: 0 6px 20px rgba(0, 91, 170, 0.22);
    --shadow-sm: 0 1px 3px rgba(11, 45, 90, 0.05), 0 1px 2px rgba(11, 45, 90, 0.03);
    --shadow-md: 0 4px 16px rgba(11, 45, 90, 0.06), 0 1px 3px rgba(11, 45, 90, 0.03);
    --shadow-lg: 0 12px 32px rgba(11, 45, 90, 0.08), 0 2px 8px rgba(11, 45, 90, 0.03);

    /* Typography Stacks */
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, 'Poppins', sans-serif;
    --font-mono: 'JetBrains Mono', SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

/* --- Base Body & Typography --- */
body {
    font-family: var(--font-sans);
    background-color: var(--bg);
    color: var(--text-body);
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Institutional Clean Canvas Background */
.animated-background {
    background: #ffffff;
    background-image: radial-gradient(circle at 50% 0%, #eaf4fd 0%, #f6fafd 55%, #ffffff 100%);
}

.container {
    max-width: 1240px;
    margin: 0 auto;
    padding: 0 24px;
}

/* --- Header / Navigation Bar --- */
.header {
    padding: 14px 0;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    position: sticky;
    top: 0;
    z-index: 100;
    border-bottom: 1px solid var(--border);
    box-shadow: 0 2px 10px rgba(11, 45, 90, 0.03);
}

.header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo-wrapper {
    display: inline-flex;
    align-items: center;
    text-decoration: none;
    gap: 10px;
    flex-shrink: 0;
}

.header .logo-wrapper {
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
}

.logo-wrapper img.logo,
.logo-wrapper img {
    height: 38px !important;
    max-height: 38px !important;
    width: auto !important;
    object-fit: contain !important;
    display: block !important;
    flex-shrink: 0 !important;
}

.logo-name {
    display: inline-block !important;
    font-size: 1.2rem !important;
    font-weight: 800 !important;
    color: var(--text-primary) !important;
    text-decoration: none !important;
    letter-spacing: -0.02em !important;
    white-space: nowrap !important;
    flex-shrink: 0 !important;
}

.logo-name span {
    color: var(--primary-color, #005baa);
}

.logo {
    display: inline-flex;
    align-items: center;
    text-decoration: none;
    transition: opacity 0.2s ease;
    flex-shrink: 0;
}

.logo:hover {
    opacity: 0.9;
}

img.logo,
img.brand-logo {
    width: auto !important;
    height: 40px !important;
    max-height: 40px !important;
    border-radius: 8px;
    object-fit: contain;
    background: none;
    box-shadow: none;
}

.header-nav,
.nav {
    display: flex;
    align-items: center;
    gap: 28px;
}

.nav a,
.header-nav a {
    color: var(--text-2);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 600;
    transition: color 0.15s ease;
}

.nav a:hover,
.header-nav a:hover {
    color: var(--primary-color);
}

.nav a.btn-primary,
.header-nav a.btn-primary,
a.btn-primary,
.btn-primary {
    color: #ffffff !important;
}

/* --- Buttons --- */
.btn-primary {
    background: linear-gradient(135deg, var(--primary-color) 0%, #0077c8 100%);
    color: #ffffff;
    padding: 10px 22px;
    border-radius: var(--radius-pill);
    text-decoration: none;
    font-weight: 700;
    font-size: 0.9rem;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(0, 91, 170, 0.25);
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary-color) 100%);
    box-shadow: 0 6px 20px rgba(0, 91, 170, 0.35);
    transform: translateY(-1px);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-outline {
    background: #ffffff;
    color: var(--primary-color);
    padding: 9px 20px;
    border-radius: var(--radius-pill);
    border: 1.5px solid var(--border-medium);
    text-decoration: none;
    font-weight: 700;
    font-size: 0.9rem;
    transition: all 0.15s ease;
}

.btn-outline:hover {
    background: var(--bg-highlight);
    border-color: var(--primary-color);
}

/* --- Footer --- */
.footer {
    padding: 44px 0 calc(60px + env(safe-area-inset-bottom));
    font-size: 0.88rem;
    margin-top: auto;
    background: #ffffff;
    border-top: 1px solid var(--border);
    color: var(--text-2);
    width: 100%;
    max-width: 100vw;
    overflow: hidden;
    box-sizing: border-box;
}

.footer .logo-name,
footer .logo-name {
    color: var(--text-1, #0a192f) !important;
    font-weight: 800 !important;
    font-size: 1.15rem !important;
    display: inline-block !important;
    letter-spacing: -0.02em !important;
}

.footer .logo-name span,
footer .logo-name span {
    color: var(--primary, #0052cc) !important;
}

.footer-cols-grid,
.footer-grid {
    display: grid;
    grid-template-columns: 1.5fr 1fr 1fr 1fr;
    gap: 36px;
    margin-bottom: 28px;
    width: 100%;
    box-sizing: border-box;
}

.footer-col,
.footer-column {
    display: flex;
    flex-direction: column;
    min-width: 0;
    word-break: break-word;
}

.footer-col h4,
.footer-column h4 {
    font-size: 0.82rem;
    font-weight: 800;
    color: var(--text-primary);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 16px;
}

.footer-col ul,
.footer-column ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.footer-col ul a,
.footer-column ul a {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.88rem;
    transition: color 0.15s ease;
}

.footer-col ul a:hover,
.footer-column ul a:hover {
    color: var(--primary-color);
}

.footer-bottom,
.footer-bottom-strip {
    border-top: 1px solid var(--border-light);
    padding-top: 24px;
    text-align: center;
    font-size: 0.82rem;
    color: var(--text-muted);
    width: 100%;
}

@media (max-width: 960px) {
    .footer-cols-grid,
    .footer-grid {
        grid-template-columns: 1fr 1fr !important;
        gap: 28px !important;
    }
}

@media (max-width: 640px) {
    .footer {
        padding: 28px 0 calc(68px + env(safe-area-inset-bottom)) !important;
    }

    .footer-cols-grid,
    .footer-grid {
        grid-template-columns: 1fr !important;
        gap: 22px !important;
        text-align: left !important;
    }

    .footer-col p {
        max-width: 100% !important;
    }
}

/* Mobile CTA header buttons */
.mobile-header-cta {
    display: none !important;
}

/* --- Ticker Tape --- */
.ticker-tape {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background-color: #0a192c;
    color: #ffffff;
    padding: 8px 0;
    padding-bottom: calc(8px + env(safe-area-inset-bottom));
    z-index: 1000;
    overflow: hidden;
    white-space: nowrap;
    border-top: 1px solid rgba(0, 91, 170, 0.4);
}

.ticker-tape__track {
    display: inline-block;
    animation: scroll-ticker 40s linear infinite;
}

.ticker-tape__item {
    display: inline-flex;
    align-items: center;
    padding: 0 24px;
    font-size: 0.82rem;
    font-variant-numeric: tabular-nums;
}

.ticker-tape__item .pair {
    font-weight: 700;
    margin-right: 10px;
    color: #94a3b8;
}

.ticker-tape__item .price {
    font-weight: 600;
    margin-right: 8px;
    color: #ffffff;
    transition: color 0.3s ease;
}

.ticker-tape__item .change {
    font-weight: 700;
}

.ticker-tape__item .change.up {
    color: #22c55e;
}

.ticker-tape__item .change.down {
    color: #ef4444;
}

@keyframes scroll-ticker {
    0% { transform: translateX(0%); }
    100% { transform: translateX(-50%); }
}

.price.flash-up { animation: flash-up 0.7s; }
.price.flash-down { animation: flash-down 0.7s; }

@keyframes flash-up {
    0%, 100% { color: #ffffff; }
    50% { color: #22c55e; }
}

@keyframes flash-down {
    0%, 100% { color: #ffffff; }
    50% { color: #ef4444; }
}

/* --- Form Fields --- */
.form-group {
    position: relative;
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px 16px;
    border: 1.5px solid var(--border-medium);
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    box-sizing: border-box;
    transition: all 0.15s ease;
    background-color: var(--bg-white);
    font-family: var(--font-sans);
    color: var(--text-primary);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(0, 91, 170, 0.14);
}

/* Floating Label Specifics */
.form-group .floating-label {
    position: absolute;
    top: 13px;
    left: 15px;
    color: var(--text-secondary);
    font-size: 0.95rem;
    transition: all 0.18s ease-in-out;
    pointer-events: none;
}

.form-group input:focus+.floating-label,
.form-group input:not(:placeholder-shown)+.floating-label,
.form-group textarea:focus+.floating-label,
.form-group textarea:not(:placeholder-shown)+.floating-label {
    top: -9px;
    left: 10px;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--primary-color);
    background-color: var(--bg-white);
    padding: 0 6px;
}

/* --- Legacy Dashboard Layout Fallback (White) --- */
.dashboard-layout {
    display: flex;
    height: calc(100vh - 81px);
    background: var(--bg);
}

.dashboard-sidebar {
    width: 260px;
    background-color: #ffffff;
    border-right: 1px solid var(--border);
    padding: 24px 16px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
}

.sidebar-nav ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    padding: 12px 14px;
    text-decoration: none;
    color: var(--text-2);
    font-weight: 500;
    font-size: 0.88rem;
    border-radius: var(--radius-sm);
    margin-bottom: 4px;
    transition: all 0.15s ease;
}

.sidebar-nav a svg {
    width: 18px;
    height: 18px;
    margin-right: 12px;
}

.sidebar-nav a:hover {
    background-color: var(--primary-soft);
    color: var(--primary-dark);
}

.sidebar-nav a.active {
    background: var(--primary-color);
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(0, 91, 170, 0.25);
}

.dashboard-content {
    flex-grow: 1;
    padding: 32px;
    overflow-y: auto;
    background: var(--bg-canvas);
}

.dashboard-header {
    margin-bottom: 32px;
}

.dashboard-header h1 {
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--text-primary);
    margin: 0 0 6px 0;
}

.dashboard-header p {
    font-size: 0.95rem;
    color: var(--text-secondary);
    margin: 0;
}

/* Global WebKit Autofill Overrides for Clean White Theme */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
input:-webkit-autofill:active,
.auth-input:-webkit-autofill,
.auth-input:-webkit-autofill:hover,
.auth-input:-webkit-autofill:focus,
.auth-input:-webkit-autofill:active {
    -webkit-box-shadow: 0 0 0 1000px #ffffff inset !important;
    box-shadow: 0 0 0 1000px #ffffff inset !important;
    -webkit-text-fill-color: var(--text-primary) !important;
    caret-color: var(--text-primary) !important;
    transition: background-color 5000s ease-in-out 0s;
}