/* 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);
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 10px;
}

/* 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;
}

/* Main Layout - Mobile First (Stacked) */
.calculator-layout {
    display: flex;
    flex-direction: column;
    gap: 0 20px;
}

/* Calculator Tool */
#converter-tool {
    background: white;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

/* Form Elements */
.form-group {
    margin-bottom: 15px;
}

label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
    color: #000;
}

input, select, textarea {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-family: inherit;
    font-size: 1rem;
    color: #000;
}

button {
    background-color: var(--accent);
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: 4px;
    cursor: pointer;
    font-family: inherit;
    font-size: 1rem;
    transition: background-color 0.3s;
}

button:hover {
    background-color: var(--primary);
}

.btn-secondary {
    background-color: var(--secondary);
}

.btn-secondary:hover {
    background-color: #e55c5c;
}

.btn-teal {
    background-color: var(--teal);
}

.btn-teal:hover {
    background-color: #3db8af;
}

/* Ad Zones */
.ad-zone {
    background-color: #f0f0f0;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px dashed var(--border-color);
    color: var(--text-light);
    font-style: italic;
    text-align: center;
}

#ad-mobile {
    width: 320px;
    height: 100px;
    margin: 20px auto 0;
}

#ad-tablet {
    width: 300px;
    height: 250px;
    margin: 20px auto 0;
}

#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);
    margin-top: 20px;
}

.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);
}

/* Tabs for Calculator Functions */
.tabs {
    display: flex;
    flex-wrap: wrap;
    margin-bottom: 15px;
    border-bottom: 1px solid var(--border-color);
}

.tab {
    padding: 8px 15px;
    cursor: pointer;
    margin-right: 5px;
    border-radius: 4px 4px 0 0;
    font-size: 0.875rem;
    color: #000;
}

.tab.active {
    background-color: var(--accent);
    color: white;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Result Display */
.result-container {
    margin-top: 20px;
    border-top: 1px solid var(--border-color);
    padding-top: 15px;
}

.result {
    background-color: var(--light-bg);
    padding: 15px;
    border-radius: 4px;
    margin-bottom: 15px;
    font-family: monospace;
    word-break: break-all;
    min-height: 60px;
    white-space: pre-wrap;
    color: #000;
}

.export-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.export-buttons button {
    flex: 1;
    min-width: 120px;
}

/* Spinner */
.spinner {
    display: none;
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s linear infinite;
    margin-right: 8px;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.button-content {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Utility Classes */
.hidden {
    display: none !important;
}

.flex-row {
    display: flex;
    gap: 10px;
}

.sticky {
    position: sticky;
    top: 20px;
}

/* History Section */
.history-container {
    margin-top: 20px;
    border-top: 1px solid var(--border-color);
    padding-top: 15px;
}

.history-list {
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 10px;
    background-color: white;
}

.history-item {
    padding: 8px;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    color: #000;
}

.history-item:last-child {
    border-bottom: none;
}

.history-item:hover {
    background-color: var(--light-bg);
}

/* Tablet breakpoint (768px - 1024px) */
@media (min-width: 768px) {
    .tabs {
        flex-wrap: nowrap;
        overflow-x: auto;
        white-space: nowrap;
    }
    
    .tab {
        flex: 1;
        text-align: center;
        margin-right: 0;
        border-radius: 0;
        border-bottom: 2px solid transparent;
        font-size: 1rem;
    }
    
    .tab:first-child {
        border-radius: 4px 0 0 0;
    }
    
    .tab:last-child {
        border-radius: 0 4px 0 0;
    }
    
    .tab.active {
        border-bottom: 2px solid var(--secondary);
        background-color: transparent;
        color: var(--primary);
    }

    h1 {
        font-size: 1.5rem;
    }

    h2 {
        font-size: 1.25rem;
    }

    h3 {
        font-size: 1.125rem;
    }

    h4 {
        font-size: 1rem;
    }

    .calculator-layout {
        flex-direction: column;
    }

    .form-row {
        display: flex;
        gap: 15px;
    }

    .form-row .form-group {
        flex: 1;
    }
}

/* Desktop Layout (≥1025px) */
@media (min-width: 1025px) {
    .calculator-layout {
        flex-direction: row;
        align-items: flex-start;
        gap: 20px;
    }

    .sidebar {
        width: 300px;
        flex-shrink: 0;
    }

    .main-content {
        flex: 1;
    }

    /* Make sidebars sticky */
    .left-sidebar,
    .right-sidebar {
        position: sticky;
        top: 20px;
        height: fit-content;
        overflow-y: auto;
    }

    /* Style the left sidebar content */
    .left-sidebar {
        display: flex;
        flex-direction: column;
        gap: 20px;
    }

    /* Remove individual sticky positioning - let the sidebar handle it */
    #ad-left,
    #related-tools-desktop,
    #ad-right {
        position: static;
    }

    /* Remove margin from related tools in desktop */
    #related-tools-desktop #related-tools {
        margin-top: 0;
    }

    /* Enhanced desktop layout for better horizontal tab display */
    .tabs {
        overflow-x: visible;
    }
    
    .tab {
        min-width: 150px;
    }

    h2 {
        font-size: 1.375rem;
    }

    h3 {
        font-size: 1.25rem;
    }

    h4 {
        font-size: 1.125rem;
    }
}

/* 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;
}