/* =========================================================
   DASHBOARD - POLTRADERS
   CSS COMPLETAMENTE RECONSTRUIDO
========================================================= */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

:root {
    --primary: #efb810;
    --primary-hover: #d4a00e;
    --bg-dark: #0a0a0b;
    --bg-sidebar: #0f0f11;
    --bg-card: rgba(255, 255, 255, 0.04);
    --border: rgba(255, 255, 255, 0.08);
    --text: #ffffff;
    --text-muted: rgba(255, 255, 255, 0.55);
    --success: #00e676;
    --error: #ff6b6b;
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
    background: var(--bg-dark);
    color: var(--text);
    min-height: 100vh;
    overflow-x: hidden;
}

/* ======================
   LAYOUT PRINCIPAL
====================== */
.dashboard {
    display: flex;
    min-height: 100vh;
}

/* ======================
   SIDEBAR
====================== */
.sidebar {
    width: 280px;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 28px 20px;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    z-index: 100;
}

.sidebar::-webkit-scrollbar {
    width: 5px;
}
.sidebar::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 10px;
}

.sidebar-back {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.82rem;
    font-weight: 600;
    padding: 12px 10px;
    border-radius: 10px;
    margin-top: 12px;
    border-top: 1px solid var(--border);
    padding-top: 20px;
    transition: all 0.25s ease;
}

.sidebar-back:hover {
    background: rgba(239, 184, 16, 0.1);
    color: var(--primary);
}

.sidebar-logo {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--primary);
    margin-bottom: 32px;
    text-align: center;
    letter-spacing: -0.5px;
}

.sidebar-logo-img {
    display: block;
    max-width: 160px;
    max-height: 60px;
    width: auto;
    height: auto;
    margin: 0 auto 32px;
    transition: opacity 0.2s ease;
}

.sidebar-logo-img:hover {
    opacity: 0.85;
}

.sidebar a:has(> .sidebar-logo-img) {
    display: block;
    text-decoration: none;
}

.sidebar-profile {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px;
    background: var(--bg-card);
    border-radius: 14px;
    margin-bottom: 28px;
    border: 1px solid var(--border);
}

.sidebar-avatar {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    object-fit: cover;
}

.sidebar-name {
    font-weight: 600;
    font-size: 0.95rem;
}

.sidebar-menu {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
}

.sidebar-menu a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: 12px;
    font-size: 0.95rem;
    font-weight: 500;
    transition: all 0.25s ease;
}

.sidebar-menu a i {
    width: 20px;
    text-align: center;
    font-size: 1.05rem;
}

.sidebar-menu a:hover {
    background: rgba(239, 184, 16, 0.1);
    color: var(--text);
}

.sidebar-menu a.active {
    background: rgba(239, 184, 16, 0.15);
    color: var(--primary);
}

.sidebar-menu a.coming-soon {
    opacity: 0.6;
    cursor: default;
    pointer-events: none;
}

.badge-soon {
    margin-left: auto;
    background: rgba(239, 184, 16, 0.2);
    color: var(--primary);
    font-size: 0.7rem;
    padding: 3px 8px;
    border-radius: 20px;
    font-weight: 600;
}

/* ======================
   MAIN CONTENT
====================== */
.main-content {
    flex: 1;
    margin-left: 280px;
    padding: 32px 40px;
    min-height: 100vh;
}

.section {
    display: none;
}

.section.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.topbar {
    margin-bottom: 32px;
}

.topbar h1 {
    font-size: 1.9rem;
    font-weight: 700;
    margin-bottom: 6px;
}

.welcome {
    color: var(--text-muted);
    font-size: 0.95rem;
}

/* ======================
   STATS GRID
====================== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 24px;
    transition: all 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-4px);
    border-color: rgba(239, 184, 16, 0.3);
    box-shadow: var(--shadow);
}

.stat-icon {
    font-size: 1.6rem;
    color: var(--primary);
    margin-bottom: 14px;
}

.stat-value {
    font-size: 1.7rem;
    font-weight: 700;
    margin-bottom: 4px;
}

.stat-label {
    font-size: 0.88rem;
    color: var(--text-muted);
}

.mini-progress {
    margin-top: 14px;
    height: 5px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    border-radius: 10px;
    transition: width 0.6s ease;
}

/* ======================
   CHARTS
====================== */
.chart-section {
    margin-bottom: 50px;
}

.chart-section h2 {
    font-size: 1.3rem;
    margin-bottom: 16px;
    font-weight: 600;
}

.symbol-selector {
    margin: 20px 0 28px;
    text-align: center;
}

.symbol-selector label {
    color: var(--text-muted);
    margin-right: 10px;
}

.symbol-selector select {
    padding: 10px 18px;
    background: var(--primary);
    color: #000;
    border: none;
    border-radius: 10px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    outline: none;
}

.tradingview-widget-container {
    border-radius: 16px;
    overflow: hidden;
    border: 1px solid var(--border);
}

/* ======================
   PROFILE HEADER
====================== */
.profile-header-card {
    display: flex;
    align-items: center;
    gap: 22px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 28px 32px;
    margin-bottom: 28px;
    flex-wrap: wrap;
}

.profile-header-avatar {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--primary);
    flex-shrink: 0;
}

.profile-avatar-wrap {
    position: relative;
    flex-shrink: 0;
}

.profile-avatar-edit {
    position: absolute;
    bottom: -2px;
    right: -2px;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: var(--primary);
    color: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    cursor: pointer;
    border: 2px solid var(--bg-sidebar);
    transition: transform 0.2s ease;
}

.profile-avatar-edit:hover {
    transform: scale(1.1);
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.profile-header-card h2 {
    font-size: 1.3rem;
    margin-bottom: 4px;
}

.profile-header-card p {
    color: var(--text-muted);
    font-size: 0.92rem;
}

.profile-header-meta {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-top: 10px;
    flex-wrap: wrap;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.role-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.78rem;
    font-weight: 700;
    background: rgba(239, 184, 16, 0.15);
    color: var(--primary);
}

/* ======================
   PROFILE FORM
====================== */
.profile-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 24px;
    align-items: start;
    max-width: 1000px;
}

.profile-form {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 36px;
    max-width: 560px;
}

.profile-grid .profile-form {
    max-width: none;
}

.profile-form h3 {
    font-size: 1.15rem;
    margin-bottom: 22px;
    font-weight: 600;
}

.form-group {
    margin-bottom: 18px;
}

.form-group label {
    display: block;
    font-size: 0.88rem;
    color: var(--text-muted);
    margin-bottom: 7px;
}

.form-group input {
    width: 100%;
    padding: 13px 16px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border);
    border-radius: 12px;
    color: var(--text);
    font-size: 0.95rem;
    outline: none;
    transition: all 0.25s ease;
}

.form-group input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(239, 184, 16, 0.15);
}

.form-group input:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-save {
    padding: 13px 28px;
    background: var(--primary);
    color: #000;
    border: none;
    border-radius: 12px;
    font-weight: 700;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.25s ease;
}

.btn-save:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
}

/* ======================
   MODULES
====================== */
.modules-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 24px;
}

.module-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 32px 24px;
    text-align: center;
    position: relative;
    transition: all 0.3s ease;
}

.module-card:hover {
    transform: translateY(-6px);
    border-color: rgba(239, 184, 16, 0.3);
}

.module-card-link {
    display: block;
    text-align: left;
    color: inherit;
    text-decoration: none;
    cursor: pointer;
}

.module-icon {
    font-size: 2.4rem;
    color: var(--primary);
    margin-bottom: 18px;
}

.module-card h3 {
    font-size: 1.2rem;
    margin-bottom: 10px;
}

.module-card p {
    color: var(--text-muted);
    font-size: 0.9rem;
    line-height: 1.5;
}

.coming-tag {
    position: absolute;
    top: 16px;
    right: 16px;
    background: rgba(239, 184, 16, 0.2);
    color: var(--primary);
    font-size: 0.72rem;
    padding: 4px 10px;
    border-radius: 20px;
    font-weight: 600;
}

/* ======================
   ACTIVITY
====================== */
.activity-box {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.activity-item {
    display: flex;
    align-items: center;
    gap: 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 16px 20px;
}

.activity-icon {
    width: 42px;
    height: 42px;
    background: rgba(239, 184, 16, 0.12);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
    font-size: 1.1rem;
}

.activity-info strong {
    display: block;
    margin-bottom: 3px;
}

.activity-info p {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* ======================
   DEVICES
====================== */
.devices-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 20px;
}

.device-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 24px;
    display: flex;
    gap: 18px;
    align-items: flex-start;
}

.device-card.inactive {
    opacity: 0.55;
}

.device-icon {
    width: 52px;
    height: 52px;
    background: rgba(239, 184, 16, 0.12);
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
    font-size: 1.4rem;
    flex-shrink: 0;
}

.device-info h3 {
    font-size: 1.05rem;
    margin-bottom: 6px;
}

.device-info p {
    font-size: 0.88rem;
    color: var(--text-muted);
    margin-bottom: 10px;
}

.status {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
}

.status.active {
    background: rgba(0, 230, 118, 0.15);
    color: var(--success);
}

.status.inactive {
    background: rgba(255, 107, 107, 0.15);
    color: var(--error);
}

.logout-all-container {
    margin-top: 40px;
    text-align: center;
}

.btn-logout-all {
    background: rgba(255, 107, 107, 0.15);
    color: var(--error);
    border: 1px solid rgba(255, 107, 107, 0.3);
    padding: 12px 24px;
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s ease;
}

.btn-logout-all:hover {
    background: rgba(255, 107, 107, 0.25);
}

/* ======================
   ALERTS
====================== */
.success-msg {
    background: rgba(0, 230, 118, 0.12);
    color: var(--success);
    padding: 14px 18px;
    border-radius: 12px;
    margin-bottom: 24px;
    border: 1px solid rgba(0, 230, 118, 0.25);
}

.error-msg {
    background: rgba(255, 107, 107, 0.12);
    color: var(--error);
    padding: 14px 18px;
    border-radius: 12px;
    margin-bottom: 24px;
    border: 1px solid rgba(255, 107, 107, 0.25);
}

/* ======================
   RIESGO / LEGAL
====================== */
.riesgo-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 32px;
    line-height: 1.7;
    font-size: 0.92rem;
    color: var(--text-muted);
    margin-top: 40px;
}

.riesgo-card h2 {
    margin-bottom: 20px;
    color: var(--text);
}

.risk-note {
    color: var(--primary);
    font-weight: 700;
    margin: 18px 0 8px;
    display: block;
}

.terminos-note {
    color: var(--primary);
    font-weight: 600;
}

.text-informacion {
    background: linear-gradient(135deg, #fff 0%, #ef1010 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.custom-select {
    position: relative;
    width: 100%;
}

.custom-select select {
    width: 100%;
    padding: 14px 45px 14px 16px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border);
    border-radius: 12px;
    color: var(--text);
    font-size: 0.95rem;
    font-family: inherit;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    cursor: pointer;
    transition: all 0.25s ease;
    outline: none;
}

.custom-select select:hover {
    border-color: rgba(239, 184, 16, 0.4);
    background: rgba(255, 255, 255, 0.06);
}

.custom-select select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(239, 184, 16, 0.15);
    background: rgba(255, 255, 255, 0.07);
}

/* Flecha personalizada */
.select-arrow {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--primary);
    font-size: 0.85rem;
    pointer-events: none;
    transition: transform 0.25s ease;
}

.custom-select select:focus + .select-arrow {
    transform: translateY(-50%) rotate(180deg);
}

/* Estilo de las opciones (funciona en algunos navegadores) */
.custom-select select option {
    background: #1a1a1c;
    color: #fff;
    padding: 12px;
}

/* ======================
   RESPONSIVE
====================== */
@media (max-width: 1024px) {
    .sidebar {
        width: 240px;
    }
    .main-content {
        margin-left: 240px;
        padding: 24px;
    }
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }
    .sidebar.open {
        transform: translateX(0);
    }
    .main-content {
        margin-left: 0;
        padding: 20px 16px;
    }
    .stats-grid {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .modules-grid {
        grid-template-columns: 1fr;
    }
    
    .devices-list {
        grid-template-columns: 1fr;
    }
}
/* ======================
   TOAST
====================== */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 9999;
}

.toast {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--bg-sidebar);
    border: 1px solid var(--border);
    border-left: 3px solid var(--success);
    border-radius: 12px;
    padding: 14px 18px;
    box-shadow: var(--shadow);
    color: var(--text);
    font-size: 0.9rem;
    min-width: 260px;
    max-width: 360px;
    animation: toast-in 0.25s ease;
}

.toast.error {
    border-left-color: var(--error);
}

.toast i {
    color: var(--success);
    font-size: 1.1rem;
}

.toast.error i {
    color: var(--error);
}

.toast.hide {
    animation: toast-out 0.25s ease forwards;
}

@keyframes toast-in {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes toast-out {
    from { opacity: 1; transform: translateY(0); }
    to   { opacity: 0; transform: translateY(12px); }
}
