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

:root {
    --bg-primary: #f8fafc;
    --bg-secondary: white;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --card-shadow: rgba(0, 0, 0, 0.1);
    --accent: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --border-color: #e5e7eb;
    --header-bg: rgba(0, 0, 0, 0.1);
    --footer-bg: rgba(0, 0, 0, 0.2);
    --footer-text: rgba(255, 255, 255, 0.9);
}

:root.dark {
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --card-shadow: rgba(0, 0, 0, 0.3);
    --accent: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --border-color: #334155;
    --header-bg: rgba(0, 0, 0, 0.3);
    --footer-bg: rgba(0, 0, 0, 0.4);
    --footer-text: rgba(255, 255, 255, 0.8);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, Helvetica, sans-serif;
    line-height: 1.6;
    color: var(--text-primary);
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    transition: background-color 0.3s ease, color 0.3s ease;
}

header {
    text-align: center;
    padding: 2rem;
    color: white;
    background: var(--header-bg);
    transition: background 0.3s ease;
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    font-weight: 600;
}

header p {
    font-size: 1.1rem;
    opacity: 0.9;
}

.Control {
    padding: 2rem;
    background: var(--bg-secondary);
    margin: 1rem;
    border-radius: 18px;
    box-shadow: 0 10px 30px var(--card-shadow);
    transition: background 0.3s ease, box-shadow 0.3s ease;
}

.control-actions {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
    flex-wrap: wrap;
}

.compare-button,
.clear-cache-button {
    padding: 0.75rem 1.25rem;
    font-size: 0.9rem;
}

#themeToggle {
    padding: 1rem;
    min-width: 50px;
    font-size: 1.25rem;
}

.stockGroup {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

#searchStock {
    flex: 1;
    min-width: 300px;
    padding: 1rem 1.5rem;
    border: 2px solid var(--border-color);
    border-radius: 18px;
    font-size: 1rem;
    transition: all 0.3s ease-in;
    background: var(--bg-secondary);
    color: var(--text-primary);
}

#searchStock:focus {
    outline: none;
    border-color: #02125a;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

button {
    padding: 1rem 1.5rem;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: 18px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}



button:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(102, 126, 234, 0.4);
}

button:active {
    transform: translateY(0);
}



.filterByCategories {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.filterButtonAll,
.filterButtonTech,
.filterButtonFinance,
.filterButtonMotor,
.filterButtonSpace,
.filterButtonEnergy,
.filterButtonWatchlist {
    background: #f3f4f6;
    color: #374151;
    padding: 0.75rem 1.25rem;
    font-size: 0.9rem;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    transition: all 0.2s ease;
}

.filterButtonAll.active,
.filterButtonTech.active,
.filterButtonFinance.active,
.filterButtonMotor.active,
.filterButtonSpace.active,
.filterButtonEnergy.active,
.filterButtonWatchlist.active,
.filterButtonAll:hover,
.filterButtonTech:hover,
.filterButtonFinance:hover,
.filterButtonMotor:hover,
.filterButtonSpace:hover,
.filterButtonEnergy:hover,
.filterButtonWatchlist:hover {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-color: transparent;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.loading {
    text-align: center;
    padding: 2.5rem;
    color: #666;
}

.loader {
    width: 50px;
    height: 50px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

.gridStock {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 2rem;
    padding: 2rem;
    max-width: 1400px;
    margin: 0 auto;
}

.stock-card {
    background: var(--bg-secondary);
    text-align: start;
    padding: 1.5rem;
    border-radius: 18px;
    overflow: hidden;
    box-shadow: 0 10px 30px var(--card-shadow);
    transition: all 0.3s ease;
    transform: translateY(20px);
    cursor: pointer;
    animation: slideInUp 0.6s ease-in-out;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    position: relative;
}

.compare-checkbox {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 20px;
    height: 20px;
    cursor: pointer;
    z-index: 10;
}

.cached-badge {
    position: absolute;
    top: 1rem;
    left: 1rem;
    background: rgba(102, 126, 234, 0.1);
    color: #667eea;
    font-size: 0.7rem;
    padding: 0.25rem 0.5rem;
    border-radius: 8px;
    font-weight: 600;
}

.stock-header {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    margin-bottom: 0.5rem;
}

.stock-ticker {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.stock-name {
    font-size: 0.9rem;
    font-weight: 400;
    color: var(--text-secondary);
    line-height: 1.3;
}

.stock-price {
    font-size: 2rem;
    font-weight: 700;
    margin: 0.5rem 0;
}

.stock-price.positive {
    color: #10b981;
}

.stock-price.negative {
    color: #ef4444;
}

.stock-change {
    font-size: 1rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.stock-change.positive {
    color: #10b981;
}

.stock-change.negative {
    color: #ef4444;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #eee;
}

.stat {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

.stat strong {
    display: block;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
    font-weight: 600;
}

.positive {
    color: #10b981;
    background-color: rgba(16, 185, 129, 0.05);
    border-left: 3px solid #10b981;
    padding-left: 0.75rem;
}

.negative {
    color: #ef4444;
    background-color: rgba(239, 68, 68, 0.05);
    border-left: 3px solid #ef4444;
    padding-left: 0.75rem;
}

.high-volatility {
    border: 2px solid #f59e0b;
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.1), 0 10px 30px rgba(0, 0, 0, 0.1);
}

.vol-badge {
    display: inline-block;
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: white;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    margin-top: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.vol-badge::before {
    content: '🔥 ';
}

.watchlist-button {
    margin-top: 1rem;
    padding: 0.75rem 1rem;
    background: #f3f4f6;
    color: #374151;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    width: 100%;
}

.watchlist-button:hover {
    background: #e5e7eb;
    transform: translateY(-1px);
}

.watchlist-button:active {
    transform: translateY(0);
}

.watchlist-button.in-watchlist {
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
    color: white;
    border-color: #f59e0b;
    cursor: default;
}

.watchlist-button.in-watchlist:hover {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    transform: none;
}

.stock-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
}

.card-content {
    padding: 1.5rem;
}

.card-content h3 {
    font-size: 1.25rem;
    margin-bottom: 0.75rem;
    line-height: 1.4;
    color: #2c3e50;
}

.card-content p {
    color: #666;
    margin-bottom: 1rem;
    line-height: 1.6;
}

.card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 1.1rem;
    border-top: 1px solid #eee;
    font-size: 1rem;
    color: #888;
}


.about-section {
    max-width: 1200px;
    margin: 3rem auto;
    padding: 2rem;
    background: var(--bg-secondary);
    border-radius: 18px;
    box-shadow: 0 10px 30px var(--card-shadow);
    color: var(--text-primary);
    transition: background 0.3s ease, box-shadow 0.3s ease;
}

.about-section h2 {
    font-size: 2rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.about-section ul {
    margin: 1.5rem 0;
    padding-left: 2rem;
    list-style-type: disc;
}

.about-section li {
    margin: 0.5rem 0;
    color: var(--text-secondary);
}

.about-section p {
    color: var(--text-secondary);
    line-height: 1.8;
}

footer {
    text-align: center;
    padding: 2rem;
    color: var(--footer-text);
    background: var(--footer-bg);
    transition: background 0.3s ease, color 0.3s ease;
}

footer a {
    color: white;
    text-decoration: none;
}

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

/* Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    backdrop-filter: blur(4px);
}

.modal {
    background: var(--bg-secondary);
    border-radius: 18px;
    padding: 2rem;
    max-width: 90%;
    width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    color: var(--text-primary);
    transition: background 0.3s ease;
}

.modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: transparent;
    border: none;
    font-size: 2rem;
    color: var(--text-secondary);
    cursor: pointer;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
    padding: 0;
}

.modal-close:hover {
    background: var(--border-color);
    color: var(--text-primary);
}

.chart-container {
    width: 100%;
    height: 200px;
    margin-top: 1rem;
}

.compare-modal {
    width: 90%;
    max-width: 1000px;
}

.compare-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-top: 1rem;
}

.compare-item {
    padding: 1.5rem;
    background: var(--bg-primary);
    border-radius: 12px;
    border: 1px solid var(--border-color);
}

.compare-item h3 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

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

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

    header h1 {
        font-size: 2rem;
    }

    .stockGroup {
        flex-direction: column;
    }

    #searchStock {
        min-width: auto;
    }

    .stock-card {
        padding: 1.25rem;
    }

    .stats-grid {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }
}