/* ========================================
   ANALISTA EXPERTO EN INVERSIONES
   Tema Oscuro Terminal de Trading
   ======================================== */

/* Variables CSS */
:root {
    /* Colores de fondo */
    --bg-primary: #0a0a14;
    --bg-secondary: #12121e;
    --bg-tertiary: #1a1a2e;
    --bg-card: #16162a;
    --bg-hover: #1e1e3a;

    /* Colores de acento */
    --accent-green: #00ff88;
    --accent-red: #ff4757;
    --accent-blue: #4d7cff;
    --accent-yellow: #ffd93d;
    --accent-cyan: #00d4ff;

    /* Colores de texto */
    --text-primary: #ffffff;
    --text-secondary: #8b8b9e;
    --text-muted: #5a5a6e;

    /* Bordes */
    --border-color: #2a2a4a;
    --border-light: #3a3a5a;

    /* Efectos */
    --glow-green: 0 0 20px rgba(0, 255, 136, 0.3);
    --glow-red: 0 0 20px rgba(255, 71, 87, 0.3);
    --glow-blue: 0 0 20px rgba(77, 124, 255, 0.3);

    /* Tipografía */
    --font-mono: 'JetBrains Mono', monospace;
    --font-sans: 'Inter', sans-serif;

    /* Espaciado */
    --sidebar-width: 280px;
    --header-height: 120px;
}

/* Reset y Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

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

/* Scrollbar personalizado */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

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

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

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

/* ========================================
   HEADER
   ======================================== */

.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 30px;
    border-bottom: 1px solid var(--border-color);
}

.logo {
    font-family: var(--font-mono);
    font-size: 1.5rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 2px;
}

.logo-bracket {
    color: var(--accent-green);
}

.logo-text {
    color: var(--text-primary);
}

.logo-accent {
    color: var(--accent-green);
    text-shadow: var(--glow-green);
}

.market-status {
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: var(--font-mono);
    font-size: 0.85rem;
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--accent-red);
    animation: pulse 2s infinite;
}

.status-dot.open {
    background: var(--accent-green);
}

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

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

/* Ticker */
.ticker-container {
    overflow: hidden;
    background: var(--bg-primary);
    padding: 10px 0;
}

.ticker-content {
    display: flex;
    animation: ticker 30s linear infinite;
    width: fit-content;
}

.ticker-content:hover {
    animation-play-state: paused;
}

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

.ticker-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 40px;
    font-family: var(--font-mono);
    font-size: 0.85rem;
    white-space: nowrap;
    border-right: 1px solid var(--border-color);
}

.ticker-symbol {
    color: var(--text-primary);
    font-weight: 600;
}

.ticker-price {
    color: var(--text-secondary);
}

.ticker-change {
    font-weight: 500;
}

.ticker-change.positive,
.positive {
    color: var(--accent-green);
}

.ticker-change.negative,
.negative {
    color: var(--accent-red);
}

/* ========================================
   MAIN LAYOUT
   ======================================== */

.main-layout {
    display: flex;
    margin-top: var(--header-height);
    min-height: calc(100vh - var(--header-height));
}

/* ========================================
   SIDEBAR
   ======================================== */

.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    padding: 20px;
    position: fixed;
    top: var(--header-height);
    left: 0;
    bottom: 0;
    overflow-y: auto;
}

.sidebar-section {
    margin-bottom: 30px;
}

.sidebar-title {
    font-family: var(--font-mono);
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.terminal-prompt {
    color: var(--accent-green);
    font-weight: 700;
}

/* Search */
.search-container {
    display: flex;
    gap: 8px;
}

.search-input {
    flex: 1;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 10px 15px;
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 0.85rem;
    transition: border-color 0.3s, box-shadow 0.3s;
}

.search-input:focus {
    outline: none;
    border-color: var(--accent-blue);
    box-shadow: var(--glow-blue);
}

.search-input::placeholder {
    color: var(--text-muted);
}

.search-btn {
    background: var(--accent-blue);
    border: none;
    border-radius: 6px;
    padding: 10px 15px;
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s, transform 0.2s;
}

.search-btn:hover {
    background: #3d6cef;
    transform: translateY(-2px);
}

/* Watchlist */
.watchlist {
    list-style: none;
}

.watchlist-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: background 0.3s, border-color 0.3s;
    font-family: var(--font-mono);
    font-size: 0.85rem;
}

.watchlist-item:hover {
    background: var(--bg-hover);
    border-color: var(--accent-blue);
}

.watchlist-item .symbol {
    font-weight: 600;
    color: var(--text-primary);
}

.watchlist-item .price {
    color: var(--text-secondary);
}

.watchlist-item .change {
    font-weight: 500;
}

/* Indices */
.indices-list {
    list-style: none;
}

.index-item {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-color);
    font-family: var(--font-mono);
    font-size: 0.85rem;
}

.index-item:last-child {
    border-bottom: none;
}

.index-name {
    color: var(--text-secondary);
}

.index-value {
    font-weight: 600;
}

/* ========================================
   MAIN CONTENT
   ======================================== */

.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 20px 30px;
}

/* Chart Section */
.chart-section {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 30px;
}

.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-tertiary);
}

.chart-title {
    display: flex;
    align-items: center;
    gap: 10px;
}

.current-symbol {
    font-family: var(--font-mono);
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

.current-name {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.chart-price-info {
    text-align: right;
}

.big-price {
    font-family: var(--font-mono);
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    display: block;
}

.price-change {
    font-family: var(--font-mono);
    font-size: 1rem;
    font-weight: 500;
}

.chart-container {
    height: 500px;
    background: var(--bg-primary);
}

.tradingview-widget-container {
    height: 100%;
}

/* ========================================
   QUOTES TABLE
   ======================================== */

.quotes-section {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
}

.section-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-tertiary);
}

.section-header h2 {
    font-family: var(--font-mono);
    font-size: 1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
}

.table-container {
    overflow-x: auto;
}

.quotes-table {
    width: 100%;
    border-collapse: collapse;
}

.quotes-table th,
.quotes-table td {
    padding: 15px 20px;
    text-align: right;
    font-family: var(--font-mono);
    font-size: 0.85rem;
    border-bottom: 1px solid var(--border-color);
}

.quotes-table th {
    background: var(--bg-secondary);
    color: var(--text-muted);
    font-weight: 500;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.5px;
}

.quotes-table td:first-child,
.quotes-table th:first-child {
    text-align: left;
}

.quote-row {
    cursor: pointer;
    transition: background 0.2s;
}

.quote-row:hover {
    background: var(--bg-hover);
}

.symbol-cell {
    font-weight: 700;
    color: var(--accent-blue);
}

.price-cell {
    font-weight: 600;
    color: var(--text-primary);
}

.volume-cell {
    color: var(--text-secondary);
}

.sparkline-cell {
    width: 100px;
}

.sparkline {
    width: 80px;
    height: 30px;
}

/* ========================================
   CHATBOT
   ======================================== */

.chatbot-container {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 1001;
}

.chatbot-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    background: linear-gradient(135deg, var(--accent-green), #00cc6a);
    border: none;
    border-radius: 50px;
    padding: 15px 25px;
    color: var(--bg-primary);
    font-family: var(--font-mono);
    font-weight: 700;
    font-size: 0.9rem;
    cursor: pointer;
    transition: transform 0.3s, box-shadow 0.3s;
    box-shadow: var(--glow-green);
}

.chatbot-toggle:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 40px rgba(0, 255, 136, 0.4);
}

.chat-icon {
    font-size: 1.2rem;
}

.chatbot-window {
    position: absolute;
    bottom: 70px;
    right: 0;
    width: 400px;
    max-height: 550px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    overflow: hidden;
    display: none;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.chatbot-window.active {
    display: flex;
    animation: slideUp 0.3s ease-out;
}

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

.chat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border-color);
}

.chat-header-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.chat-title {
    font-family: var(--font-mono);
    font-weight: 600;
    color: var(--text-primary);
}

.chat-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-family: var(--font-mono);
    font-size: 1rem;
    cursor: pointer;
    padding: 5px 10px;
    border-radius: 4px;
    transition: background 0.2s, color 0.2s;
}

.chat-close:hover {
    background: var(--bg-hover);
    color: var(--accent-red);
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    max-height: 300px;
}

.message {
    max-width: 85%;
    animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.message.user {
    align-self: flex-end;
}

.message.assistant {
    align-self: flex-start;
}

.message-content {
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 0.9rem;
    line-height: 1.5;
}

.message.user .message-content {
    background: var(--accent-blue);
    color: var(--text-primary);
    border-bottom-right-radius: 4px;
}

.message.assistant .message-content {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    border-bottom-left-radius: 4px;
}

.message-content ul {
    margin: 10px 0;
    padding-left: 20px;
}

.message-content li {
    margin: 5px 0;
    color: var(--text-secondary);
}

.message-content .disclaimer {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--border-color);
    font-size: 0.8rem;
    color: var(--text-muted);
    font-style: italic;
}

.typing-indicator {
    display: flex;
    gap: 5px;
    padding: 15px;
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent-green);
    animation: typing 1.4s infinite;
}

.typing-indicator span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-indicator span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {
    0%, 100% { opacity: 0.3; transform: scale(0.8); }
    50% { opacity: 1; transform: scale(1); }
}

.chat-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px 20px;
    border-top: 1px solid var(--border-color);
    background: var(--bg-tertiary);
}

.suggestion {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 8px 15px;
    color: var(--text-secondary);
    font-family: var(--font-mono);
    font-size: 0.75rem;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s, color 0.2s;
}

.suggestion:hover {
    background: var(--bg-hover);
    border-color: var(--accent-green);
    color: var(--accent-green);
}

.chat-input-container {
    display: flex;
    gap: 10px;
    padding: 15px 20px;
    background: var(--bg-primary);
    border-top: 1px solid var(--border-color);
}

#chatInput {
    flex: 1;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 12px 15px;
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 0.9rem;
    transition: border-color 0.3s;
}

#chatInput:focus {
    outline: none;
    border-color: var(--accent-green);
}

#chatInput::placeholder {
    color: var(--text-muted);
}

.chat-send-btn {
    background: var(--accent-green);
    border: none;
    border-radius: 8px;
    padding: 12px 20px;
    color: var(--bg-primary);
    font-family: var(--font-mono);
    font-weight: 700;
    font-size: 0.8rem;
    cursor: pointer;
    transition: background 0.3s, transform 0.2s;
}

.chat-send-btn:hover {
    background: #00cc6a;
    transform: scale(1.05);
}

.chat-send-btn:disabled {
    background: var(--text-muted);
    cursor: not-allowed;
    transform: none;
}

/* ========================================
   CONFIG MODAL
   ======================================== */

.config-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 2000;
}

.config-modal.active {
    display: flex;
}

.config-modal-content {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 30px;
    max-width: 500px;
    width: 90%;
}

.config-modal-content h2 {
    font-family: var(--font-mono);
    font-size: 1.2rem;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.config-modal-content p {
    color: var(--text-secondary);
    margin-bottom: 20px;
}

.config-modal-content ol {
    margin: 20px 0;
    padding-left: 25px;
    color: var(--text-secondary);
}

.config-modal-content li {
    margin: 10px 0;
}

.config-modal-content code {
    background: var(--bg-primary);
    padding: 3px 8px;
    border-radius: 4px;
    font-family: var(--font-mono);
    font-size: 0.85rem;
    color: var(--accent-cyan);
}

.config-modal-content a {
    color: var(--accent-blue);
    text-decoration: none;
}

.config-modal-content a:hover {
    text-decoration: underline;
}

.config-close-btn {
    background: var(--accent-green);
    border: none;
    border-radius: 8px;
    padding: 12px 30px;
    color: var(--bg-primary);
    font-family: var(--font-mono);
    font-weight: 700;
    cursor: pointer;
    transition: background 0.3s;
    margin-top: 20px;
}

.config-close-btn:hover {
    background: #00cc6a;
}

/* ========================================
   RESPONSIVE
   ======================================== */

@media (max-width: 1024px) {
    :root {
        --sidebar-width: 240px;
    }

    .chart-container {
        height: 400px;
    }
}

@media (max-width: 768px) {
    :root {
        --header-height: 100px;
    }

    .sidebar {
        display: none;
    }

    .main-content {
        margin-left: 0;
        padding: 15px;
    }

    .header-content {
        padding: 10px 15px;
    }

    .logo {
        font-size: 1.2rem;
    }

    .chart-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }

    .chart-price-info {
        text-align: left;
    }

    .big-price {
        font-size: 1.5rem;
    }

    .chart-container {
        height: 350px;
    }

    .quotes-table th,
    .quotes-table td {
        padding: 10px 12px;
        font-size: 0.75rem;
    }

    .sparkline-cell {
        display: none;
    }

    .chatbot-container {
        bottom: 20px;
        right: 20px;
    }

    .chatbot-window {
        width: calc(100vw - 40px);
        max-width: 400px;
        right: -10px;
    }

    .chatbot-toggle {
        padding: 12px 20px;
        font-size: 0.85rem;
    }

    .chat-label {
        display: none;
    }
}

@media (max-width: 480px) {
    .quotes-table .volume-cell {
        display: none;
    }

    .ticker-item {
        padding: 0 20px;
        font-size: 0.75rem;
    }

    .section-header h2 {
        font-size: 0.85rem;
    }
}

/* ========================================
   DEMO BANNER
   ======================================== */

.demo-banner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: linear-gradient(90deg, #10b981, #059669);
    color: white;
    text-align: center;
    padding: 12px 20px;
    font-size: 0.9rem;
    font-weight: 600;
    z-index: 10001;
    box-shadow: 0 2px 10px rgba(16, 185, 129, 0.3);
}

.demo-banner a {
    color: white;
    text-decoration: underline;
}

/* Offset for fixed elements due to banner */
body {
    padding-top: 45px !important;
}

/* ========================================
   CTA HIRE SECTION
   ======================================== */

.cta-hire-section {
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    padding: 100px 5%;
    text-align: center;
    border-top: 1px solid rgba(16, 185, 129, 0.2);
}

.cta-hire-content h2 {
    font-size: clamp(2rem, 5vw, 3.5rem);
    color: white;
    margin-bottom: 20px;
    font-weight: 700;
}

.cta-hire-content p {
    font-size: 1.2rem;
    color: rgba(255,255,255,0.7);
    max-width: 600px;
    margin: 0 auto 40px;
}

.cta-hire-buttons {
    display: flex;
    gap: 20px;
    justify-content: center;
    flex-wrap: wrap;
}

.cta-hire-buttons .btn {
    padding: 16px 36px;
    font-size: 1rem;
    font-weight: 600;
    border-radius: 50px;
    text-decoration: none;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.cta-hire-buttons .btn-primary {
    background: #10b981;
    color: white;
    box-shadow: 0 4px 20px rgba(16, 185, 129, 0.4);
}

.cta-hire-buttons .btn-primary:hover {
    background: #059669;
    transform: translateY(-3px);
    box-shadow: 0 8px 30px rgba(16, 185, 129, 0.5);
}

.cta-hire-buttons .btn-secondary {
    background: transparent;
    color: white;
    border: 2px solid rgba(255,255,255,0.3);
}

.cta-hire-buttons .btn-secondary:hover {
    border-color: #10b981;
    color: #10b981;
}

.cta-sites {
    margin-top: 30px;
    font-size: 0.95rem;
    color: rgba(255,255,255,0.5);
}

.cta-sites a {
    color: #10b981;
    text-decoration: none;
}

.cta-sites a:hover {
    text-decoration: underline;
}
