* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: Arial, sans-serif;
    background: #f4f6f8;
    color: #1f2937;
}

header {
    background: #111827;
    color: white;
    padding: 18px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

header h1 {
    margin: 0;
    font-size: 24px;
}

.status {
    font-size: 14px;
    color: #86efac;
}

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

.section-title {
    margin: 30px 0 15px;
    font-size: 20px;
}

.cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 18px;
}

.card {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.symbol {
    font-size: 15px;
    color: #6b7280;
}

.price {
    font-size: 28px;
    font-weight: bold;
    margin: 10px 0;
}

.change {
    font-size: 15px;
}

.positive {
    color: #16a34a;
}

.negative {
    color: #dc2626;
}

table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

th,
td {
    padding: 15px;
    text-align: left;
    border-bottom: 1px solid #e5e7eb;
}

th {
    background: #f9fafb;
}

.analysis {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.analysis-row {
    display: flex;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid #eee;
}

footer {
    text-align: center;
    padding: 30px;
    color: #6b7280;
    font-size: 13px;
}

.company-search {
    position: relative;
    margin-top: 30px;
    margin-bottom: 20px;
}

#company-search {
    width: 100%;
    padding: 14px 16px;
    font-size: 16px;
    border: 1px solid #d1d5db;
    border-radius: 10px;
    outline: none;
    background: white;
}

#company-search:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.10);
}

#company-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 1000;
    background: white;
    border: 1px solid #d1d5db;
    border-top: none;
    border-radius: 0 0 10px 10px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.12);
    overflow: hidden;
}

.company-result {
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding: 12px 16px;
    cursor: pointer;
    border-bottom: 1px solid #eee;
    background: white;
}

.company-result:last-child {
    border-bottom: none;
}

.company-result:hover {
    background: #f3f4f6;
}

.company-result strong {
    font-size: 15px;
    color: #111827;
}

.company-result span {
    font-size: 14px;
    color: #4b5563;
}

.company-result small {
    font-size: 12px;
    color: #6b7280;
}

#selected-company {
    margin-top: 10px;
    padding: 10px 14px;
    font-size: 14px;
    font-weight: bold;
    color: #374151;
}
.watchlist-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 30px 0 15px;
}

.watchlist-header .section-title {
    margin: 0;
}

#add-stock-button {
    border: none;
    border-radius: 8px;
    padding: 10px 16px;
    background: #2563eb;
    color: white;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
}

#add-stock-button:hover {
    background: #1d4ed8;
}

.remove-watchlist {
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 16px;
    padding: 4px 8px;
}

.stock-link {
    text-decoration: none;
    font-weight: 600;
}

.stock-link:hover {
    text-decoration: underline;
    cursor: pointer;
}


/* Stock price chart */

.stock-chart-section {
    width: calc(100% - 40px);
    max-width: 900px;
    margin: 24px auto;
    padding: 20px;
    box-sizing: border-box;
    background: #ffffff;
    border-radius: 12px;
    border: 1px solid #e5e7eb;
}

.stock-chart-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 16px;
}

.stock-chart-header h2 {
    margin: 0;
    font-size: 20px;
}

.chart-periods {
    display: flex;
    gap: 6px;
}

.chart-period {
    border: 1px solid #d1d5db;
    background: #ffffff;
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
}

.chart-period:hover {
    background: #f3f4f6;
}

.chart-period.active {
    font-weight: 600;
}

.stock-chart-container {
    position: relative;
    width: 100%;
    height: 360px;
}

#priceChart {
    display: block;
    width: 100%;
    height: 100%;
}

.chart-status {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    color: #6b7280;
    font-size: 14px;
}

@media (max-width: 600px) {

    .stock-chart-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .stock-chart-container {
        height: 280px;
    }
}



/* Unified stock detail card styling */
.stock-analysis-section,
.stock-chart-section {
    box-sizing: border-box;
    padding: 24px;
    background: var(--card-bg, #ffffff);
    border: 1px solid var(--border-color, #e2e8f0);
    border-radius: 16px;
    box-shadow: 0 5px 18px rgba(15, 23, 42, 0.06);
    min-width: 0;
}

.stock-analysis-section {
    width: 100%;
}

.stock-analysis-section .analysis {
    border-radius: 12px;
}

@media (max-width: 700px) {
    .stock-analysis-section,
    .stock-chart-section {
        padding: 15px;
        border-radius: 12px;
    }
}

/* Stock page analysis sections */

.stock-analysis-section {
    width: calc(100% - 40px);
    max-width: 900px;
    margin: 24px auto;
}

.stock-analysis-section h2 {
    margin: 28px 0 12px;
    font-size: 20px;
}

.stock-analysis-section .analysis {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 8px 20px;
}


/* Company fundamentals ranking */
.fundamentals-panel {
    margin: 28px 0;
    padding: 20px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    overflow-x: auto;
}

.fundamentals-panel .fundamentals-note {
    color: #64748b;
    font-size: 13px;
    line-height: 1.5;
    margin: 8px 0 16px;
}

.fundamentals-table {
    min-width: 760px;
}

.fundamentals-table th,
.fundamentals-table td {
    padding: 12px 10px;
    text-align: left;
    border-bottom: 1px solid #e5e7eb;
    white-space: nowrap;
}

.fundamentals-table th {
    color: #475569;
    background: #f8fafc;
    font-size: 13px;
}

.fundamentals-table a {
    color: #1d4ed8;
    font-weight: 600;
    text-decoration: none;
}

.fundamentals-table a:hover {
    text-decoration: underline;
}

.fundamentals-growth {
    color: #15803d;
    font-weight: 700;
}

#fundamentals-top10-status {
    color: #64748b;
    font-size: 13px;
    margin-top: 12px;
}

/* Company fundamentals ranking */
.fundamentals-panel {
    margin: 28px 0;
    padding: 20px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    overflow-x: auto;
}

.fundamentals-panel .fundamentals-note {
    color: #64748b;
    font-size: 13px;
    line-height: 1.5;
    margin: 8px 0 16px;
}

.fundamentals-table {
    min-width: 760px;
}

.fundamentals-table th,
.fundamentals-table td {
    padding: 12px 10px;
    text-align: left;
    border-bottom: 1px solid #e5e7eb;
    white-space: nowrap;
}

.fundamentals-table th {
    color: #475569;
    background: #f8fafc;
    font-size: 13px;
}

.fundamentals-table a {
    color: #1d4ed8;
    font-weight: 600;
    text-decoration: none;
}

.fundamentals-table a:hover {
    text-decoration: underline;
}

.fundamentals-growth {
    color: #15803d;
    font-weight: 700;
}

#fundamentals-top10-status {
    color: #64748b;
    font-size: 13px;
    margin-top: 12px;
}


/* Final unified stock detail layout */
.stock-analysis-section,
.stock-chart-section {
    box-sizing: border-box;
    width: 100%;
    max-width: none;
    margin: 24px 0;
    padding: 24px;
    background: var(--card-bg, #ffffff);
    border: 1px solid var(--border-color, #e2e8f0);
    border-radius: 16px;
    box-shadow: 0 5px 18px rgba(15, 23, 42, 0.06);
    min-width: 0;
}

.stock-analysis-section .analysis {
    border-radius: 12px;
}

@media (max-width: 700px) {
    .stock-analysis-section,
    .stock-chart-section {
        margin: 22px 0;
        padding: 15px;
        border-radius: 12px;
    }
}


/* Technical indicator status colours */
.indicator-positive {
    color: #15803d !important;
}

.indicator-negative {
    color: #dc2626 !important;
}

/* Main top navigation */
.top-nav {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    background: #1f2937;
    padding: 10px 30px;
    border-top: 1px solid #374151;
}

.top-nav a {
    display: inline-block;
    padding: 10px 16px;
    color: #d1d5db;
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    border-radius: 8px;
    transition: background 0.2s ease, color 0.2s ease;
}

.top-nav a:hover,
.top-nav a.active {
    background: #374151;
    color: #ffffff;
}

@media (max-width: 600px) {
    .top-nav {
        padding: 8px 12px;
        gap: 4px;
    }

    .top-nav a {
        padding: 9px 10px;
        font-size: 13px;
    }
}
