:root {
    --bg-main: #ffffff;
    --card-bg: #ffffff;
    --text-dark: #1a1d1f;
    --text-grey: #6f767e;
    --mint-green: #1ad598;
    --coral-orange: #ff9966;
    --shadow-diffused: 0 10px 40px rgba(0, 0, 0, 0.04);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-font-smoothing: antialiased;
}

body, html {
    min-height: 100vh;
    background-color: var(--bg-main);
    color: var(--text-dark);
    font-family: 'Plus Jakarta Sans', sans-serif;
}

.app-wrapper {
    max-width: 1600px;
    margin: 0 auto;
    padding: 2rem;
    width: 100%;
}

.dashboard-header {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 2rem;
    position: relative;
    min-height: 44px;
}

.search-container {
    width: 100%;
    max-width: 600px;
    display: flex;
    align-items: center;
    gap: 0.85rem;
}

.search-container::before {
    content: '';
    width: 44px; /* Matches .random-btn width */
    flex-shrink: 0;
}

.header-right {
    position: absolute;
    right: 0;
}

.search-input-wrapper {
    position: relative;
    flex: 1;
}

#companySearch {
    width: 100%;
    padding: 0.75rem 1.25rem 0.75rem 3rem;
    background: #f4f4f4;
    border: none;
    border-radius: 99px;
    font-size: 0.95rem;
    font-weight: 500;
    outline: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%236f767e' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='m21 21-4.3-4.3'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: 1rem center;
}

.custom-dropdown {
    position: absolute;
    top: 110%;
    left: 0;
    right: 0;
    background: white;
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    z-index: 100;
    display: none;
    overflow: hidden;
}

.dropdown-item {
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    cursor: pointer;
    transition: background 0.2s;
}

.dropdown-item:hover, .dropdown-item.active {
    background: #f0f2f4;
}

.dd-match {
    background: rgba(26, 213, 152, 0.15);
    color: #000;
    padding: 0 1px;
    border-radius: 2px;
}

.dd-logo {
    width: 24px;
    height: 24px;
    object-fit: contain;
}

.random-btn {
    border: none;
    background: #f4f4f4;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.random-btn:hover {
    background: #eef1f4;
    transform: scale(1.05);
}

.random-btn:active {
    transform: scale(0.95);
}

.random-btn svg {
    width: 20px;
    height: 20px;
    color: var(--text-grey);
}

/* Version: 1.0.3 - CSS update for central alignment */

/* Centered Brand Hero */
.brand-hero {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 2rem;
}

.header-main-row {
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

.header-sub-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    opacity: 0.85;
}

.ticker-badge {
    background: #f4f4f4;
    padding: 0.2rem 0.6rem;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 800;
    color: var(--text-dark);
}

.company-logo {
    width: 44px;
    height: 44px;
    object-fit: contain;
}

.company-name {
    font-size: 1.75rem;
    font-weight: 800;
    color: #000;
    letter-spacing: -0.02em;
}

.market-cap {
    font-size: 0.85rem;
    color: var(--text-grey);
    font-weight: 600;
}

.cap-value {
    color: var(--text-dark);
    font-weight: 700;
}

/* Valuation Grid Layout */
.valuation-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4rem;
    align-items: center;
    max-width: 1400px;
    margin: 0 auto;
}

.charts-column {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.calculation-column {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    padding-top: 1rem;
}

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

.calc-group {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.calc-group label {
    font-size: 1.15rem;
    font-weight: 800;
    color: var(--text-dark);
    line-height: 1.2;
    letter-spacing: -0.01em;
}

.value-display, input {
    width: 100%;
    padding: 0.85rem 1.5rem;
    background: #f4f4f4;
    border: none;
    border-radius: 99px;
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--text-dark);
    font-family: inherit;
    transition: all 0.2s ease;
}

input {
    outline: none;
    border: 2px solid transparent;
}

input:focus {
    background: #fff;
    border-color: #f4f4f4;
    box-shadow: 0 4px 20px rgba(0,0,0,0.05);
}

input::placeholder {
    color: #ccc;
    font-size: 1.15rem;
}

.results-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

.value-display.highlight {
    background: #f4f4f4;
}

.value-display.jumbo {
    font-size: 1.5rem;
    font-weight: 800;
}

.full-width {
    grid-column: 1 / -1;
}

.chart-card {
    background: var(--card-bg);
    border-radius: 32px;
    padding: 2.25rem;
    box-shadow: var(--shadow-diffused);
    position: relative;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1.5rem;
    gap: 0.5rem;
}

.card-header h3 {
    font-size: 1.15rem;
    font-weight: 800;
    color: #000000;
    letter-spacing: -0.01em;
}

.badge-wrapper {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: flex-end;
}

.trend-badge {
    padding: 0.5rem 1rem;
    border-radius: 99px;
    font-size: 0.75rem;
    font-weight: 800;
    color: white;
    text-shadow: 0 1px 2px rgba(0,0,0,0.1);
    white-space: nowrap;
}

.chart-container {
    flex-grow: 1;
    min-height: 250px;
    position: relative;
}

.dashboard-footer {
    display: flex;
    justify-content: flex-end;
    margin-top: 4rem;
    padding-bottom: 2rem;
}

.dashboard-footer span {
    font-size: 12px;
    font-weight: 600;
    color: #9ca3af;
    letter-spacing: 0.02em;
}

@media (max-width: 1024px) {
    .valuation-grid {
        grid-template-columns: 1fr;
        gap: 3rem;
    }
    .app-wrapper { padding: 1.5rem; }
}

@media (max-width: 600px) {
    .results-grid { grid-template-columns: 1fr; }
    .calc-group label { font-size: 1.25rem; }
    .value-display, input { font-size: 1.25rem; padding: 1rem 1.5rem; }
    .value-display.jumbo { font-size: 1.75rem; }
}
