/* CSS Variables for Theming */
:root {
    --primary: #2c3e50;
    --secondary: #ff6b6b;
    --accent: #3d5a80;
    --light-bg: #f8f9fa;
    --teal: #4ecdc4;
    --border-color: #e0e0e0;
    --text-color: #000000;
    --text-light: #666;
}

/* Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Times New Roman', Times, serif;
    font-size: 1rem;
    line-height: 1.6;
    color: #000;
    background-color: var(--light-bg);
    max-width: 1400px;
    margin: 0 auto;
}

/* Typography */
h1 {
    font-size: 1.25rem;
    color: #000;
    margin-bottom: 1rem;
    text-align: center;
}

h2 {
    font-size: 1.125rem;
    color: #ff6b6b;
    margin-bottom: 0.75rem;
}

h3 {
    font-size: 1rem;
    color: #000;
    margin-bottom: 0.5rem;
}

h4 {
    font-size: 0.9375rem;
    color: #000;
    margin-bottom: 0.5rem;
}

@media (min-width: 768px) {
    h1 {
        font-size: 1.5rem;
    }

    h2 {
        font-size: 1.25rem;
    }

    h3 {
        font-size: 1.125rem;
    }

    h4 {
        font-size: 1rem;
    }
}

@media (min-width: 1025px) {
    h1 {
        font-size: 1.5rem;
    }

    h2 {
        font-size: 1.375rem;
    }

    h3 {
        font-size: 1.25rem;
    }

    h4 {
        font-size: 1.125rem;
    }
}

/* Main Layout */
.container {
    display: flex;
    flex-direction: column;
    padding: 0 1rem;
}

.main-content {
    width: 100%;
}

/* Sidebars */
.sidebar {
    display: none;
}

/* Calculator Styles */
.calculator {
    background-color: white;
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    margin-bottom: 1rem;
}

.form-group {
    margin-bottom: 1rem;
}

label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: bold;
    color: #000;
}

input, select {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-family: inherit;
    font-size: 1rem;
    color: #000;
}

.date-inputs {
    display: flex;
    gap: 0.5rem;
}

.date-inputs select, .date-inputs input {
    flex: 1;
}

/* Modern Calendar System Toggle */
.calendar-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 1rem 0;
}

.toggle-container {
    display: flex;
    background: #f0f0f0;
    border-radius: 50px;
    padding: 4px;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.1);
}

.toggle-option {
    padding: 8px 20px;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
    text-align: center;
    min-width: 120px;
    font-size: 1rem;
    color: #000;
}

.toggle-option.active {
    background: var(--teal);
    color: white;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

.toggle-option:not(.active):hover {
    background: #e0e0e0;
}

.buttons {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 1.5rem;
}

button {
    width: 100%;
    padding: 0.75rem;
    border: none;
    border-radius: 4px;
    font-family: inherit;
    font-size: 1rem;
    cursor: pointer;
    transition: background-color 0.3s;
    color: #000;
}

.calculate-btn {
    background-color: var(--teal);
    color: white;
}

/* Remove hover effect for calculate button */
.calculate-btn:hover {
    background-color: var(--teal);
}

.reset-btn {
    background-color: var(--secondary);
    color: white;
}

/* Remove hover effect for reset button */
.reset-btn:hover {
    background-color: var(--secondary);
}

/* Export Buttons */
.export-buttons {
    display: flex;
    gap: 0.5rem;
    margin-top: 1.5rem;
}

.export-btn {
    flex: 1;
    background-color: var(--accent);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 0.5rem;
    font-size: 1rem;
}

.export-btn:hover {
    background-color: #345178;
}

/* Spinner */
.spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255,255,255,.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
    margin-right: 8px;
    vertical-align: middle;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Results Section */
.results {
    margin-top: 1.5rem;
    padding: 1rem;
    background-color: white;
    border-radius: 4px;
    border: 1px solid var(--border-color);
    display: none;
    color: #000;
}

.result-item {
    margin-bottom: 0.75rem;
    display: flex;
    justify-content: space-between;
    color: #000;
}

.result-label {
    font-weight: bold;
    color: #000;
}

.day-name {
    font-size: 1.25rem;
    color: #000;
    text-align: center;
    margin: 1rem 0;
}

/* Chart Container */
.chart-container {
    margin-top: 1.5rem;
    padding: 1rem;
    background-color: white;
    border-radius: 4px;
    border: 1px solid var(--border-color);
    display: none;
}

.chart-wrapper {
    position: relative;
    height: 250px;
    width: 100%;
}

/* Ad Zones */
.ad-zone {
    background-color: var(--light-bg);
    border: 1px dashed var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-light);
    margin-bottom: 1rem;
    text-align: center;
}

#ad-mobile {
    width: 320px;
    height: 100px;
    margin: 0 auto 1rem;
}

#ad-tablet {
    width: 300px;
    height: 250px;
    margin: 0 auto 1rem;
}

#ad-left, #ad-right {
    width: 300px;
    height: 250px;
}

#ad-right {
    height: 600px;
}

/* Related Tools */
#related-tools {
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.05);
    width: 100%;
    margin-bottom: 1rem;
}

.tools-list {
    list-style: none;
}

.tools-list li {
    padding: 10px 0;
    border-bottom: 1px solid var(--border-color);
    color: #000;
}

.tools-list li:last-child {
    border-bottom: none;
}

.tools-list a {
    color: #000;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 10px;
}

.tools-list a:hover {
    color: var(--teal);
}

/* Mobile Related Tools */
.mobile-related-tools {
    display: block;
    margin: 1rem 0;
}

/* Responsive Layouts */

/* Tablet Layout (768px–1024px) */
@media (min-width: 768px) {
    .container {
        flex-direction: column;
    }

    #ad-tablet {
        display: flex;
        margin-top: 10px;
    }

    .mobile-related-tools #related-tools {
        margin: 0 auto 1rem;
    }

    .export-buttons {
        flex-direction: row;
    }

    .toggle-option {
        font-size: 1rem;
    }
}

/* Desktop Layout (≥1025px) */
@media (min-width: 1025px) {
    .container {
        flex-direction: row;
        gap: 1.5rem;
    }

    .sidebar {
        display: block;
        width: 300px;
    }

    .main-content {
        flex: 1;
    }

    .sidebar-left {
        position: sticky;
        top: 20px;
        align-self: flex-start;
    }

    .sidebar-right {
        position: sticky;
        top: 20px;
        align-self: flex-start;
    }

    #ad-tablet, #ad-mobile {
        display: none;
    }

    .mobile-related-tools {
        display: none;
    }

    .toggle-option {
        font-size: 1rem;
    }
}

/* Mobile Layout (≤767px) - already implemented as default */
#ad-left, #ad-right, #ad-tablet {
    display: none;
}

#ad-mobile {
    display: flex;
}

@media (min-width: 768px) {
    #ad-mobile, #ad-left, #ad-right {
        display: none;
    }

    #ad-tablet {
        display: flex;
    }
}

@media (min-width: 1025px) {
    #ad-mobile, #ad-tablet {
        display: none;
    }

    #ad-left, #ad-right {
        display: flex;
    }
}

/* Print Styles */
@media print {
    body * {
        visibility: hidden;
    }
    .calculator, .calculator * {
        visibility: visible;
    }
    .calculator {
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
        box-shadow: none;
    }
    .buttons, .export-buttons, .ad-zone, .sidebar, .mobile-related-tools {
        display: none !important;
    }
}

/* Add breadcrumb styles */
.breadcrumb {
    padding: 0px 10px;
    color: #000;
    margin-bottom: 5px;
    font-size: 1rem;
}

.breadcrumb a {
    color: #000;
    text-decoration: none;
    transition: color 0.3s;
}

.breadcrumb a:hover {
    color: var(--secondary);
    text-decoration: underline;
}

.mobile-table {
    overflow-x: auto;
    margin: 20px 0;
    border: 1px solid #eee;
    border-radius: 8px;
}

.mobile-table table {
    width: 100%;
    min-width: 600px;
    border-collapse: collapse;
}

.mobile-table th, .mobile-table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #eee;
    color: #000;
}

.mobile-table th {
    background-color: #4ecdc4;
    font-weight: bold;
    font-size: 1rem;
    color: #000;
}

.mobile-table tr:nth-child(even) {
    background-color: #fafafa;
}

.formula-table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
}

.formula-table th, .formula-table td {
    padding: 15px;
    border: 1px solid #ddd;
    vertical-align: top;
    color: #000;
}

.formula-table th {
    background-color: #4ecdc4;
    color: white;
    font-weight: bold;
    font-size: 1rem;
}

.formula-code {
    background: #f8f9fa;
    padding: 10px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    margin: 5px 0;
    color: #000;
}