: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;
    font-family: 'Times New Roman', Times, serif;
}

body {
    font-size: 1rem;
    line-height: 1.6;
    color: #000;
    background-color: var(--light-bg);
    padding: 0;
    margin: 0;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 10px;
}

h1 {
    font-size: 1.25rem;
    margin-bottom: 1rem;
    color: #000;
    text-align: center;
}

h2 {
    font-size: 1.125rem;
    margin-bottom: 0.75rem;
    color: #ff6b6b;
}

h3 {
    font-size: 1rem;
    margin-bottom: 0.5rem;
    color: #000;
}

.card {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.form-group {
    margin-bottom: 1rem;
}

label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: bold;
    color: #000;
}

select, input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-family: 'Times New Roman', Times, serif;
    font-size: 1rem;
    color: #000;
}

.btn {
    padding: 0.75rem 1.5rem;
    background-color: var(--accent);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-family: 'Times New Roman', Times, serif;
    font-size: 1rem;
    transition: background-color 0.3s;
}

.btn:hover {
    background-color: var(--primary);
}

.btn-secondary {
    background-color: #ff6b6b;
}

.btn-secondary:hover {
    background-color: #e55a5a;
}

.btn-export {
    background-color: var(--teal);
    margin: 0 0.25rem;
}

.btn-export:hover {
    background-color: #3dbbaf;
}

.btn-group {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
    justify-content: center;
}

.export-group {
    display: flex;
    justify-content: center;
    margin-top: 1rem;
    gap: 0.5rem;
}

.result {
    margin-top: 1.5rem;
    padding: 1rem;
    background-color: var(--light-bg);
    border-left: 4px solid var(--teal);
    color: #000;
}

.solution-steps {
    margin-top: 1rem;
    padding: 1rem;
    background-color: var(--light-bg);
    border-radius: 4px;
    color: #000;
}

/* Updated Ad Container Styles */
.ad-container {
    background-color: white;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 1.5rem;
    border-radius: 4px;
    overflow: hidden;
    color: #000;
    font-family: 'Times New Roman', Times, serif;
    border: 1px solid var(--border-color);
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.ad-container p {
    padding: 1rem;
    text-align: center;
    color: #000;
}

#ad-left .ad-container {
    width: 300px;
    height: 250px;
}

#ad-right .ad-container {
    width: 300px;
    height: 600px;
}

#ad-tablet .ad-container {
    width: 300px;
    height: 250px;
    margin: 0 auto;
}

#ad-mobile .ad-container {
    width: 320px;
    height: 100px;
    margin: 0 auto;
}

#ad-left, #ad-right {
    display: none;
}

#related-tools {
    display: block;
}

#ad-tablet {
    display: none;
}

#ad-mobile {
    display: block;
}

/* Related Tools Styles - Updated to match instructions */
#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;
}

.tools-list a:hover {
    color: var(--teal);
}

.mode-selector {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    justify-content: center;
}

.mode-btn {
    padding: 0.5rem 1rem;
    background-color: var(--light-bg);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    cursor: pointer;
    font-family: 'Times New Roman', Times, serif;
    color: #000;
}

.mode-btn.active {
    background-color: var(--accent);
    color: white;
    border-color: var(--accent);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

.advanced-toggle {
    margin-top: 1rem;
    cursor: pointer;
    color: #000;
    font-weight: bold;
    font-family: 'Times New Roman', Times, serif;
    text-align: center;
}

.advanced-content {
    display: none;
    margin-top: 1rem;
    padding: 1rem;
    background-color: var(--light-bg);
    border-radius: 4px;
    border-left: 3px solid var(--teal);
    color: #000;
}

.advanced-content.show {
    display: block;
}

.tooltip {
    position: relative;
    display: inline-block;
    border-bottom: 1px dotted var(--text-light);
    cursor: help;
    color: #000;
}

.tooltip .tooltiptext {
    visibility: hidden;
    width: 250px;
    background-color: var(--primary);
    color: white;
    text-align: center;
    border-radius: 6px;
    padding: 10px;
    position: absolute;
    z-index: 1;
    bottom: 125%;
    left: 50%;
    margin-left: -125px;
    opacity: 0;
    transition: opacity 0.3s;
    font-size: 0.875rem;
    font-family: 'Times New Roman', Times, serif;
    line-height: 1.4;
}

.tooltip:hover .tooltiptext {
    visibility: visible;
    opacity: 1;
}

/* Mobile Layout */
@media (max-width: 767px) {
    /* Mobile Ad above Related Tools */
    #ad-mobile {
        order: -1;
    }
    
    #related-tools-mobile {
        order: 1;
    }

    h1 {
        font-size: 1.25rem;
    }
    
    h2 {
        font-size: 1.125rem;
        color: #ff6b6b;
    }
    
    h3 {
        font-size: 1rem;
    }
}

/* Tablet Layout */
@media (min-width: 768px) and (max-width: 1024px) {
    h1 {
        font-size: 1.5rem;
    }
    
    h2 {
        font-size: 1.25rem;
        color: #ff6b6b;
    }
    
    h3 {
        font-size: 1.125rem;
    }
    
    #ad-mobile {
        display: none;
    }
    
    #ad-tablet {
        display: block;
        margin-top: 10px;
    }
    
    .calculator-content {
        display: grid;
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .ad-container {
        min-height: 250px;
    }

    /* Tablet Ad above Related Tools */
    #ad-tablet {
        order: -1;
    }
    
    #related-tools-mobile {
        order: 1;
    }
}

/* Desktop Layout */
@media (min-width: 1025px) {
    h1 {
        font-size: 1.5rem;
    }
    
    h2 {
        font-size: 1.375rem;
        color: #ff6b6b;
    }
    
    h3 {
        font-size: 1.25rem;
    }
    
    #ad-mobile, #ad-tablet {
        display: none;
    }
    
    #ad-left, #ad-right {
        display: block;
    }
    
    .calculator-content {
        display: grid;
        grid-template-columns: 300px 1fr 300px;
        gap: 1.5rem;
    }
    
    .ad-container {
        min-height: 250px;
        margin-bottom: 1.5rem;
    }
    
    #ad-right .ad-container {
        min-height: 600px;
    }

    /* Make all sidebar elements sticky */
    #ad-left, #ad-right, #related-tools {
        position: sticky;
        top: 20px;
        align-self: start;
    }

    /* Remove the duplicate related tools in main content */
    #related-tools-mobile {
        display: none;
    }
}

/* Hidden report container for exports */
#report-container {
    position: absolute;
    left: -9999px;
    width: 800px;
    background: white;
    padding: 20px;
}

/* PDF-specific styles */
.pdf-container {
    width: 800px;
    background: white;
    padding: 20px;
    font-family: 'Times New Roman', Times, serif;
    color: #000;
}

.pdf-header {
    color: #000;
    text-align: center;
    margin-bottom: 20px;
    border-bottom: 2px solid #3d5a80;
    padding-bottom: 10px;
}

.pdf-result {
    background-color: #f8f9fa;
    padding: 15px;
    border-left: 4px solid #4ecdc4;
    margin-bottom: 20px;
    color: #000;
}

.pdf-steps {
    background-color: #f0f0f0;
    padding: 15px;
    border-radius: 5px;
    margin-bottom: 20px;
    white-space: pre-line;
    color: #000;
}

.pdf-footer {
    text-align: center;
    color: #000;
    margin-top: 30px;
}

.warning {
    color: #000;
    background-color: #f8d7da;
    padding: 10px;
    border-radius: 4px;
    margin-top: 10px;
    border-left: 4px solid #d9534f;
}

/* Substance-dependent field styles */
.substance-dependent {
    display: none;
}

/* Result unit selector */
.result-unit-selector {
    margin-top: 1rem;
    padding: 1rem;
    background-color: var(--light-bg);
    border-radius: 4px;
    border-left: 3px solid var(--teal);
    color: #000;
}

/* 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;
    font-size: 1rem;
    color: #000;
}

.mobile-table th {
    background-color: #4ecdc4;
    font-weight: bold;
}

.mobile-table tr:nth-child(even) {
    background-color: #fafafa;
}