/* ============================================
   VARIABLES Y CONFIGURACIÓN GLOBAL
   ============================================ */
:root {
    --primary-color: #0d6efd;
    --secondary-color: #6c757d;
    --success-color: #198754;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --info-color: #0dcaf0;
    --light-color: #f8f9fa;
    --dark-color: #212529;
    --border-radius: 10px;
    --box-shadow: 0 5px 15px rgba(0, 0, 0, 0.08);
    --transition: all 0.3s ease;
}

/* ============================================
   ESTILOS GENERALES
   ============================================ */
body {
    font-family: 'Segoe UI', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: #f8fafc;
    color: #333;
    line-height: 1.6;
    padding-top: 70px; /* Para navbar fija */
}

/* ============================================
   BARRA DE NAVEGACIÓN
   ============================================ */
.navbar {
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    border-bottom: 1px solid #e9ecef;
}

.navbar-brand {
    font-weight: 700;
    font-size: 1.5rem;
}

.brand-text {
    color: var(--primary-color);
    font-weight: 700;
}

.brand-subtext {
    color: var(--dark-color);
    font-weight: 300;
}

.demo-badge {
    font-size: 0.6rem;
    background: linear-gradient(135deg, var(--warning-color) 0%, #ff9900 100%);
    color: white;
    padding: 3px 8px;
    border-radius: 20px;
    margin-left: 8px;
    vertical-align: middle;
    font-weight: 600;
}

/* ============================================
   PESTAÑAS
   ============================================ */
.nav-tabs {
    border-bottom: 2px solid #e9ecef;
    background: white;
    padding: 0 1rem;
    border-radius: var(--border-radius) var(--border-radius) 0 0;
}

.nav-tabs .nav-link {
    color: #6c757d;
    font-weight: 500;
    border: none;
    border-bottom: 3px solid transparent;
    padding: 12px 24px;
    transition: var(--transition);
    margin-bottom: -2px;
}

.nav-tabs .nav-link:hover {
    color: var(--primary-color);
    background-color: rgba(13, 110, 253, 0.05);
    border-bottom-color: rgba(13, 110, 253, 0.3);
}

.nav-tabs .nav-link.active {
    color: var(--primary-color);
    background-color: transparent;
    border-bottom-color: var(--primary-color);
}

.tab-content {
    background: white;
    border-radius: 0 0 var(--border-radius) var(--border-radius);
    box-shadow: var(--box-shadow);
    min-height: 500px;
}

/* ============================================
   TARJETAS
   ============================================ */
.card {
    border: none;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    transition: var(--transition);
    margin-bottom: 1.5rem;
    overflow: hidden;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.12);
}

.card-header {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-bottom: 1px solid #dee2e6;
    font-weight: 600;
    padding: 1.25rem 1.5rem;
    color: var(--dark-color);
}

/* ============================================
   BOTONES
   ============================================ */
.btn {
    border-radius: 8px;
    font-weight: 500;
    padding: 10px 24px;
    transition: var(--transition);
    border: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color) 0%, #0b5ed7 100%);
    border-color: var(--primary-color);
}

.btn-primary:hover {
    background: linear-gradient(135deg, #0b5ed7 0%, #0a58ca 100%);
    border-color: #0a58ca;
    transform: translateY(-2px);
}

.btn-success {
    background: linear-gradient(135deg, var(--success-color) 0%, #157347 100%);
    border-color: var(--success-color);
}

.btn-danger {
    background: linear-gradient(135deg, var(--danger-color) 0%, #bb2d3b 100%);
    border-color: var(--danger-color);
}

.btn-outline-primary {
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
    background: transparent;
}

.btn-outline-primary:hover {
    background: linear-gradient(135deg, var(--primary-color) 0%, #0b5ed7 100%);
    color: white;
    transform: translateY(-2px);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.875rem;
}

/* ============================================
   FORMULARIOS Y ENTRADAS
   ============================================ */
.form-control, .form-select {
    border-radius: 8px;
    border: 2px solid #e9ecef;
    padding: 12px 16px;
    transition: var(--transition);
    font-size: 1rem;
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
    transform: translateY(-1px);
}

.search-box {
    border-radius: 25px;
    border: 2px solid #e9ecef;
    padding: 12px 20px;
}

.search-box:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}

/* ============================================
   ESTADOS Y COLORES
   ============================================ */
.positive {
    color: var(--success-color);
    font-weight: 600;
}

.negative {
    color: var(--danger-color);
    font-weight: 600;
}

/* ============================================
   TARJETAS DE ACCIONES
   ============================================ */
.stock-card {
    border-left: 5px solid var(--primary-color);
    transition: var(--transition);
    cursor: pointer;
    height: 100%;
    position: relative;
}

.stock-card:hover {
    transform: translateY(-5px) scale(1.02);
    box-shadow: 0 12px 25px rgba(0, 0, 0, 0.15) !important;
}

.stock-card[data-category="tech"] { border-left-color: #0d6efd; }
.stock-card[data-category="finance"] { border-left-color: #198754; }
.stock-card[data-category="health"] { border-left-color: #dc3545; }
.stock-card[data-category="consumer"] { border-left-color: #fd7e14; }
.stock-card[data-category="etf"] { border-left-color: #6f42c1; }
.stock-card[data-category="energy"] { border-left-color: #20c997; }
.stock-card[data-category="crypto"] { border-left-color: #f7931a; }

.favorite-star {
    transition: var(--transition);
}

.favorite-star:hover {
    transform: scale(1.3);
}

/* ============================================
   GRÁFICOS
   ============================================ */
.chart-container {
    height: 400px;
    position: relative;
    width: 100%;
}

/* ============================================
   TABLAS
   ============================================ */
.table {
    margin-bottom: 0;
    border-collapse: separate;
    border-spacing: 0;
}

.table thead th {
    border-bottom: 2px solid #e9ecef;
    font-weight: 600;
    color: #6c757d;
    padding: 1rem;
    background-color: #f8f9fa;
    position: sticky;
    top: 0;
    z-index: 10;
}

.table tbody td {
    padding: 1rem;
    vertical-align: middle;
    border-top: 1px solid #e9ecef;
}

.table-hover tbody tr:hover {
    background-color: rgba(13, 110, 253, 0.05);
    transform: translateX(5px);
    transition: var(--transition);
}

/* ============================================
   COMPONENTES ESPECIALES
   ============================================ */
.balance-card {
    background: linear-gradient(135deg, #0d6efd 0%, #0b5ed7 100%);
    color: white;
    border-radius: var(--border-radius);
    padding: 1.5rem;
    position: relative;
    overflow: hidden;
}

.balance-card::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 100%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 1%, transparent 1%);
    background-size: 20px 20px;
    opacity: 0.3;
}

.api-status {
    background-color: #e7f1ff;
    color: #0a58ca;
    padding: 12px 20px;
    border-radius: var(--border-radius);
    border-left: 5px solid var(--primary-color);
    margin: 10px 0;
    box-shadow: 0 3px 10px rgba(0,0,0,0.05);
}

.holdings-container {
    max-height: 300px;
    overflow-y: auto;
    padding-right: 5px;
}

.holdings-container::-webkit-scrollbar {
    width: 6px;
}

.holdings-container::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.holdings-container::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 10px;
}

.holdings-container::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

.stats-card {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: var(--border-radius);
    padding: 1rem;
    text-align: center;
    border: 1px solid #dee2e6;
}

.stats-label {
    font-size: 0.875rem;
    color: #6c757d;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.stats-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--dark-color);
}

.price-display {
    background: #f8f9fa;
    border: 2px solid #dee2e6;
    border-radius: var(--border-radius);
    padding: 10px;
    text-align: center;
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--dark-color);
}

/* ============================================
   MODAL
   ============================================ */
.modal-content {
    border-radius: var(--border-radius);
    border: none;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
}

.modal-header {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-bottom: 1px solid #dee2e6;
    padding: 1.5rem 2rem;
}

.modal-body {
    padding: 2rem;
}

.stock-symbol-lg {
    font-size: 3rem;
    font-weight: 800;
    color: var(--primary-color);
    letter-spacing: 1px;
}

.price-lg {
    font-size: 3.5rem;
    font-weight: 800;
    color: var(--dark-color);
    margin: 10px 0;
}

.change-indicator {
    font-size: 1.5rem;
    font-weight: 700;
    padding: 8px 20px;
    border-radius: 50px;
    display: inline-block;
    background-color: rgba(25, 135, 84, 0.1);
}

.negative.change-indicator {
    background-color: rgba(220, 53, 69, 0.1);
}

/* ============================================
   NOTIFICACIONES
   ============================================ */
.notification-container {
    position: fixed;
    top: 90px;
    right: 20px;
    z-index: 9999;
    width: 350px;
}

.notification {
    margin-bottom: 10px;
    border-radius: var(--border-radius);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    border: none;
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* ============================================
   FOOTER
   ============================================ */
footer {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-top: 1px solid #dee2e6;
    color: #6c757d;
    padding: 2rem 0;
    margin-top: 3rem;
}

.footer-title {
    font-weight: 700;
    color: var(--dark-color);
    margin-bottom: 0.5rem;
    font-size: 1.2rem;
}

.footer-text {
    font-size: 0.95rem;
    line-height: 1.7;
    margin-bottom: 0;
}

.footer-links {
    font-size: 0.9rem;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.footer-links span {
    margin-bottom: 5px;
}

.btn-close-status {
    background: none;
    border: none;
    font-size: 1.8rem;
    color: inherit;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    opacity: 0.7;
    transition: var(--transition);
}

.btn-close-status:hover {
    opacity: 1;
    transform: scale(1.2);
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 768px) {
    body {
        padding-top: 60px;
    }
    
    .navbar-brand {
        font-size: 1.2rem;
    }
    
    .nav-tabs .nav-link {
        padding: 10px 15px;
        font-size: 0.9rem;
    }
    
    .chart-container {
        height: 300px;
    }
    
    .price-lg {
        font-size: 2.5rem;
    }
    
    .stock-symbol-lg {
        font-size: 2rem;
    }
    
    .notification-container {
        width: 90%;
        left: 5%;
        right: 5%;
    }
    
    .d-flex.flex-wrap.gap-2 {
        gap: 0.3rem !important;
    }
    
    .d-flex.flex-wrap.gap-2 .btn-sm {
        padding: 4px 8px;
        font-size: 0.8rem;
    }
}

@media (max-width: 576px) {
    .tab-content {
        padding: 1rem !important;
    }
    
    .card-header {
        padding: 1rem;
    }
    
    .modal-body {
        padding: 1.5rem;
    }
}

/* ============================================
   ANIMACIONES
   ============================================ */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.fade-in {
    animation: fadeIn 0.5s ease-out;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.spin {
    animation: spin 1s linear infinite;
}

/* ============================================
   ESTILOS PARA FILTROS HORIZONTALES
   ============================================ */
.d-flex.flex-wrap.gap-2 {
    gap: 0.5rem !important;
}

/* ============================================
   BADGES
   ============================================ */
.badge {
    font-weight: 500;
    padding: 5px 10px;
    border-radius: 20px;
}

/* ============================================
   ESTILOS PARA HOLDING ITEMS
   ============================================ */
.holding-item {
    transition: var(--transition);
}

.holding-item:hover {
    transform: translateX(5px);
    background-color: rgba(13, 110, 253, 0.05);
}

/* ============================================
   SCROLLBAR PERSONALIZADO
   ============================================ */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* ============================================
   ESTILOS PARA CRIPTOMONEDAS
   ============================================ */
.bi-currency-bitcoin {
    color: #f7931a;
}
