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

:root {
    --primary-color: #2563eb;
    --primary-dark: #1e40af;
    --secondary-color: #64748b;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --background: #f8fafc;
    --surface: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.1);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--background);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.header {
    background-color: var(--surface);
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
}

.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 0;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--primary-color);
    text-decoration: none;
}

.logo-icon {
    font-size: 2rem;
}

.nav-links {
    display: flex;
    list-style: none;
    gap: 2rem;
}

.nav-link {
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s;
}

.nav-link:hover {
    color: var(--primary-color);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

main {
    flex: 1;
    padding: 2rem 0;
}

.hero {
    text-align: center;
    padding: 3rem 0;
}

.hero h1 {
    font-size: 3rem;
    color: var(--text-primary);
    margin-bottom: 1rem;
}

.hero-subtitle {
    font-size: 1.25rem;
    color: var(--text-secondary);
}

.page-header {
    text-align: center;
    margin-bottom: 3rem;
}

.page-header h1 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

.page-header p {
    color: var(--text-secondary);
    font-size: 1.125rem;
}

.search-section {
    max-width: 700px;
    margin: 0 auto 3rem;
}

.search-form {
    margin-bottom: 1rem;
}

.search-container {
    display: flex;
    gap: 1rem;
}

.search-input {
    flex: 1;
    padding: 1rem;
    font-size: 1rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    transition: border-color 0.3s;
}

.search-input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.search-hint {
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.btn {
    padding: 1rem 2rem;
    font-size: 1rem;
    font-weight: 600;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
    text-decoration: none;
    display: inline-block;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background-color: var(--primary-dark);
}

.btn-secondary {
    background-color: var(--secondary-color);
    color: white;
}

.btn-secondary:hover {
    background-color: #475569;
}

.btn-link {
    background: none;
    color: var(--primary-color);
    padding: 0.5rem 1rem;
}

.btn-link:hover {
    text-decoration: underline;
}

.alert {
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 2rem;
}

.alert-error {
    background-color: #fee;
    color: var(--danger-color);
    border: 1px solid var(--danger-color);
}

.stock-details {
    background: var(--surface);
    border-radius: 12px;
    padding: 2rem;
    box-shadow: var(--shadow-lg);
}

.company-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 2rem;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 2rem;
}

.company-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.company-logo {
    width: 80px;
    height: 80px;
    border-radius: 12px;
    object-fit: contain;
    background: var(--background);
    padding: 0.5rem;
}

.company-meta {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.price-card {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
    border-radius: 12px;
    padding: 2rem;
    margin-bottom: 2rem;
}

.price-main {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.price-label {
    font-size: 0.875rem;
    opacity: 0.9;
}

.price-value {
    font-size: 3rem;
    font-weight: bold;
}

.price-change {
    font-size: 1.25rem;
    font-weight: 600;
}

.price-details {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
}

.price-item {
    display: flex;
    flex-direction: column;
}

.price-item .label {
    font-size: 0.875rem;
    opacity: 0.8;
    margin-bottom: 0.25rem;
}

.price-item .value {
    font-size: 1.125rem;
    font-weight: 600;
}

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

.metric-card {
    background: var(--background);
    padding: 1.5rem;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.metric-card h3 {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.metric-value {
    font-size: 1.75rem;
    font-weight: bold;
    color: var(--text-primary);
}

.info-section {
    margin-bottom: 2rem;
    padding: 1.5rem;
    background: var(--background);
    border-radius: 8px;
}

.info-section h3 {
    margin-bottom: 1rem;
}

.company-details-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    margin-top: 1rem;
}

.detail-item {
    padding: 0.5rem 0;
}

.financial-metrics {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.metric-row {
    display: flex;
    justify-content: space-between;
    padding: 0.75rem;
    background: white;
    border-radius: 6px;
}

.metric-label {
    color: var(--text-secondary);
}

.metric-data {
    font-weight: 600;
}

.features {
    margin-top: 3rem;
}

.features h2 {
    text-align: center;
    margin-bottom: 2rem;
}

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

.feature-card {
    background: var(--surface);
    padding: 2rem;
    border-radius: 12px;
    text-align: center;
    box-shadow: var(--shadow);
    transition: transform 0.3s;
}

.feature-card:hover {
    transform: translateY(-5px);
}

.feature-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.feature-card h3 {
    margin-bottom: 0.5rem;
}

.feature-card p {
    color: var(--text-secondary);
}

.market-section {
    background: var(--surface);
    padding: 2rem;
    border-radius: 12px;
    margin-bottom: 2rem;
    box-shadow: var(--shadow);
}

.market-section h2 {
    margin-bottom: 1.5rem;
}

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

.sector-card {
    background: var(--background);
    padding: 1.5rem;
    border-radius: 8px;
    text-align: center;
    border: 1px solid var(--border-color);
}

.sector-card h3 {
    font-size: 1rem;
    margin-bottom: 0.5rem;
}

.sector-change {
    font-size: 1.5rem;
    font-weight: bold;
}

.tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    border-bottom: 2px solid var(--border-color);
}

.tab-button {
    padding: 1rem 2rem;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    border-bottom: 3px solid transparent;
}

.tab-button:hover {
    color: var(--primary-color);
}

.tab-button.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

.stocks-table {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th {
    text-align: left;
    padding: 1rem;
    background: var(--background);
    font-weight: 600;
    color: var(--text-secondary);
}

td {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
}

tr:hover {
    background: var(--background);
}

.positive {
    color: var(--success-color);
}

.negative {
    color: var(--danger-color);
}

.news-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 2rem;
}

.news-card {
    background: var(--surface);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: transform 0.3s;
}

.news-card:hover {
    transform: translateY(-5px);
}

.news-image img {
    width: 100%;
    height: 200px;
    object-fit: cover;
}

.news-content {
    padding: 1.5rem;
}

.news-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.news-symbol {
    background: var(--primary-color);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 4px;
    font-weight: 600;
}

.news-title {
    font-size: 1.125rem;
    margin-bottom: 0.75rem;
    line-height: 1.4;
}

.news-text {
    color: var(--text-secondary);
    margin-bottom: 1rem;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.news-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.news-site {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.compare-search {
    max-width: 900px;
    margin: 0 auto 3rem;
}

.compare-form {
    background: var(--surface);
    padding: 2rem;
    border-radius: 12px;
    box-shadow: var(--shadow);
}

.compare-inputs {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.input-group {
    flex: 1;
}

.input-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.vs-divider {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--primary-color);
    margin-top: 1.5rem;
}

.comparison-results {
    background: var(--surface);
    border-radius: 12px;
    padding: 2rem;
    box-shadow: var(--shadow-lg);
}

.comparison-header {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-bottom: 2rem;
    padding-bottom: 2rem;
    border-bottom: 2px solid var(--border-color);
}

.company-compare-card {
    text-align: center;
    padding: 1.5rem;
    background: var(--background);
    border-radius: 8px;
}

.company-compare-card .company-logo {
    width: 100px;
    height: 100px;
    margin-bottom: 1rem;
}

.company-symbol {
    color: var(--text-secondary);
    font-weight: 600;
}

.comparison-section {
    margin-bottom: 2rem;
}

.comparison-section h3 {
    text-align: center;
    margin-bottom: 1rem;
    color: var(--text-secondary);
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

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

.comparison-cell {
    text-align: center;
    padding: 1.5rem;
    background: var(--background);
    border-radius: 8px;
}

.comparison-value {
    font-size: 2rem;
    font-weight: bold;
    margin-bottom: 0.5rem;
}

.comparison-change {
    font-size: 1.125rem;
    font-weight: 600;
}

.comparison-label {
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.comparison-sublabel {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.info-item {
    margin-bottom: 0.75rem;
}

.comparison-placeholder {
    background: var(--surface);
    padding: 4rem 2rem;
    border-radius: 12px;
    text-align: center;
}

.placeholder-content {
    max-width: 600px;
    margin: 0 auto;
}

.placeholder-icon {
    font-size: 5rem;
    margin-bottom: 1rem;
}

.placeholder-examples {
    color: var(--text-secondary);
    margin-top: 1rem;
}

/* Footer */
.footer {
    background-color: var(--text-primary);
    color: white;
    margin-top: auto;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    padding: 3rem 0;
}

.footer-section h3,
.footer-section h4 {
    margin-bottom: 1rem;
}

.footer-section p {
    color: #cbd5e1;
    font-size: 0.875rem;
}

.footer-section ul {
    list-style: none;
}

.footer-section ul li {
    margin-bottom: 0.5rem;
}

.footer-section a {
    color: #cbd5e1;
    text-decoration: none;
    transition: color 0.3s;
}

.footer-section a:hover {
    color: white;
}

.footer-bottom {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding: 1.5rem 0;
    text-align: center;
    color: #cbd5e1;
    font-size: 0.875rem;
}

.no-data {
    text-align: center;
    padding: 3rem;
    color: var(--text-secondary);
}

@media (max-width: 768px) {
    .hero h1 {
        font-size: 2rem;
    }

    .search-container {
        flex-direction: column;
    }

    .nav-links {
        gap: 1rem;
    }

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

    .company-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .comparison-header,
    .comparison-row {
        grid-template-columns: 1fr;
    }

    .vs-divider {
        margin: 0;
    }

    .compare-inputs {
        flex-direction: column;
    }

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

    .company-details-grid {
        grid-template-columns: 1fr;
    }

    table {
        font-size: 0.875rem;
    }

    th, td {
        padding: 0.75rem 0.5rem;
    }
}