:root {
    --primary: #2E5EAA;
    --primary-dark: #1A4B99;
    --secondary: #38B6FF;
    --accent: #5D9E52;
    --text-primary: #2C3E50;
    --text-secondary: #526577;
    --neutral-light: #F5F7FA;
    --border: #eee;
    --shadow: rgba(46, 94, 170, 0.1);
}

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

body {
    font-family: Arial, sans-serif;
    line-height: 1.6;
    background-color: #f4f4f4;
}

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

.calculator-container {
    display: flex;
    gap: 2rem;
    background-color: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.calculator-inputs {
    flex: 0 0 350px;
    padding-right: 2rem;
    border-right: 1px solid #eee;
}

.calculator-results {
    flex: 1;
    min-width: 0; /* Prevents flex item from overflowing */
}

h1 {
    text-align: center;
    color: #333;
    margin-bottom: 2rem;
    font-size: clamp(1.5rem, 4vw, 2.5rem);
}

h2 {
    color: #333;
    margin-bottom: 1.5rem;
    font-size: clamp(1.25rem, 3vw, 2rem);
}

h3 {
    color: #444;
    margin-bottom: 1rem;
    font-size: clamp(1.1rem, 2.5vw, 1.5rem);
}

.input-group {
    margin-bottom: 1rem;
}

label {
    display: block;
    margin-bottom: 0.5rem;
    color: #555;
}

input {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
}

input[type="checkbox"] {
    width: auto;
    margin-right: 0.5rem;
}

button {
    display: block;
    width: 100%;
    padding: 0.75rem;
    background-color: #007bff;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 1rem;
    cursor: pointer;
    margin: 1rem 0;
    transition: background-color 0.2s;
}

button:hover {
    background-color: #0056b3;
}

.results {
    margin-top: 0;
}

.hidden {
    display: none;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
    font-size: clamp(0.875rem, 2vw, 1rem);
}

th, td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

th {
    background-color: #f8f9fa;
    font-weight: 600;
}

.price-note {
    font-size: 0.8em;
    color: #666;
    display: block;
}

.search-container {
    position: relative;
    z-index: 100;
}

.search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background-color: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    max-height: 300px;
    overflow-y: auto;
}

.search-result-item {
    padding: 0.75rem;
    cursor: pointer;
    border-bottom: 1px solid #eee;
}

.search-result-item:hover {
    background-color: #f8f9fa;
}

.search-result-item .symbol {
    font-weight: bold;
    margin-right: 0.5rem;
}

.search-result-item .exchange {
    color: #666;
    font-size: 0.9em;
}

/* Make the table more responsive */
.projection-table {
    width: 100%;
    overflow-x: auto;
}

/* Adjust stock info layout */
#stock-info {
    background-color: #f8f9fa;
    padding: 1rem;
    border-radius: 4px;
    margin-bottom: 2rem;
}

#stock-info h2 {
    margin-bottom: 1rem;
}

#stock-info p {
    margin-bottom: 0.5rem;
}

/* Make the table more compact on smaller screens */
@media (max-width: 1024px) {
    .calculator-container {
        flex-direction: column;
    }
    
    .calculator-inputs {
        flex: none;
        padding-right: 0;
        border-right: none;
        border-bottom: 1px solid #eee;
        padding-bottom: 2rem;
        margin-bottom: 2rem;
    }

    .chart-wrapper {
        height: 300px;
    }

    .summary-grid {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    }
}

@media (max-width: 768px) {
    .container {
        margin: 0.5rem auto;
        padding: 0 0.75rem;
    }

    .calculator-container {
        padding: 1rem;
        gap: 1rem;
    }

    input, 
    select, 
    button {
        min-height: 44px;
        font-size: 16px;
    }

    button {
        padding: 0.8rem;
        margin: 1.25rem 0;
        touch-action: manipulation;
    }

    .input-group {
        margin-bottom: 1.25rem;
    }

    input[type="checkbox"] {
        width: 20px;
        height: 20px;
        margin-right: 0.75rem;
    }

    table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        white-space: nowrap;
        font-size: 0.9rem;
    }

    th, td {
        padding: 0.75rem;
        min-width: 100px;
    }

    .search-container {
        position: static;
    }

    .search-results {
        position: fixed;
        left: 0.75rem;
        right: 0.75rem;
        top: auto;
        bottom: 0;
        max-height: 50vh;
        border-radius: 12px 12px 0 0;
        box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
    }

    .search-result-item {
        padding: 1rem 0.75rem;
    }

    .chart-wrapper {
        padding: 0.75rem;
        height: 250px;
        margin-bottom: 1.5rem;
    }

    .stock-details-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

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

    .metric {
        padding: 0.75rem 0;
    }

    h1 {
        font-size: clamp(1.25rem, 5vw, 1.75rem);
        margin-bottom: 1.5rem;
    }

    h2 {
        font-size: clamp(1.1rem, 4vw, 1.5rem);
        margin-bottom: 1rem;
    }

    h3 {
        font-size: clamp(1rem, 3.5vw, 1.25rem);
    }

    #stock-info {
        padding: 1rem;
        margin-bottom: 1.5rem;
    }

    .calendar-container {
        padding: 15px;
        margin: 10px;
    }

    .calendar-grid {
        gap: 5px;
    }

    .calendar-day {
        padding: 8px;
        min-height: 80px;
        font-size: 0.9em;
    }

    .dividend-entry {
        padding: 4px;
        font-size: 0.85em;
    }

    .dividend-entries {
        max-height: 120px;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 0.5rem;
    }

    .calculator-container {
        padding: 0.75rem;
        border-radius: 6px;
    }

    input, 
    select, 
    button {
        min-height: 48px;
    }

    body {
        font-size: 0.95rem;
    }

    .summary-item {
        padding: 1rem;
    }

    .summary-item p {
        font-size: 1.25rem;
    }

    .chart-wrapper {
        height: 200px;
        padding: 0.5rem;
    }

    .metric {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.25rem;
    }

    .search-results {
        max-height: 60vh;
        left: 0.5rem;
        right: 0.5rem;
    }

    .calendar-header {
        flex-direction: column;
        gap: 15px;
        align-items: stretch;
    }

    .calendar-navigation {
        display: flex;
        justify-content: space-between;
    }

    .view-toggle {
        justify-content: center;
    }

    .calendar-day.header {
        font-size: 0.8em;
        padding: 8px 4px;
    }

    .day-number {
        font-size: 1em;
    }
}

/* Tablet optimization */
@media (min-width: 769px) and (max-width: 1024px) {
    .calculator-container {
        gap: 1.5rem;
    }

    .chart-wrapper {
        height: 300px;
    }

    .summary-grid {
        grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    }
}

/* Touch device optimizations */
@media (hover: none) {
    button:hover,
    .search-result-item:hover {
        background-color: initial;
    }

    button:active {
        background-color: #0056b3;
    }

    .search-result-item:active {
        background-color: #f8f9fa;
    }
}

/* Prevent pull-to-refresh on mobile */
body {
    overscroll-behavior-y: contain;
}

/* Improve scrolling performance */
* {
    -webkit-overflow-scrolling: touch;
}

/* Print Styles */
@media print {
    .calculator-inputs,
    button,
    .search-container {
        display: none;
    }

    .calculator-container {
        box-shadow: none;
        padding: 0;
    }

    .calculator-results {
        width: 100%;
    }

    .chart-wrapper {
        break-inside: avoid;
        page-break-inside: avoid;
    }
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.results:not(.hidden) {
    animation: fadeIn 0.3s ease-in-out;
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    * {
        animation: none !important;
        transition: none !important;
    }
}

/* High Contrast Mode */
@media (forced-colors: active) {
    button,
    .calculator-link {
        border: 2px solid currentColor;
    }

    .chart-wrapper,
    .stock-detail-card,
    .summary-item {
        border: 1px solid currentColor;
    }
}

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

.chart-wrapper {
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    height: 400px;
    width: 100%;
    margin-bottom: 1rem;
}

/* Add smooth scrolling to the whole page */
html {
    scroll-behavior: smooth;
}

/* Add some spacing between sections */
#projection {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

/* Add titles for each chart section */
.chart-wrapper h3 {
    margin-bottom: 1rem;
    color: #333;
    font-size: 1.2rem;
}

.stock-details-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
}

.stock-detail-card {
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.stock-detail-card h3 {
    margin-bottom: 1rem;
    color: #333;
    font-size: 1.2rem;
}

.stock-metrics {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.75rem;
}

.metric {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    border-bottom: 1px solid #eee;
}

.metric:last-child {
    border-bottom: none;
}

.metric label {
    color: #666;
    margin-bottom: 0;
}

.metric span {
    font-weight: 500;
    color: #333;
}

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

.summary-item {
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    text-align: center;
}

.summary-item h4 {
    color: #666;
    margin-bottom: 0.5rem;
    font-size: 1rem;
    font-weight: normal;
}

.summary-item p {
    color: #333;
    font-size: 1.5rem;
    font-weight: 500;
    margin: 0;
}

/* Calendar styles */
.calendar-container {
    padding: 20px;
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px var(--shadow);
    margin: 20px auto;
    max-width: 1200px;
}

.calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    color: var(--text-primary);
}

.calendar-navigation button {
    background-color: var(--primary);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.calendar-navigation button:hover {
    background-color: var(--primary-dark);
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 10px;
    margin-top: 10px;
}

.calendar-day {
    border: 1px solid var(--border);
    padding: 10px;
    min-height: 100px;
    background-color: white;
}

.calendar-day.header {
    background-color: var(--neutral-light);
    color: var(--text-primary);
    font-weight: bold;
    text-align: center;
    padding: 10px;
    min-height: auto;
}

.calendar-day.empty {
    background-color: var(--neutral-light);
}

.day-number {
    font-size: 1.1em;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 5px;
}

.dividend-entry {
    background-color: var(--neutral-light);
    border-left: 3px solid var(--accent);
    padding: 5px;
    margin: 5px 0;
    font-size: 0.9em;
    color: var(--text-secondary);
}

.dividend-entries {
    max-height: 150px;
    overflow-y: auto;
}

.view-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-secondary);
}

.view-toggle input[type="checkbox"] {
    cursor: pointer;
}

.watchlist-container {
    margin-top: 2rem;
}

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

.stock-input {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
}

.stock-input input {
    flex: 1;
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.watchlist {
    list-style: none;
    padding: 0;
}

.watchlist li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem;
    background: white;
    margin-bottom: 0.5rem;
    border-radius: 4px;
    border: 1px solid var(--border);
}

.remove-stock {
    color: #dc3545;
    cursor: pointer;
}

.error-message {
    background-color: #f8d7da;
    color: #721c24;
    padding: 1rem;
    margin-bottom: 1rem;
    border-radius: 4px;
    text-align: center;
}

.company-name {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

/* Navbar styles */
.navbar {
    background: white;
    padding: 1rem 0;
    box-shadow: 0 2px 8px var(--shadow);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 2rem;
}

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

.nav-logo::before {
    content: "📈";
    font-size: 1.2rem;
}

.nav-links {
    display: flex;
    gap: 2.5rem;
    align-items: center;
}

.nav-links a {
    color: var(--text-secondary);
    text-decoration: none;
    transition: all 0.2s ease;
    font-weight: 500;
    padding: 0.5rem 0;
    position: relative;
}

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

.nav-links a::after {
    content: '';
    position: absolute;
    width: 0;
    height: 2px;
    bottom: 0;
    left: 0;
    background-color: var(--primary);
    transition: width 0.3s ease;
}

.nav-links a:hover::after {
    width: 100%;
}

.nav-links a.active {
    color: var(--primary);
    font-weight: 600;
}

.nav-links a.active::after {
    width: 100%;
}

/* Navbar responsive improvements */
@media (max-width: 768px) {
    .nav-container {
        flex-direction: column;
        gap: 1rem;
        padding: 0.75rem;
    }

    .nav-links {
        flex-wrap: wrap;
        justify-content: center;
        gap: 1rem;
        width: 100%;
    }

    .nav-links a {
        font-size: 0.9rem;
        padding: 0.4rem 0;
    }

    /* Adjust Buy Me a Coffee button on mobile */
    .nav-links a[href*="buymeacoffee"] {
        margin-left: 0;
        margin-top: 0.5rem;
        width: 100%;
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .nav-container {
        padding: 0.5rem;
    }

    .nav-links {
        gap: 0.75rem;
    }

    .nav-links a {
        font-size: 0.85rem;
    }

    .nav-logo {
        font-size: 1.25rem;
    }

    /* Further adjust Buy Me a Coffee button on smaller screens */
    .nav-links a[href*="buymeacoffee"] {
        font-size: 0.8rem;
        padding: 0.4rem 0.8rem;
    }

    .nav-links a[href*="buymeacoffee"] img {
        height: 16px;
    }
}

/* Calendar day styles */
.calendar-day.header {
    font-weight: bold;
    text-align: center;
    padding: 0.5rem;
    background-color: var(--primary);
    color: white;
    border-radius: 4px;
}

.calendar-day.empty {
    background-color: var(--neutral-light);
    border: none;
}

.day-number {
    font-size: 1.1rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.dividend-entries {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-height: 200px;
    overflow-y: auto;
}

/* Calendar navigation styles */
.calendar-navigation h2 {
    margin: 0;
    font-size: 1.5rem;
    color: var(--text-primary);
}

.calendar-navigation button {
    width: auto;
    margin: 0;
    padding: 0.5rem 1rem;
    background-color: var(--primary);
}

.calendar-navigation button:hover {
    background-color: var(--primary-dark);
}

/* Additional responsive styles for calendar */
@media (max-width: 768px) {
    .calendar-day.header {
        font-size: 0.9rem;
        padding: 0.25rem;
    }

    .day-number {
        font-size: 1rem;
    }

    .dividend-entries {
        max-height: 150px;
    }

    .calendar-navigation h2 {
        font-size: 1.2rem;
    }
}

.support-page {
    padding: 2rem 0;
}

.support-content {
    max-width: 800px;
    margin: 0 auto;
}

.support-tiers {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin: 2rem 0;
}

.tier {
    text-align: center;
    padding: 1.5rem;
    background: var(--neutral-light);
    border-radius: 8px;
    transition: all 0.3s ease;
}

.tier:hover {
    transform: translateY(-5px);
    box-shadow: 0 4px 12px var(--shadow);
}

.support-cta {
    text-align: center;
    margin-top: 2rem;
} 