/* CSS Variables */
: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;
    font-family: 'Times New Roman', Times, serif;
}

body {
    font-family: 'Times New Roman', Times, serif;
    font-size: 1rem;
    line-height: 1.6;
    color: #000;
    background-color: var(--light-bg);
}

h1 {
    font-size: 1.25rem;
    color: #000;
    margin-bottom: 1rem;
    font-family: 'Times New Roman', Times, serif;
    text-align: center;
}

h2 {
    font-size: 1.125rem;
    color: #ff6b6b;
    margin-bottom: 1rem;
    font-family: 'Times New Roman', Times, serif;
}

h3 {
    font-size: 1rem;
    color: #000;
    margin-bottom: 0.75rem;
    font-family: 'Times New Roman', Times, serif;
}

h4 {
    font-size: 0.9375rem;
    color: #000;
    margin-bottom: 0.75rem;
    font-family: 'Times New Roman', Times, serif;
}

/* Container */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0px 10px;
}

/* Calculator Layout */
.calculator-layout {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Main Content */
.main-content {
    flex: 1;
}

/* Sidebars */
.sidebar {
    display: none;
}

.left-sidebar, .right-sidebar {
    width: 300px;
}

/* Calculator Form */
.calculator-form {
    background-color: white;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
}

.form-group {
    margin-bottom: 1.5rem;
}

label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: bold;
    color: #000;
    font-family: 'Times New Roman', Times, serif;
}

input, select {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 1rem;
    font-family: 'Times New Roman', Times, serif;
    color: #000;
}

.input-row {
    display: flex;
    gap: 10px;
    align-items: center;
}

.input-row input {
    flex: 1;
}

/* Toggle Switch */
.toggle-container {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 1rem;
    font-family: 'Times New Roman', Times, serif;
    color: #000;
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 24px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 24px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: var(--teal);
}

input:checked + .slider:before {
    transform: translateX(26px);
}

/* Buttons */
.button-group {
    display: flex;
    gap: 10px;
    margin-top: 1.5rem;
}

button {
    padding: 12px 20px;
    border: none;
    border-radius: 4px;
    font-size: 1rem;
    cursor: pointer;
    transition: background-color 0.3s;
    font-family: 'Times New Roman', Times, serif;
    color: #000;
}

.btn-primary {
    background-color: var(--teal);
    color: white;
    flex: 1;
}

.btn-secondary {
    background-color: var(--secondary);
    color: white;
    flex: 1;
}

.btn-export {
    background-color: var(--accent);
    color: white;
    flex: 1;
}

button:hover {
    opacity: 0.9;
}

/* Results Section */
.results-section {
    background-color: white;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
}

.result-item {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-color);
    font-family: 'Times New Roman', Times, serif;
    color: #000;
}

.result-item:last-child {
    border-bottom: none;
}

.result-value {
    font-weight: bold;
    color: #000;
    font-family: 'Times New Roman', Times, serif;
    font-size: 1.25rem;
}

.highlight {
    background-color: var(--light-bg);
    padding: 15px;
    border-radius: 4px;
    margin-top: 10px;
}

/* Ad Zones */
.ad-zone {
    background-color: #f0f0f0;
    border: 1px dashed var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
    color: #000;
    font-style: italic;
    font-family: 'Times New Roman', Times, serif;
    font-size: 1rem;
}

#ad-mobile {
    width: 100%;
    height: 100px;
}

#ad-tablet {
    width: 300px;
    height: 250px;
    margin: 0 auto;
    display: none;
}

#ad-left, #ad-right {
    width: 300px;
    height: 250px;
}

#ad-right {
    height: 600px;
}

/* Related Tools */
#related-tools, .related-tools {
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.05);
    margin-bottom: 20px;
}

.tools-list {
    list-style: none;
}

.tools-list li {
    padding: 10px 0;
    border-bottom: 1px solid var(--border-color);
    color: #000;
    font-size: 1rem;
}

.tools-list li:last-child {
    border-bottom: none;
}

.tools-list a {
    color: #000;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1rem;
}

.tools-list a:hover {
    color: var(--teal);
}

/* Hidden elements */
.hidden {
    display: none;
}

/* Export Section */
.export-section {
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid var(--border-color);
}

/* Chart Container */
.chart-container {
    width: 100%;
    max-width: 400px;
    height: 300px;
    margin: 20px auto;
}

/* Plain Text Results */
.plain-text-results {
    background-color: var(--light-bg);
    padding: 15px;
    border-radius: 4px;
    margin-top: 15px;
    font-family: 'Times New Roman', Times, serif;
    white-space: pre-line;
    display: none;
    color: #000;
    font-size: 1rem;
}

/* Warning Styles */
.warning-message {
    background-color: #fff3cd;
    border: 1px solid #ffeaa7;
    color: #856404;
    padding: 10px;
    border-radius: 4px;
    margin-top: 10px;
    font-size: 0.875rem;
    font-family: 'Times New Roman', Times, serif;
}

.info-message {
    background-color: #d1ecf1;
    border: 1px solid #bee5eb;
    color: #0c5460;
    padding: 10px;
    border-radius: 4px;
    margin-top: 10px;
    font-size: 0.875rem;
    font-family: 'Times New Roman', Times, serif;
}

/* Spinner Animation */
.spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255,255,255,.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 0.6s linear infinite;
    margin-right: 8px;
    vertical-align: middle;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

#calculate-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

/* 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;
    font-size: 1rem;
}

.breadcrumb a:hover {
    color: var(--secondary);
    text-decoration: underline;
}

/* Mobile Table Styles */
.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;
    font-size: 1rem;
    color: #000;
}

.mobile-table th {
    background-color: #4ecdc4;
    font-weight: bold;
    color: #000;
}

.mobile-table td {
    color: #000;
}

.mobile-table tr:nth-child(even) {
    background-color: #fafafa;
}

/* Responsive Breakpoints */
@media (min-width: 768px) {
    h1 {
        font-size: 1.5rem;
    }

    h2 {
        font-size: 1.25rem;
    }

    h3 {
        font-size: 1.125rem;
    }

    h4 {
        font-size: 1rem;
    }

    #ad-tablet {
        display: flex;
        margin-top: 10px;
    }

    #ad-mobile {
        display: none;
    }

    .calculator-form {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 20px;
    }

    .form-group-full {
        grid-column: 1 / -1;
    }

    .button-group {
        grid-column: 1 / -1;
    }
    
    /* Show related tools after ads on tablet */
    .related-tools-mobile {
        display: block;
        margin-top: 20px; /* Added top margin for tablet */
    }
}

@media (min-width: 1025px) {
    h1 {
        font-size: 1.5rem;
    }

    h2 {
        font-size: 1.375rem;
    }

    h3 {
        font-size: 1.25rem;
    }

    h4 {
        font-size: 1.125rem;
    }

    .calculator-layout {
        flex-direction: row;
    }

    .sidebar {
        display: block;
    }

    .left-sidebar, .right-sidebar {
        position: sticky;
        top: 20px;
        height: fit-content;
    }

    #ad-mobile, #ad-tablet {
        display: none;
    }

    #ad-left, #ad-right {
        display: flex;
    }
    
    /* Hide mobile related tools on desktop */
    .related-tools-mobile {
        display: none;
    }
}