:root {
    --primary: #2c3e50;
    --secondary: #ff6b6b;
    --accent: #3d5a80;
    --light-bg: #f8f9fa;
    --teal: #4ecdc4;
    --border-color: #e0e0e0;
    --text-color: #000000;
    --text-light: #666;
}

* {
    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);
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 10px;
}

/* Main Layout */
.main-content {
    display: flex;
    flex-direction: column;
}

/* Calculator Section */
.calculator-section {
    background-color: white;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

h1 {
    font-size: 1.25rem;
    margin-bottom: 20px;
    color: #000;
    text-align: center;
}

h2 {
    font-size: 1.375rem;
    margin: 15px 0 10px;
    color: #ff6b6b;
}

h3 {
    font-size: 1.25rem;
    margin: 10px 0;
    color: #000;
}

h4 {
    font-size: 1.125rem;
    margin: 10px 0;
    color: #000;
}

/* Form Styles */
.form-group {
    margin-bottom: 15px;
}

label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
    color: #000;
}

input, select {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-family: inherit;
    font-size: 1rem;
    color: #000;
}

.form-row {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
}

.form-col {
    flex: 1 1 200px;
}

.form-section {
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border-color);
}

/* Buttons */
.button-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 20px;
}

button {
    padding: 12px 20px;
    border: none;
    border-radius: 4px;
    font-family: inherit;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.3s;
    width: 100%;
    color: #000;
}

.btn-primary {
    background-color: var(--teal);
    color: white;
}

.btn-secondary {
    background-color: var(--secondary);
    color: white;
}

/* Spinner */
.spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255,255,255,.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s ease-in-out infinite;
    margin-right: 10px;
    vertical-align: middle;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Results Section */
.results-section {
    background-color: white;
    border-radius: 8px;
    padding: 20px;
    margin-top: 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    border: 1px solid var(--border-color);
}

.result-item {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-color);
    color: #000;
}

.result-total {
    font-weight: bold;
    font-size: 1.25rem;
    color: #000;
}

.result-note {
    font-size: 0.875rem;
    color: var(--text-light);
    margin-top: 15px;
    padding: 10px;
    background-color: var(--light-bg);
    border-radius: 4px;
    border-left: 3px solid var(--teal);
}

/* Ad & Sidebar Styles */
.ad-container {
    background-color: white;
    border: 1px solid var(--border-color);
    display: flex;
    justify-content: center;
    align-items: center;
    color: var(--text-light);
    margin-bottom: 20px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

#ad-left, #ad-right, #ad-tablet, #ad-mobile {
    display: none;
}

/* Related Tools Styles */
#related-tools {
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.05);
}

.tools-list {
    list-style: none;
}

.tools-list li {
    padding: 10px 0;
    border-bottom: 1px solid var(--border-color);
}

.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);
}

/* Chart Section */
.chart-container {
    width: 100%;
    max-width: 200px;
    height: 200px;
    margin: 20px auto;
}

.export-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 20px;
}

.export-btn {
    background-color: var(--accent);
    color: white;
    padding: 10px 15px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    flex: 1;
    min-width: 120px;
    font-size: 1rem;
}

/* Custom input styles */
.custom-input {
    margin-top: 10px;
    display: none;
}

/* Unit Toggle */
.unit-toggle-container {
    display: flex;
    align-items: center;
    margin-bottom: 15px;
}

.unit-toggle-label {
    margin-right: 10px;
    font-weight: bold;
    color: #000;
}

.unit-toggle {
    position: relative;
    display: inline-block;
    width: 60px;
    height: 30px;
}

.unit-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.unit-toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 34px;
}

.unit-toggle-slider:before {
    position: absolute;
    content: "";
    height: 22px;
    width: 22px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .unit-toggle-slider {
    background-color: var(--teal);
}

input:checked + .unit-toggle-slider:before {
    transform: translateX(30px);
}

.unit-text {
    margin-left: 10px;
    font-weight: bold;
    color: #000;
}

/* Mobile Layout (≤767px) */
#ad-mobile {
    display: block;
    width: 320px;
    height: 100px;
    margin: 0 auto;
    margin-top: 20px;
}

.mobile-related-tools {
    margin-top: 20px;
}

.tablet-related-tools {
    margin-top: 20px;
    display: none;
}

/* Tablet Layout (768px–1024px) */
@media (min-width: 768px) {
    h1 {
        font-size: 1.5rem;
    }

    h2 {
        font-size: 1.25rem;
    }

    h3 {
        font-size: 1.125rem;
    }

    h4 {
        font-size: 1rem;
    }

    #ad-mobile {
        display: none;
    }

    #ad-tablet {
        display: block;
        width: 300px;
        height: 250px;
        margin: 0 auto;
        margin-top: 20px;
    }

    .button-group {
        flex-direction: row;
    }

    button {
        width: 100%;
    }

    .mobile-related-tools {
        display: none;
    }

    .tablet-related-tools {
        display: block;
    }
}

/* Desktop Layout (≥1025px) */
@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-content {
        flex-direction: row;
        gap: 20px;
        align-items: flex-start;
    }

    .calculator-section {
        flex: 1;
    }

    .sidebar {
        width: 300px;
        position: sticky;
        top: 20px;
        height: 100vh;
        overflow-y: auto;
    }

    .sidebar-left {
        order: -1;
    }

    .sidebar-right {
        order: 1;
    }

    #ad-left, #ad-right {
        display: block;
        position: static;
    }

    #ad-left {
        width: 300px;
        height: 250px;
    }

    #ad-right {
        width: 300px;
        height: 600px;
    }

    #ad-tablet, #ad-mobile {
        display: none;
    }

    #related-tools {
        position: static;
        width: 300px;
        height: auto;
        margin-top: 20px;
    }
    
    .mobile-related-tools, .tablet-related-tools {
        display: none;
    }

    .button-group {
        flex-direction: row;
    }
    
    button {
        width: 100%;
    }
}

/* Hide mobile/tablet related tools on desktop */
@media (min-width: 1025px) {
    .mobile-related-tools, .tablet-related-tools {
        display: none;
    }
}

/* Hide desktop related tools on mobile/tablet */
@media (max-width: 1024px) {
    .desktop-related-tools {
        display: none;
    }
}

/* 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;
}
.mobile-table th {
    background-color: #4ecdc4;
    font-weight: bold;
}
.mobile-table tr:nth-child(even) {
    background-color: #fafafa;
}