/* ==========================================================================
   AstroForex Quantum AI — Sovereign CSS Design System
   ========================================================================== */

:root {
    --bg-main: #060814;
    --bg-darker: #03040a;
    --bg-card: rgba(13, 16, 37, 0.45);
    --bg-card-hover: rgba(20, 24, 56, 0.65);
    --border-glow: rgba(0, 243, 255, 0.15);
    --border-glow-active: rgba(0, 243, 255, 0.4);
    
    /* Neon Palettes */
    --color-cyan: #00f3ff;
    --color-purple: #bd00ff;
    --color-green: #39ff14;
    --color-gold: #ffd700;
    --color-red: #ff2a6d;
    --color-text-primary: #f0f2fa;
    --color-text-secondary: #8e9bb4;
    --color-text-muted: #57637a;

    --font-heading: 'Outfit', -apple-system, sans-serif;
    --font-body: 'Inter', -apple-system, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
}

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

body {
    background-color: var(--bg-main);
    color: var(--color-text-primary);
    font-family: var(--font-body);
    font-size: 15px;
    line-height: 1.6;
    overflow-x: hidden;
    position: relative;
    min-height: 100vh;
}

/* Background Atmospheric FX */
.stars {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        radial-gradient(1.5px 1.5px at 20px 30px, #fff, rgba(0,0,0,0)),
        radial-gradient(2px 2px at 40px 70px, rgba(255,255,255,0.7), rgba(0,0,0,0)),
        radial-gradient(1.5px 1.5px at 90px 110px, rgba(255,255,255,0.8), rgba(0,0,0,0)),
        radial-gradient(2px 2px at 150px 180px, #fff, rgba(0,0,0,0));
    background-repeat: repeat;
    background-size: 300px 300px;
    opacity: 0.25;
    pointer-events: none;
    z-index: 0;
}

.nebula {
    position: fixed;
    top: -20%;
    right: -20%;
    width: 80%;
    height: 80%;
    background: radial-gradient(circle, rgba(189, 0, 255, 0.08) 0%, rgba(0, 243, 255, 0.03) 50%, rgba(0, 0, 0, 0) 100%);
    filter: blur(80px);
    pointer-events: none;
    z-index: 0;
}

/* App Container and Structure */
.app-container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    position: relative;
    z-index: 1;
}

/* Header */
.app-header {
    background-color: rgba(3, 4, 10, 0.85);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-glow);
    padding: 15px 40px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
}

.logo-area {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-glow {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background-color: var(--color-cyan);
    box-shadow: 0 0 12px var(--color-cyan);
    animation: pulse 2s infinite alternate;
}

.logo-text {
    font-family: var(--font-heading);
    font-weight: 800;
    font-size: 20px;
    letter-spacing: 1.5px;
    background: linear-gradient(90deg, #fff 0%, var(--color-cyan) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.logo-subtext {
    font-weight: 400;
    font-size: 13px;
    color: var(--color-text-secondary);
}

.badge-sovereign {
    background: linear-gradient(135deg, var(--color-purple) 0%, #7c00b7 100%);
    border: 1px solid rgba(189, 0, 255, 0.4);
    font-family: var(--font-mono);
    font-size: 10px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 4px;
    letter-spacing: 1px;
    text-shadow: 0 0 5px rgba(0,0,0,0.5);
    box-shadow: 0 0 10px rgba(189, 0, 255, 0.2);
}

.app-nav {
    display: flex;
    gap: 10px;
}

.nav-link {
    color: var(--color-text-secondary);
    text-decoration: none;
    font-weight: 500;
    font-size: 14px;
    padding: 8px 16px;
    border-radius: 6px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    border: 1px solid transparent;
}

.nav-link:hover {
    color: #fff;
    background-color: rgba(255, 255, 255, 0.05);
}

.nav-link.active {
    color: #fff;
    background-color: rgba(0, 243, 255, 0.06);
    border: 1px solid rgba(0, 243, 255, 0.25);
    box-shadow: 0 0 15px rgba(0, 243, 255, 0.05);
}

.header-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--color-text-secondary);
}

.status-indicator {
    width: 6px;
    height: 6px;
    border-radius: 50%;
}

.status-indicator.online {
    background-color: var(--color-green);
    box-shadow: 0 0 8px var(--color-green);
}

/* App Main Content */
.app-content {
    flex: 1;
    padding: 30px 40px;
    width: 100%;
    max-width: 1600px;
    margin: 0 auto;
}

/* Alerts */
.alert {
    padding: 15px 20px;
    border-radius: 8px;
    margin-bottom: 25px;
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 500;
    backdrop-filter: blur(8px);
}

.alert-success {
    background-color: rgba(57, 255, 20, 0.06);
    border: 1px solid rgba(57, 255, 20, 0.25);
    color: #b5ffab;
}

.alert-error {
    background-color: rgba(255, 42, 109, 0.06);
    border: 1px solid rgba(255, 42, 109, 0.25);
    color: #ffb1c4;
}

/* Cards / Glass Panels */
.glass-panel {
    background-color: var(--bg-card);
    backdrop-filter: blur(16px);
    border: 1px solid var(--border-glow);
    border-radius: 12px;
    padding: 24px;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.glass-panel:hover {
    border-color: var(--border-glow-active);
    background-color: var(--bg-card-hover);
    box-shadow: 0 15px 35px rgba(0, 243, 255, 0.03);
}

/* Dashboard Layout */
.dashboard-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 25px;
}

.dashboard-left {
    display: flex;
    flex-direction: column;
    gap: 25px;
}

.dashboard-right {
    display: flex;
    flex-direction: column;
    gap: 25px;
}

/* Scorecards Container */
.scorecards-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 15px;
}

.scorecard-mini {
    text-align: center;
    padding: 16px 10px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    border-radius: 10px;
}

.scorecard-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--color-text-secondary);
    margin-bottom: 6px;
}

.scorecard-value {
    font-family: var(--font-heading);
    font-weight: 800;
    font-size: 24px;
}

.scorecard-value.frs-glow {
    color: var(--color-green);
    text-shadow: 0 0 10px rgba(57, 255, 20, 0.4);
}

.scorecard-value.ai-glow {
    color: var(--color-cyan);
    text-shadow: 0 0 10px rgba(0, 243, 255, 0.4);
}

.scorecard-value.sentiment-glow {
    color: var(--color-purple);
}

.scorecard-value.risk-glow {
    color: var(--color-red);
}

/* Interactive Command Console Terminal */
.console-panel {
    display: flex;
    flex-direction: column;
    background-color: var(--bg-darker);
    border: 1px solid var(--border-glow);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.5);
    height: 480px;
}

.console-header {
    background-color: rgba(13, 16, 37, 0.8);
    border-bottom: 1px solid var(--border-glow);
    padding: 12px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.console-title {
    font-family: var(--font-mono);
    font-weight: 700;
    font-size: 12px;
    letter-spacing: 1px;
    color: var(--color-cyan);
    display: flex;
    align-items: center;
    gap: 8px;
}

.console-dots {
    display: flex;
    gap: 6px;
}

.console-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.console-dot.red { background-color: var(--color-red); }
.console-dot.yellow { background-color: var(--color-gold); }
.console-dot.green { background-color: var(--color-green); }

.console-body {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    font-family: var(--font-mono);
    font-size: 13px;
    color: #e2e8f0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.console-welcome {
    color: var(--color-text-secondary);
    line-height: 1.8;
}

.console-line-input {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: auto;
    border-top: 1px solid rgba(0, 243, 255, 0.1);
    padding-top: 15px;
}

.console-prompt {
    color: var(--color-cyan);
    font-weight: 700;
}

.console-input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: #fff;
    font-family: var(--font-mono);
    font-size: 14px;
}

.console-output-block {
    white-space: pre-wrap;
    background-color: rgba(255, 255, 255, 0.01);
    border-radius: 6px;
    padding: 10px;
    border-left: 2px solid var(--color-cyan);
    animation: fadeIn 0.3s ease;
}

.console-output-query {
    color: var(--color-gold);
    margin-bottom: 5px;
    font-weight: 600;
}

/* Sidebar components */
.widget-title {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 16px;
    color: #fff;
    margin-bottom: 18px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    padding-bottom: 8px;
}

.widget-link {
    font-size: 12px;
    color: var(--color-cyan);
    text-decoration: none;
}

.widget-link:hover {
    text-decoration: underline;
}

/* Astro transits list */
.transit-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.transit-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background-color: rgba(255,255,255,0.02);
    border-radius: 6px;
    border-left: 3px solid var(--color-purple);
}

.transit-planet {
    font-weight: 600;
    color: #fff;
}

.transit-sign {
    color: var(--color-text-secondary);
}

.transit-retro {
    font-size: 10px;
    font-family: var(--font-mono);
    color: var(--color-red);
    background-color: rgba(255, 42, 109, 0.1);
    padding: 1px 4px;
    border-radius: 3px;
}

/* Tables styling */
.data-table-container {
    overflow-x: auto;
    width: 100%;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.data-table th {
    text-align: left;
    padding: 12px 16px;
    color: var(--color-text-secondary);
    font-weight: 600;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    font-family: var(--font-heading);
}

.data-table td {
    padding: 14px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

.data-table tr:hover td {
    background-color: rgba(255,255,255,0.01);
}

/* Badges and tags */
.badge-signal {
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 4px;
}

.badge-signal.buy {
    background-color: rgba(57, 255, 20, 0.1);
    color: var(--color-green);
    border: 1px solid rgba(57, 255, 20, 0.3);
}

.badge-signal.sell {
    background-color: rgba(255, 42, 109, 0.1);
    color: var(--color-red);
    border: 1px solid rgba(255, 42, 109, 0.3);
}

.badge-signal.avoid {
    background-color: rgba(255, 255, 255, 0.05);
    color: var(--color-text-secondary);
    border: 1px solid rgba(255, 255, 255, 0.15);
}

/* Form Styles */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    font-weight: 500;
    font-size: 13px;
    color: var(--color-text-secondary);
    margin-bottom: 8px;
    font-family: var(--font-heading);
}

.form-input, .form-select, .form-textarea {
    width: 100%;
    background-color: rgba(3, 4, 10, 0.8);
    border: 1px solid var(--border-glow);
    border-radius: 6px;
    color: #fff;
    padding: 10px 14px;
    font-size: 14px;
    outline: none;
    transition: all 0.3s ease;
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
    border-color: var(--color-cyan);
    box-shadow: 0 0 10px rgba(0, 243, 255, 0.15);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 14px;
    padding: 10px 20px;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--color-cyan) 0%, #00bcff 100%);
    color: #03040a;
    box-shadow: 0 0 15px rgba(0, 243, 255, 0.3);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 0 22px rgba(0, 243, 255, 0.55);
}

.btn-secondary {
    background-color: rgba(255,255,255,0.06);
    color: #fff;
    border: 1px solid rgba(255,255,255,0.1);
}

.btn-secondary:hover {
    background-color: rgba(255,255,255,0.1);
}

/* Footer */
.app-footer {
    background-color: var(--bg-darker);
    border-top: 1px solid var(--border-glow);
    padding: 18px 40px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 11px;
    color: var(--color-text-muted);
}

.footer-mode {
    font-family: var(--font-mono);
    color: var(--color-cyan);
    letter-spacing: 0.8px;
}

/* Loader Animation */
.console-loader {
    display: inline-block;
    width: 12px;
    height: 12px;
    border: 2px solid rgba(0, 243, 255, 0.2);
    border-radius: 50%;
    border-top-color: var(--color-cyan);
    animation: spin 0.8s linear infinite;
    vertical-align: middle;
    margin-right: 8px;
}

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

@keyframes pulse {
    from { opacity: 0.5; box-shadow: 0 0 5px var(--color-cyan); }
    to { opacity: 1; box-shadow: 0 0 15px var(--color-cyan); }
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Responsive constraints */
@media (max-width: 1100px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
}

/* Watch List Specific Styles */
.watchlist-container {
    max-height: 420px;
    overflow-y: auto;
    padding-right: 5px;
}
.watchlist-container::-webkit-scrollbar {
    width: 6px;
}
.watchlist-container::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.02);
    border-radius: 3px;
}
.watchlist-container::-webkit-scrollbar-thumb {
    background: rgba(0, 243, 255, 0.2);
    border-radius: 3px;
}
.watchlist-container::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 243, 255, 0.4);
}
.watchlist-item-card:hover {
    background-color: rgba(255, 255, 255, 0.05) !important;
    transform: translateX(2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* Preloader Styles */
#preloader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #03040a;
    z-index: 99999; /* Ensure it is above the header and all other views */
    display: flex;
    justify-content: center;
    align-items: center;
    transition: opacity 0.6s cubic-bezier(0.25, 1, 0.5, 1), visibility 0.6s cubic-bezier(0.25, 1, 0.5, 1);
    opacity: 1;
    visibility: visible;
}

#preloader.loaded {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.preloader-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
}

.preloader-portal {
    position: relative;
    width: 120px;
    height: 120px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.preloader-ring {
    position: absolute;
    border: 2px solid transparent;
    border-radius: 50%;
}

.ring-1 {
    width: 110px;
    height: 110px;
    border-top-color: var(--color-cyan);
    animation: rotate-clockwise 2.2s linear infinite;
}

.ring-2 {
    width: 85px;
    height: 85px;
    border-right-color: var(--color-purple);
    animation: rotate-counter 1.7s linear infinite;
}

.ring-3 {
    width: 60px;
    height: 60px;
    border-bottom-color: var(--color-gold);
    animation: rotate-clockwise 1.2s linear infinite;
}

.preloader-core {
    width: 18px;
    height: 18px;
    background-color: #fff;
    border-radius: 50%;
    box-shadow: 0 0 20px 6px var(--color-cyan);
    animation: pulse-core 2s infinite ease-in-out;
}

.preloader-logo {
    font-family: var(--font-heading);
    font-weight: 800;
    font-size: 26px;
    letter-spacing: 4px;
    background: linear-gradient(90deg, #fff 0%, var(--color-cyan) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 0 15px rgba(0, 243, 255, 0.3);
}

.preloader-subtitle {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--color-text-secondary);
    letter-spacing: 2px;
    animation: flash-text 1.6s infinite ease-in-out;
}

@keyframes rotate-clockwise {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@keyframes rotate-counter {
    from { transform: rotate(360deg); }
    to { transform: rotate(0deg); }
}

@keyframes pulse-core {
    0%, 100% { transform: scale(0.8); box-shadow: 0 0 15px 4px var(--color-cyan); }
    50% { transform: scale(1.25); box-shadow: 0 0 25px 10px var(--color-purple); }
}

@keyframes flash-text {
    0%, 100% { opacity: 0.35; }
    50% { opacity: 1; }
}
