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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    color: #333;
    line-height: 1.6;
    min-height: 100vh;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
}

.header {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.1);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    transition: transform 0.3s ease-in-out;
}

.header.header-hidden {
    transform: translateY(-100%);
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 20px;
    gap: 1.5rem;
}

.header-brand h1 {
    color: #2a5298;
    font-size: 1.8rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
}

.header-brand h1 i {
    color: #27ae60;
}

.header-brand {
    flex: 1;
}

.auth-section {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.header-action-btn {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    background: rgba(42, 82, 152, 0.08);
    border: 1px solid rgba(42, 82, 152, 0.15);
    color: #2a5298;
    padding: 0.55rem 0.95rem;
    border-radius: 999px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    flex-shrink: 0;
}

.header-action-btn i {
    font-size: 0.95rem;
}

.header-action-btn:hover {
    background: linear-gradient(135deg, #2a5298, #1e3c72);
    color: white;
    border-color: transparent;
    box-shadow: 0 10px 24px rgba(42, 82, 152, 0.25);
}

.auth-form {
    display: flex;
    gap: 10px;
    align-items: center;
}

.auth-form input {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.auth-form button {
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.3s;
}

#loginBtn {
    background: #2a5298;
    color: white;
}

#loginBtn:hover {
    background: #1e3c72;
}

#registerBtn {
    background: #27ae60;
    color: white;
}

#registerBtn:hover {
    background: #229954;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

#logoutBtn {
    padding: 8px 16px;
    background: #e74c3c;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
}

#logoutBtn:hover {
    background: #c0392b;
}

.main {
    padding: 2rem 0;
    min-height: calc(100vh - 140px);
    margin-top: 120px; /* Account for fixed header */
}

.dashboard {
    display: grid;
    grid-template-columns: 360px minmax(0, 1fr);
    gap: 2.5rem;
    margin-bottom: 3rem;
}

.filters-section {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    padding: 2rem;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    min-height: 800px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.results-section {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    padding: 2rem;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    min-height: 820px;
    display: flex;
    flex-direction: column;
}

.results-tabs {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
}

.results-tab {
    border: 1px solid rgba(42, 82, 152, 0.2);
    background: rgba(42, 82, 152, 0.05);
    color: #2a5298;
    padding: 0.6rem 1.1rem;
    border-radius: 999px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s ease;
}

.results-tab i {
    font-size: 0.9rem;
}

.results-tab.active {
    background: linear-gradient(135deg, #00b09b, #96c93d);
    color: white;
    border-color: transparent;
    box-shadow: 0 8px 24px rgba(0, 176, 155, 0.25);
}

.results-content {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}

.results-pane {
    display: none;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    gap: 1rem;
}

.results-pane.active {
    display: flex;
}

/* History Modal Tabs */
.history-tabs {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
}

.history-tab {
    border: 1px solid rgba(42, 82, 152, 0.2);
    background: rgba(42, 82, 152, 0.05);
    color: #2a5298;
    padding: 0.6rem 1.1rem;
    border-radius: 999px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s ease;
}

.history-tab i {
    font-size: 0.9rem;
}

.history-tab.active {
    background: linear-gradient(135deg, #00b09b, #96c93d);
    color: white;
    border-color: transparent;
    box-shadow: 0 8px 24px rgba(0, 176, 155, 0.25);
}

.history-pane {
    display: none;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}

.history-pane.active {
    display: flex;
}

.results-container.compact {
    max-height: none;
    padding: 0.75rem;
}

.filters-section h2, .results-section h2 {
    margin-bottom: 1.5rem;
    color: #2a5298;
    font-size: 1.4rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.filter-group {
    margin-bottom: 1.5rem;
}

.filter-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: #555;
}

.filter-group input[type="range"] {
    width: 100%;
    margin-bottom: 0.5rem;
}

.filter-group span {
    font-weight: 700;
    color: #27ae60;
    background: rgba(39, 174, 96, 0.1);
    padding: 2px 8px;
    border-radius: 4px;
}

.universes-container {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
}

.universe-item {
    display: flex;
    align-items: center;
    padding: 8px;
    background: rgba(42, 82, 152, 0.05);
    border-radius: 6px;
    border: 1px solid rgba(42, 82, 152, 0.1);
}

.universe-item input[type="checkbox"] {
    margin-right: 10px;
}

.universe-item label {
    font-size: 14px;
    cursor: pointer;
    margin: 0;
}

.universe-description {
    font-size: 12px;
    color: #777;
    margin-left: auto;
}

#presetSelect {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    background: white;
    font-size: 14px;
}

.filter-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 2rem;
}

.primary-btn, .secondary-btn {
    padding: 12px 20px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.primary-btn {
    background: linear-gradient(135deg, #27ae60, #2ecc71);
    color: white;
}

.primary-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(39, 174, 96, 0.3);
}

.secondary-btn {
    background: linear-gradient(135deg, #95a5a6, #bdc3c7);
    color: white;
}

.secondary-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(149, 165, 166, 0.3);
}

.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.results-meta {
    font-size: 14px;
    color: #666;
}

.loading {
    text-align: center;
    padding: 2rem;
    color: #2a5298;
    font-size: 16px;
}

.loading i {
    font-size: 24px;
    margin-right: 10px;
}

.error-message {
    background: #fee;
    color: #c0392b;
    padding: 1rem;
    border-radius: 6px;
    border: 1px solid #f8d7da;
    margin-bottom: 1rem;
}


.results-header {
    flex-shrink: 0;
}

.results-container {
    overflow-y: auto;
    border: 1px solid rgba(42, 82, 152, 0.1);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.5);
    padding: 1rem;
    margin-bottom: 1rem;
}

.results-container::-webkit-scrollbar {
    width: 8px;
}

.results-container::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.results-container::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

.results-container::-webkit-scrollbar-thumb:hover {
    background: #555;
}

.load-more-container {
    text-align: center;
    flex-shrink: 0;
    padding-top: 1rem;
}

.results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1rem;
}

.universe-summary {
    display: grid;
    gap: 0.6rem;
    margin-bottom: 1rem;
}

.universe-summary-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    background: rgba(42, 82, 152, 0.05);
    border: 1px solid rgba(42, 82, 152, 0.08);
    border-radius: 8px;
}

.universe-summary-name {
    font-weight: 600;
    color: #2a5298;
}

.universe-summary-meta {
    font-size: 0.85rem;
    color: #5f6f81;
}

@media (max-width: 1200px) {
    .dashboard {
        grid-template-columns: 1fr;
    }

    .filters-section,
    .results-section {
        min-height: auto;
        height: auto;
        max-height: none;
    }

    .filters-section {
        margin-bottom: 1.5rem;
    }

    .header-content {
        flex-wrap: wrap;
        justify-content: center;
    }

    .header-actions {
        order: 3;
        flex-wrap: wrap;
        justify-content: center;
        width: 100%;
    }
}

.no-results {
    text-align: center;
    padding: 3rem;
    color: #999;
}

.no-results i {
    font-size: 48px;
    margin-bottom: 1rem;
    color: #ddd;
}

.stock-card {
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1rem;
    border: 1px solid #dee2e6;
    transition: all 0.3s ease;
}

.stock-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

.stock-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.stock-symbol {
    font-size: 1.4rem;
    font-weight: 700;
    color: #2a5298;
}

.stock-price {
    font-size: 1.2rem;
    font-weight: 600;
    color: #27ae60;
}

.stock-metrics {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

.metric {
    text-align: center;
    padding: 8px;
    background: rgba(255, 255, 255, 0.7);
    border-radius: 6px;
}

.metric-label {
    font-size: 12px;
    color: #666;
    margin-bottom: 2px;
}

.metric-value {
    font-size: 14px;
    font-weight: 600;
    color: #333;
}

.score-positive { color: #27ae60; }
.score-negative { color: #e74c3c; }
.score-neutral { color: #f39c12; }

.signals {
    margin-top: 1rem;
}

.signals-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.bullish-signals, .bearish-signals {
    padding: 10px;
    border-radius: 6px;
    font-size: 12px;
}

.bullish-signals {
    background: rgba(39, 174, 96, 0.1);
    border: 1px solid rgba(39, 174, 96, 0.2);
}

.bearish-signals {
    background: rgba(231, 76, 60, 0.1);
    border: 1px solid rgba(231, 76, 60, 0.2);
}

.signals h4 {
    margin-bottom: 5px;
    font-size: 13px;
}

.signals ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.signals li {
    margin-bottom: 2px;
    padding-left: 10px;
    position: relative;
}

.bullish-signals li:before {
    content: "▲";
    position: absolute;
    left: 0;
    color: #27ae60;
}

.bearish-signals li:before {
    content: "▼";
    position: absolute;
    left: 0;
    color: #e74c3c;
}

.individual-analysis, .sms-alerts-section {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    padding: 2rem;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    margin-bottom: 2rem;
}

.individual-analysis h2 {
    margin-bottom: 1.5rem;
    color: #2a5298;
    font-size: 1.4rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.analysis-input {
    display: flex;
    gap: 10px;
    margin-bottom: 1.5rem;
}

.analysis-input input {
    flex: 1;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 16px;
    text-transform: uppercase;
}

.analysis-input button {
    padding: 12px 20px;
    background: linear-gradient(135deg, #2a5298, #1e3c72);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.analysis-input button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(42, 82, 152, 0.3);
}

.analysis-result {
    min-height: 50px;
}

.footer {
    background: rgba(0, 0, 0, 0.8);
    color: #ecf0f1;
    text-align: center;
    padding: 1.5rem 0;
    margin-top: 2rem;
}

.footer p {
    margin-bottom: 0.5rem;
}

@media (max-width: 768px) {
    .dashboard {
        grid-template-columns: 1fr;
    }

    .header-content {
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
    }

    .header-actions {
        width: 100%;
        flex-direction: column;
        align-items: stretch;
        gap: 0.5rem;
    }

    .header-action-btn {
        width: 100%;
        justify-content: center;
    }

    .auth-section {
        width: 100%;
        margin-top: 0.5rem;
    }

    .auth-form {
        flex-direction: column;
        gap: 0.5rem;
        width: 100%;
    }

    .auth-form input {
        width: 100%;
        box-sizing: border-box;
        font-size: 16px; /* Prevents zoom on iOS */
    }

    .auth-form button {
        width: 100%;
        box-sizing: border-box;
        padding: 12px 16px;
        font-size: 16px;
    }

    .results-section,
    .filters-section {
        padding: 1.5rem;
    }

    .results-tabs {
        flex-direction: column;
        gap: 0.5rem;
    }

    .results-tab {
        width: 100%;
        justify-content: center;
    }

    .filter-actions {
        grid-template-columns: 1fr;
    }

    .stock-metrics {
        grid-template-columns: repeat(2, 1fr);
    }

    .signals-row {
        grid-template-columns: 1fr;
    }

    .analysis-input {
        flex-direction: column;
    }

    .results-container {
        padding: 0.75rem;
    }

    .results-grid {
        grid-template-columns: 1fr;
    }

    .sms-controls {
        grid-template-columns: 1fr;
    }

    .main {
        margin-top: 200px; /* Larger margin for mobile due to stacked header */
    }
}

/* Extra Small Mobile Devices */
@media (max-width: 480px) {
    .header-content {
        padding: 0.75rem 15px;
        gap: 0.75rem;
    }

    .main {
        margin-top: 180px; /* Adjusted for smaller header on small screens */
    }

    .auth-form input {
        padding: 10px 12px;
        font-size: 16px; /* Prevent zoom on iOS */
    }

    .auth-form button {
        padding: 10px 12px;
        font-size: 15px;
    }

    .header-brand h1 {
        font-size: 1.25rem;
    }

    .container {
        padding: 0 10px;
    }
}

/* SMS Alerts Styles */
.sms-alerts-section h2 {
    margin-bottom: 1.5rem;
    color: #2a5298;
    font-size: 1.4rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.sms-controls {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
}

.contacts-management h3, .sms-actions h3 {
    margin-bottom: 1rem;
    color: #555;
    font-size: 1.1rem;
}

.contacts-list {
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid #ddd;
    border-radius: 6px;
    margin-bottom: 1rem;
    background: white;
}

.contact-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    border-bottom: 1px solid #eee;
}

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

.contact-info {
    flex: 1;
}

.contact-name {
    font-weight: 600;
    color: #333;
}

.contact-phone {
    font-size: 12px;
    color: #666;
}

.contact-actions {
    display: flex;
    gap: 5px;
}

.contact-actions button {
    padding: 4px 8px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
}

.edit-contact-btn {
    background: #3498db;
    color: white;
}

.delete-contact-btn {
    background: #e74c3c;
    color: white;
}

.contact-form {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-top: 1rem;
}

.contact-form input {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.contact-form button {
    grid-column: span 2;
    padding: 10px;
    margin-top: 8px;
}

.alert-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 1rem;
}

.sms-status {
    padding: 10px;
    border-radius: 6px;
    font-size: 14px;
    min-height: 40px;
    display: flex;
    align-items: center;
}

.sms-status.success {
    background: rgba(39, 174, 96, 0.1);
    border: 1px solid rgba(39, 174, 96, 0.2);
    color: #27ae60;
}

.sms-status.error {
    background: rgba(231, 76, 60, 0.1);
    border: 1px solid rgba(231, 76, 60, 0.2);
    color: #e74c3c;
}

.sms-status.info {
    background: rgba(52, 152, 219, 0.1);
    border: 1px solid rgba(52, 152, 219, 0.2);
    color: #3498db;
}

.contact-checkbox {
    margin-right: 8px;
}

/* Timeframe Styles */
.timeframe-metric {
    grid-column: span 2;
}

.timeframe-details {
    margin: 1rem 0;
    padding: 10px;
    background: rgba(42, 82, 152, 0.05);
    border-radius: 6px;
    border-left: 3px solid #2a5298;
}

.timeframe-header {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 8px;
    flex-wrap: wrap;
}

.timeframe-type {
    background: #2a5298;
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}

.timeframe-confidence {
    background: rgba(39, 174, 96, 0.1);
    color: #27ae60;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
}

.timeframe-confidence:contains("low") {
    background: rgba(231, 76, 60, 0.1);
    color: #e74c3c;
}

.timeframe-review {
    background: rgba(52, 152, 219, 0.1);
    color: #3498db;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
}

.timeframe-reasoning {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
}

.reason-tag {
    background: rgba(149, 165, 166, 0.1);
    color: #555;
    padding: 2px 6px;
    border-radius: 10px;
    font-size: 10px;
    border: 1px solid rgba(149, 165, 166, 0.2);
}

/* Collapsible Sections */
.collapsible-section {
    margin-bottom: 2rem;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    transition: all 0.3s ease;
    user-select: none;
}

.section-header:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
    background: rgba(255, 255, 255, 0.98);
}

.section-header h2 {
    margin: 0;
    color: #2a5298;
    font-size: 1.4rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.toggle-icon {
    font-size: 1.2rem;
    color: #2a5298;
    transition: transform 0.3s ease;
}

.toggle-icon.expanded {
    transform: rotate(180deg);
}

.section-content {
    overflow: hidden;
    transition: max-height 0.3s ease-out, padding 0.3s ease-out;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 0 0 12px 12px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-top: none;
    margin-top: -1px;
}

.section-content.collapsed {
    max-height: 0;
    padding: 0 2rem;
}

.section-content.expanded {
    max-height: 800px;
    padding: 2rem;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

.modal-content {
    background: linear-gradient(135deg, #ffffff, #f8f9fa);
    margin: 5% auto;
    padding: 0;
    border-radius: 12px;
    width: 90%;
    max-width: 600px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.1);
    animation: modalSlideIn 0.3s ease-out;
    max-height: 80vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.modal-content.wide-modal {
    max-width: 1000px;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    padding: 20px 25px;
    background: linear-gradient(135deg, #2a5298, #1e3c72);
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: 12px 12px 0 0;
}

.modal-header h3 {
    margin: 0;
    font-size: 1.3rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.close {
    color: white;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.3s ease;
}

.close:hover {
    color: #e0e0e0;
}

.modal-body {
    padding: 25px;
    overflow-y: auto;
    flex: 1;
}

/* Historical Picks Styles */
.historical-picks {
    max-height: 60vh;
    overflow-y: auto;
}

.historical-pick-item {
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1rem;
    border: 1px solid #dee2e6;
    transition: transform 0.2s ease;
}

.historical-pick-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.pick-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.pick-date {
    font-weight: 600;
    color: #2a5298;
    font-size: 1.1rem;
}

.pick-performance {
    font-weight: 700;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.9rem;
}

.performance-positive {
    background: rgba(39, 174, 96, 0.1);
    color: #27ae60;
    border: 1px solid rgba(39, 174, 96, 0.2);
}

.performance-negative {
    background: rgba(231, 76, 60, 0.1);
    color: #e74c3c;
    border: 1px solid rgba(231, 76, 60, 0.2);
}

.performance-neutral {
    background: rgba(149, 165, 166, 0.1);
    color: #95a5a6;
    border: 1px solid rgba(149, 165, 166, 0.2);
}

.pick-details {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

.pick-metric {
    text-align: center;
    padding: 8px;
    background: rgba(255, 255, 255, 0.7);
    border-radius: 6px;
}

.pick-metric-label {
    font-size: 12px;
    color: #666;
    margin-bottom: 2px;
}

.pick-metric-value {
    font-size: 14px;
    font-weight: 600;
    color: #333;
}

.pick-notes {
    font-size: 0.9rem;
    color: #666;
    font-style: italic;
    background: rgba(42, 82, 152, 0.05);
    padding: 10px;
    border-radius: 6px;
    border-left: 3px solid #2a5298;
}

/* Historical Date Header */
.historical-date-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid #e5e7eb;
}

.historical-date {
    margin: 0;
    color: #1e40af;
    font-size: 1.25rem;
    font-weight: 600;
}

.picks-count {
    background: #dbeafe;
    color: #1e40af;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.875rem;
    font-weight: 500;
}

/* Historical Pick Card Improvements */
.historical-pick-card {
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 12px;
    background: #ffffff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    transition: box-shadow 0.2s ease;
}

.historical-pick-card:hover {
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.pick-prices {
    margin: 10px 0;
}

.price-row {
    display: grid;
    grid-template-columns: auto 1fr auto 1fr;
    gap: 8px;
    margin-bottom: 5px;
    align-items: center;
}

.price-label {
    font-size: 0.75rem;
    color: #6b7280;
    font-weight: 500;
}

.price-value {
    font-size: 0.875rem;
    font-weight: 600;
    color: #1f2937;
}

.price-value.positive {
    color: #059669;
}

.price-value.negative {
    color: #dc2626;
}

.pick-score.score-high {
    background: #d1fae5;
    color: #065f46;
}

.pick-score.score-medium {
    background: #fef3c7;
    color: #92400e;
}

.pick-score.score-low {
    background: #fee2e2;
    color: #991b1b;
}

.pick-signals {
    margin-top: 8px;
}

.signal-tag.bullish {
    font-size: 0.75rem;
    padding: 2px 6px;
    margin-right: 4px;
    margin-bottom: 3px;
    display: inline-block;
    background: #ecfdf5;
    color: #065f46;
    border-radius: 4px;
    border: 1px solid #a7f3d0;
}

/* Sequential Scan History Cards */
.sequential-scans-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

.sequential-scan-card {
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 16px;
    background: #ffffff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    transition: box-shadow 0.2s ease;
}

.sequential-scan-card:hover {
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.scan-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.scan-time {
    font-weight: 600;
    color: #2a5298;
    font-size: 0.9rem;
}

.scan-status {
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: capitalize;
}

.scan-status.completed {
    background: #ecfdf5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}

.scan-status.error {
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.scan-metrics {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-bottom: 12px;
}

.scan-metric {
    text-align: center;
    padding: 8px;
    background: #f8fafc;
    border-radius: 6px;
}

.scan-metric .metric-label {
    font-size: 0.75rem;
    color: #6b7280;
    margin-bottom: 2px;
}

.scan-metric .metric-value {
    font-weight: 600;
    color: #2a5298;
    font-size: 0.9rem;
}

.scan-universes {
    margin-bottom: 12px;
    padding: 8px;
    background: #f1f5f9;
    border-radius: 6px;
}

.universes-label {
    font-size: 0.75rem;
    color: #6b7280;
    margin-bottom: 4px;
    font-weight: 500;
}

.universes-list {
    font-size: 0.85rem;
    color: #2a5298;
    font-weight: 500;
}

.scan-top-results {
    padding: 8px;
    background: #fef7ff;
    border-radius: 6px;
    border: 1px solid #e879f9;
}

.top-results-header {
    font-size: 0.75rem;
    color: #6b7280;
    margin-bottom: 6px;
    font-weight: 500;
}

.top-results-symbols {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.result-symbol {
    font-size: 0.75rem;
    padding: 2px 6px;
    background: #e879f9;
    color: white;
    border-radius: 4px;
    font-weight: 500;
}

.more-results {
    font-size: 0.75rem;
    padding: 2px 6px;
    background: #d1d5db;
    color: #6b7280;
    border-radius: 4px;
    font-weight: 500;
}

/* Sequential Scan Detailed Results */
.scan-detailed-results {
    margin-top: 16px;
    padding: 12px;
    background: #f8fafc;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}

.detailed-results-header {
    font-size: 0.85rem;
    color: #2a5298;
    margin-bottom: 12px;
    font-weight: 600;
}

.historical-picks-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 12px;
}

.no-scan-results {
    text-align: center;
    padding: 20px;
    color: #6b7280;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    margin-top: 16px;
}

.no-scan-results i {
    font-size: 1.5em;
    margin-bottom: 8px;
    opacity: 0.5;
}

.no-scan-results p {
    margin: 0;
    font-size: 0.9rem;
}

.sequential-historical-pick-card {
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 14px;
    background: #ffffff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    transition: box-shadow 0.2s ease;
}

.sequential-historical-pick-card:hover {
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.pick-scan-date {
    font-size: 0.75rem;
    color: #6b7280;
    margin-bottom: 10px;
    font-style: italic;
}

.more-results-card {
    border: 2px dashed #d1d5db;
    border-radius: 8px;
    padding: 20px;
    background: #f9fafb;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 120px;
}

.more-results-text {
    color: #6b7280;
    font-size: 0.9rem;
    font-weight: 500;
    text-align: center;
}

.more-results-text i {
    font-size: 1.2rem;
    margin-right: 8px;
    color: #9ca3af;
}

/* Diagnostics Panels */
.diagnostics-panel, .error-panel {
    margin-top: 20px;
    padding: 15px;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
    background: #f9fafb;
}

.diagnostics-panel h4, .error-panel h4 {
    margin: 0 0 15px 0;
    color: #374151;
    font-size: 1rem;
    font-weight: 600;
}

.filter-breakdown {
    margin-bottom: 15px;
}

.breakdown-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid #e5e7eb;
}

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

.breakdown-label {
    font-size: 0.875rem;
    color: #6b7280;
}

.breakdown-value {
    font-weight: 600;
    color: #1f2937;
    background: #ffffff;
    padding: 4px 8px;
    border-radius: 4px;
    border: 1px solid #d1d5db;
}

.most-restrictive {
    padding: 10px;
    background: #fef3c7;
    border: 1px solid #f59e0b;
    border-radius: 6px;
    color: #92400e;
    font-size: 0.875rem;
}

.error-panel {
    background: #fef2f2;
    border-color: #fca5a5;
}

.error-summary p {
    margin: 0 0 10px 0;
    font-size: 0.875rem;
    color: #991b1b;
    font-weight: 500;
}

.error-item {
    font-size: 0.75rem;
    color: #7f1d1d;
    padding: 4px 0;
    border-left: 3px solid #fca5a5;
    padding-left: 8px;
    margin-bottom: 4px;
}

.error-more {
    font-size: 0.75rem;
    color: #991b1b;
    font-style: italic;
    margin-top: 8px;
}

.error-text {
    color: #dc2626;
    font-weight: 500;
    margin: 10px 0;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .modal-content {
        width: 95%;
        margin: 10% auto;
        max-height: 75vh;
    }

    .modal-body {
        padding: 15px;
    }

    .pick-details {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Universe Scanning Progress Styles */
.scan-progress-section {
    background: rgba(255, 255, 255, 0.98);
    border-radius: 15px;
    padding: 25px;
    margin: 0 0 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.scan-progress-section h3 {
    color: #2a5298;
    margin-bottom: 20px;
    font-size: 1.3rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.scan-status-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding: 15px;
    background: rgba(42, 82, 152, 0.05);
    border-radius: 10px;
    border-left: 4px solid #2a5298;
}

.scan-info {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.status-message {
    font-size: 1.1rem;
    font-weight: 600;
    color: #2a5298;
}

.status-message.success {
    color: #27ae60;
}

.status-message.error {
    color: #e74c3c;
}

.status-message.warning {
    color: #f39c12;
}

.eta-message {
    font-size: 0.9rem;
    color: #666;
    font-style: italic;
}

.overall-progress {
    margin-bottom: 25px;
}

.progress-bar-container {
    display: flex;
    align-items: center;
    gap: 15px;
}

.progress-bar {
    flex: 1;
    height: 12px;
    background: rgba(42, 82, 152, 0.1);
    border-radius: 6px;
    overflow: hidden;
    position: relative;
}

.progress-bar.small {
    height: 8px;
    border-radius: 4px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #27ae60, #2ecc71);
    border-radius: inherit;
    transition: width 0.3s ease;
    position: relative;
    width: 0;
}

.progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    animation: shimmer 2s infinite;
}

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

.progress-text {
    font-size: 0.9rem;
    font-weight: 600;
    color: #2a5298;
    min-width: 50px;
    text-align: right;
}

.universe-progress-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 25px;
}

.universe-card {
    background: rgba(255, 255, 255, 0.8);
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.universe-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

.universe-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
    padding-left: 15px;
}

.universe-header i {
    font-size: 1.2rem;
    color: #2a5298;
}

.universe-name {
    font-weight: 600;
    color: #333;
    flex: 1;
}

.universe-status {
    font-size: 0.85rem;
    padding: 4px 8px;
    border-radius: 12px;
    background: rgba(42, 82, 152, 0.1);
    color: #2a5298;
    font-weight: 500;
}

.universe-progress {
    margin-bottom: 15px;
}

.universe-stats {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    color: #666;
}

.scan-results-preview {
    border-top: 2px solid rgba(42, 82, 152, 0.1);
    padding-top: 25px;
}

.scan-results-preview h3 {
    color: #2a5298;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.top-results-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.result-card.mini {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 15px;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s ease;
}

.result-card.mini:hover {
    transform: translateY(-2px);
}

.result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.rank {
    font-size: 0.8rem;
    opacity: 0.8;
}

.symbol {
    font-weight: 700;
    font-size: 1.1rem;
}

.score {
    font-size: 0.9rem;
    font-weight: 600;
}

.result-details {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
    gap: 8px;
}

.upside {
    color: #2ecc71;
    font-weight: 600;
}

.risk-reward {
    font-weight: 600;
    opacity: 0.85;
}

.universe {
    opacity: 0.8;
    font-size: 0.75rem;
}

.danger-btn {
    background: linear-gradient(135deg, #e74c3c, #c0392b);
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.danger-btn:hover {
    background: linear-gradient(135deg, #c0392b, #a93226);
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(231, 76, 60, 0.3);
}

.danger-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Responsive adjustments for progress tracking */
@media (max-width: 768px) {
    .scan-status-header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }

    .universe-progress-grid {
        grid-template-columns: 1fr;
    }

    .top-results-container {
        grid-template-columns: 1fr;
    }

    .progress-bar-container {
        flex-direction: column;
        gap: 10px;
    }

    .progress-text {
        text-align: center;
    }
}

/* Enhanced Universe Selection Styles */
.universe-item {
    display: flex;
    align-items: center;
    padding: 10px;
    margin: 5px 0;
    background: rgba(255, 255, 255, 0.7);
    border-radius: 8px;
    border: 1px solid rgba(42, 82, 152, 0.1);
    transition: all 0.2s ease;
}

.universe-item:hover {
    background: rgba(255, 255, 255, 0.9);
    border-color: rgba(42, 82, 152, 0.3);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.universe-item input[type="checkbox"] {
    margin-right: 12px;
    width: 18px;
    height: 18px;
    accent-color: #2a5298;
    cursor: pointer;
}

.universe-item label {
    cursor: pointer;
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.95rem;
}

.universe-name {
    font-weight: 600;
    color: #333;
}

.universe-count {
    font-size: 0.85rem;
    color: #666;
    font-weight: 400;
    margin-left: 8px;
}

.universe-item:has(input:checked) {
    background: rgba(42, 82, 152, 0.05);
    border-color: rgba(42, 82, 152, 0.2);
}

.universe-item:has(input:checked) .universe-name {
    color: #2a5298;
}

.universe-item:has(input:checked) .universe-count {
    color: #2a5298;
    opacity: 0.8;
}
