/**
 * StockPro AI - Custom Styles
 */

/* General Styles */
body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

main {
    flex-grow: 1;
}

/* Search Results Dropdown */
#searchResults {
    width: 100%;
    max-height: 300px;
    overflow-y: auto;
    z-index: 1000;
}

.search-result {
    cursor: pointer;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.search-result:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

/* Card Styles */
.card {
    transition: transform 0.2s, box-shadow 0.2s;
}

.card:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2) !important;
}

.card .feature-icon {
    transition: transform 0.3s;
}

.card:hover .feature-icon {
    transform: scale(1.1);
}

/* Recommendation Card Styles */
.recommendation-card {
    transition: all 0.3s ease;
    border-radius: 12px;
    overflow: hidden;
}

.recommendation-card:hover {
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.25) !important;
}

.score-badge {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    font-weight: bold;
    font-size: 1.25rem;
    margin-right: 15px;
    color: white;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.score-A {
    background: linear-gradient(135deg, #10b981, #065f46);
    border: 2px solid #10b981;
}

.score-B {
    background: linear-gradient(135deg, #3b82f6, #1e40af);
    border: 2px solid #3b82f6;
}

.score-C {
    background: linear-gradient(135deg, #f59e0b, #b45309);
    border: 2px solid #f59e0b;
}

.score-D {
    background: linear-gradient(135deg, #ef4444, #991b1b);
    border: 2px solid #ef4444;
}

/* Table Styles */
.table thead th {
    cursor: pointer;
}

.table thead th:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

/* Chart Containers */
[id$="Chart"] {
    width: 100%;
    height: 100%;
    min-height: 250px;
}

/* Button and Badge Styles */
.btn-primary {
    background-color: #0d6efd;
    border-color: #0d6efd;
}

.btn-primary:hover {
    background-color: #0b5ed7;
    border-color: #0a58ca;
}

.btn-outline-primary {
    color: #0d6efd;
    border-color: #0d6efd;
}

.btn-outline-primary:hover {
    background-color: #0d6efd;
    border-color: #0d6efd;
    color: #fff;
}

/* Purple Header for All Cards */
.card-header.bg-primary, 
.card-header, 
div.card-header {
    background-color: #6f42c1 !important;
    border-color: #6f42c1 !important;
}

.badge.bg-success {
    background-color: #198754 !important;
}

.badge.bg-danger {
    background-color: #dc3545 !important;
}

.badge.bg-warning {
    background-color: #ffc107 !important;
    color: #000;
}

.badge.bg-secondary {
    background-color: #6c757d !important;
}

/* AI Recommendation Styles */
.ai-rating-badge {
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    white-space: nowrap;
    display: inline-block;
}

.rating-strong-buy {
    background-color: #10b981;
    color: white;
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.5);
    animation: pulse-green 2s infinite;
}

.rating-buy {
    background-color: #10b981;
    color: white;
}

.rating-hold {
    background-color: #f59e0b;
    color: white;
}

.rating-sell {
    background-color: #ef4444;
    color: white;
}

@keyframes pulse-green {
    0% {
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
    }
    70% {
        box-shadow: 0 0 0 6px rgba(16, 185, 129, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
    }
}

.confidence-indicator {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: 5px;
}

.confidence-high {
    background-color: #10b981;
    box-shadow: 0 0 5px #10b981;
}

.confidence-medium {
    background-color: #f59e0b;
    box-shadow: 0 0 5px #f59e0b;
}

.confidence-low {
    background-color: #6b7280;
    box-shadow: 0 0 5px #6b7280;
}

.buy-signals-meter {
    height: 6px;
    background-color: rgba(220, 53, 69, 0.2);
    border-radius: 3px;
    overflow: hidden;
}

.buy-signals-fill {
    height: 100%;
    background: linear-gradient(90deg, rgba(16, 185, 129, 0.5) 0%, rgba(16, 185, 129, 1) 100%);
    border-radius: 3px;
}

.sell-signals-fill {
    height: 100%;
    background: linear-gradient(90deg, rgba(220, 53, 69, 0.5) 0%, rgba(220, 53, 69, 1) 100%);
    border-radius: 3px;
}

.reason-item {
    padding: 8px 12px;
    border-radius: 4px;
    margin-bottom: 6px;
    background-color: rgba(75, 85, 99, 0.1);
    border-left: 3px solid #6b7280;
}

.primary-reason {
    border-left: 3px solid #10b981;
    background-color: rgba(16, 185, 129, 0.1);
    font-weight: 500;
}

/* Portfolio Styles */
.gain-up {
    color: #198754;
}

.gain-down {
    color: #dc3545;
}

/* Form Styles */
.form-control, .form-select {
    background-color: var(--bs-dark);
    border-color: var(--bs-dark);
    color: #fff;
}

.form-control:focus, .form-select:focus {
    background-color: var(--bs-dark);
    border-color: #0d6efd;
    color: #fff;
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}

/* Stock Detail Page Styles */
.indicator-value {
    font-size: 1.1rem;
    font-weight: bold;
}

/* Stock Comparison Page Styles */
.comparison-header {
    position: sticky;
    top: 0;
    background-color: var(--bs-dark);
    z-index: 10;
}

/* Responsive Adjustments */
@media (max-width: 576px) {
    .display-4 {
        font-size: 2rem;
    }
    
    h1 {
        font-size: 1.8rem;
    }
    
    h2 {
        font-size: 1.5rem;
    }
    
    .lead {
        font-size: 1rem;
    }
}

/* Footer Styles */
footer a {
    text-decoration: none;
    transition: color 0.2s;
}

footer a:hover {
    text-decoration: underline;
}

/* Loading Spinner */
.loading-spinner {
    display: inline-block;
    width: 1.5rem;
    height: 1.5rem;
    border: 0.25rem solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
}

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

/* Animation for cards on homepage */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.card-animated {
    animation: fadeInUp 0.5s ease-out forwards;
}

/* Fix for Plotly charts in dark mode */
.js-plotly-plot .plotly .main-svg {
    background-color: transparent !important;
}

.js-plotly-plot .plotly .modebar {
    background-color: rgba(0,0,0,0.5) !important;
}
