: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);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Heading Styles */
h1 {
    font-size: 1.5rem;
    color: #000;
}

h2 {
    font-size: 1.375rem;
    color: #ff6b6b;
}

h3 {
    font-size: 1.25rem;
    color: #000;
}

h4 {
    font-size: 1.125rem;
    color: #000;
}

/* Main Container */
.container {
    max-width: 1400px;
    width: 100%;
    padding: 0 10px;
    flex: 1;
}

/* Main Content Layout */
.content-wrapper {
    display: flex;
    flex-direction: column;
    gap: 0 1.5rem;
}

/* Sidebar Styles */
.sidebar {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.ad-zone {
    background-color: #f0f0f0;
    border: 1px dashed var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #000;
    font-size: 0.875rem;
}

#ad-left {
    width: 100%;
    height: 250px;
}

#ad-right {
    width: 100%;
    height: 600px;
}

#ad-tablet {
    width: 300px;
    height: 250px;
    margin: 20px auto 0;
}

#ad-mobile {
    width: 320px;
    height: 100px;
    margin: 20px auto 0;
}

/* Related Tools */
#related-tools {
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.05);
}

#related-tools h3 {
    color: #000;
    margin-bottom: 1rem;
    font-size: 1.25rem;
}

.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;
    font-size: 1rem;
}

.tools-list a:hover {
    color: var(--teal);
}

/* Calculator Styles */
#converter-tool {
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    padding: 1.5rem;
    width: 100%;
}

#converter-tool h2 {
    color: #ff6b6b;
    margin-bottom: 1.5rem;
    font-size: 1.375rem;
}

.calculator-section {
    margin-bottom: 2rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 1.5rem;
}

.calculator-section h3 {
    color: #000;
    margin-bottom: 1rem;
    font-size: 1.25rem;
}

.input-group {
    margin-bottom: 1rem;
}

.input-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: bold;
    color: #000;
    font-size: 1rem;
}

.input-group input, .input-group select {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-family: inherit;
    font-size: 1rem;
    color: #000;
}

.input-group input:focus, .input-group select:focus {
    outline: none;
    border-color: var(--teal);
    box-shadow: 0 0 0 2px rgba(78, 205, 196, 0.2);
}

.input-row {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.input-row .input-group {
    flex: 1;
    min-width: 200px;
}

/* Toggle Button Styles */
.toggle-container {
    display: flex;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 0.5rem;
    width: fit-content;
}

.toggle-btn {
    padding: 0.5rem 1rem;
    background-color: #f0f0f0;
    border: none;
    cursor: pointer;
    transition: background-color 0.3s;
    font-size: 1rem;
    color: #000;
}

.toggle-btn.active {
    background-color: var(--teal);
    color: white;
}

.toggle-btn:not(.active):hover {
    background-color: #e0e0e0;
}

.buttons {
    display: flex;
    gap: 1rem;
    margin-top: 1.5rem;
    flex-wrap: wrap;
}

button {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 4px;
    font-family: inherit;
    font-size: 1rem;
    cursor: pointer;
    transition: background-color 0.3s;
    position: relative;
    overflow: hidden;
    color: #000;
}

#calculate-btn {
    background-color: var(--teal);
    color: white;
    flex: 1;
    font-size: 1rem;
}

#reset-btn {
    background-color: var(--secondary);
    color: white;
    flex: 1;
    font-size: 1rem;
}

#calculate-btn:hover {
    background-color: #3bb5ad;
}

#reset-btn:hover {
    background-color: #ff5252;
}

/* Spinner Animation */
.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: 8px;
    vertical-align: middle;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Results Section */
.results-section {
    margin-top: 2rem;
    display: none;
}

.results-section.active {
    display: block;
}

.results-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
    margin-bottom: 2rem;
}

.result-card {
    background-color: var(--light-bg);
    border-radius: 5px;
    padding: 1rem;
    text-align: center;
}

.result-card h4 {
    margin-bottom: 0.5rem;
    color: #000;
    font-size: 1.125rem;
}

.result-value {
    font-size: 1.25rem;
    font-weight: bold;
    color: #000;
}

/* New Results Display Styles */
.detailed-results {
    margin-top: 2rem;
}

.results-table-container {
    overflow-x: auto;
    margin-bottom: 2rem;
    border: 1px solid var(--border-color);
    border-radius: 5px;
}

.results-table {
    width: 100%;
    border-collapse: collapse;
}

.results-table th, .results-table td {
    padding: 0.75rem;
    text-align: right;
    border-bottom: 1px solid var(--border-color);
    color: #000;
    font-size: 1rem;
}

.results-table th {
    background-color: var(--light-bg);
    font-weight: bold;
    text-align: left;
    font-size: 1rem;
}

.results-table th:first-child, .results-table td:first-child {
    text-align: left;
}

.results-table tr:hover {
    background-color: rgba(0,0,0,0.02);
}

.chart-container {
    margin-bottom: 2rem;
    height: 300px;
    position: relative;
}

.chart-title {
    text-align: center;
    margin-bottom: 1rem;
    color: #000;
    font-weight: bold;
    font-size: 1rem;
}

.tab-container {
    margin-bottom: 1.5rem;
}

.tab-buttons {
    display: flex;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 1rem;
}

.tab-button {
    padding: 0.75rem 1.5rem;
    background: none;
    border: none;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.3s;
    font-size: 1rem;
    color: #000;
}

.tab-button.active {
    border-bottom: 2px solid var(--teal);
    color: var(--teal);
    font-weight: bold;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

.export-options {
    display: flex;
    gap: 1rem;
    margin-top: 2rem;
    flex-wrap: wrap;
}

.export-btn {
    background-color: var(--primary);
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: background-color 0.3s;
    font-size: 1rem;
}

.export-btn:hover {
    background-color: #1a2530;
}

/* Mobile and Tablet Tools Section */
.mobile-tablet-tools {
    display: none;
}

/* Responsive Styles */
/* Mobile Layout (≤767px) */
@media (max-width: 767px) {
    h1 {
        font-size: 1.25rem;
    }

    h2 {
        font-size: 1.125rem;
    }

    h3 {
        font-size: 1rem;
    }

    h4 {
        font-size: 0.9375rem;
    }

    #converter-tool h1 {
        font-size: 1.25rem;
        text-align: center;
        color: #000;
    }

    #converter-tool h2 {
        font-size: 1.125rem;
        color: #ff6b6b;
    }

    .calculator-section h2 {
        font-size: 1.125rem;
        color: #ff6b6b;
    }

    .calculator-section h3 {
        font-size: 1rem;
        color: #000;
    }

    #related-tools h3 {
        font-size: 1rem;
        color: #000;
    }

    .result-card h4 {
        font-size: 0.9375rem;
    }

    .tab-button {
        font-size: 0.875rem;
    }

    #ad-left, #ad-right, #ad-tablet {
        display: none;
    }

    #ad-mobile, .mobile-tablet-tools {
        display: block;
    }

    .desktop-tools {
        display: none;
    }
    
    .mobile-tablet-tools {
        margin-top: 1.5rem;
    }

    #related-tools {
        margin-top: 20px;
    }

    .tab-buttons {
        flex-wrap: wrap;
    }

    .tab-button {
        flex: 1;
        min-width: 120px;
        text-align: center;
    }
}

/* Tablet Layout (768px–1024px) */
@media (min-width: 768px) and (max-width: 1024px) {
    h2 {
        font-size: 1.25rem;
    }

    h3 {
        font-size: 1.125rem;
    }

    h4 {
        font-size: 1rem;
    }

    #converter-tool h1 {
        font-size: 1.5rem;
        text-align: center;
        color: #000;
    }

    #converter-tool h2 {
        font-size: 1.25rem;
        color: #ff6b6b;
    }

    .calculator-section h2 {
        font-size: 1.25rem;
        color: #ff6b6b;
    }

    .calculator-section h3 {
        font-size: 1.125rem;
        color: #000;
    }

    #related-tools h3 {
        font-size: 1.125rem;
        color: #000;
    }

    .result-card h4 {
        font-size: 1rem;
    }

    #ad-left, #ad-right, #ad-mobile {
        display: none;
    }

    #ad-tablet, .mobile-tablet-tools {
        display: block;
    }

    .desktop-tools {
        display: none;
    }
    
    .mobile-tablet-tools {
        margin-top: 1.5rem;
    }

    .results-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Desktop Layout (≥1025px) */
@media (min-width: 1025px) {
    .content-wrapper {
        flex-direction: row;
        align-items: flex-start;
    }

    .main-content {
        flex: 1;
    }

    .sidebar {
        width: 300px;
    }

    .left-sidebar {
        order: -1;
    }

    .right-sidebar {
        order: 1;
    }

    #converter-tool h1 {
        font-size: 1.5rem;
        text-align: center;
        color: #000;
    }

    #converter-tool h2 {
        font-size: 1.375rem;
        color: #ff6b6b;
    }

    .calculator-section h2 {
        font-size: 1.375rem;
        color: #ff6b6b;
    }

    .calculator-section h3 {
        font-size: 1.25rem;
        color: #000;
    }

    #related-tools h3 {
        font-size: 1.25rem;
        color: #000;
    }

    #ad-mobile, #ad-tablet, .mobile-tablet-tools {
        display: none;
    }

    #ad-left, #ad-right, .desktop-tools {
        display: block;
    }

    /* Fix sticky sidebar behavior */
    .sidebar {
        display: flex;
        flex-direction: column;
        gap: 1.5rem;
        position: sticky;
        top: 20px;
        align-self: flex-start;
        height: fit-content;
        max-height: calc(100vh - 40px);
        overflow-y: auto;
    }

    /* Make Related Tools sticky for desktop */
    #related-tools.desktop-tools {
        position: sticky;
        top: 20px;
    }

    .results-grid {
        grid-template-columns: repeat(4, 1fr);
    }

    .chart-container {
        height: 400px;
    }
}

/* 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;
    font-size: 1rem;
}

.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;
    }