: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: 0px 10px;
}

.calculator-layout {
    display: flex;
    flex-direction: column;
    margin: 0;
}

.main-content {
    flex: 1;
}

.sidebar {
    width: 100%;
}

.ad-container {
    background-color: white;
    border: 1px solid var(--border-color);
    padding: 10px;
    margin-bottom: 20px;
    text-align: center;
    border-radius: 4px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    color: #000;
}

#ad-left, #ad-right {
    display: none;
}

#ad-tablet {
    display: none;
}

#ad-mobile {
    display: block;
    width: 320px;
    height: 100px;
    margin: 0 auto;
    background-color: #e9ecef;
    line-height: 100px;
    color: #000;
}

/* Related Tools Styles */
#related-tools {
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.05);
    color: #000;
}

.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);
}

h1 {
    font-size: 1.25rem;
    margin-bottom: 20px;
    color: #000;
    text-align: center;
}

h2 {
    font-size: 1.125rem;
    margin: 15px 0 10px;
    color: #ff6b6b;
}

h3 {
    font-size: 1rem;
    margin: 10px 0;
    color: #000;
}

h4 {
    font-size: 1.125rem;
    margin: 10px 0;
    color: #000;
}

.calculator-section {
    background-color: white;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 15px;
    margin-bottom: 15px;
    margin-top: 0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    color: #000;
}

.input-group {
    margin-bottom: 15px;
}

.input-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
    color: #000;
}

.input-group input, .input-group select {
    width: 100%;
    padding: 8px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-family: inherit;
    font-size: 1rem;
    color: #000;
}

/* Toggle Switch Styles */
.toggle-group {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
    color: #000;
}

.toggle {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 24px;
    margin-right: 10px;
}

.toggle 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);
}

.button-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin: 20px 0;
}

button {
    padding: 12px 15px;
    border: none;
    border-radius: 4px;
    font-family: inherit;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.3s;
    width: 100%;
}

#calculate-btn {
    background-color: #4ecdc4;
    color: white;
}

#reset-btn {
    background-color: #ff6b6b;
    color: white;
}

#calculate-btn:hover {
    background-color: #3bb5af;
}

#reset-btn:hover {
    background-color: #ff5252;
}

.spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255,255,255,.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
    margin-right: 10px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.results-section {
    background-color: white;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 15px;
    margin-top: 0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    display: none;
    color: #000;
}

.result-item {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid var(--border-color);
    color: #000;
}

.result-item:last-child {
    border-bottom: none;
}

.export-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 15px;
}

.export-btn {
    background-color: var(--accent);
    color: white;
    padding: 10px 12px;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s;
    width: 100%;
    font-size: 1rem;
}

.export-btn:hover {
    background-color: #345178;
}

.chart-container {
    margin: 20px 0;
    padding: 15px;
    background-color: white;
    border-radius: 4px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    display: none;
    color: #000;
}

.chart-wrapper {
    position: relative;
    height: 300px;
    margin: 0 auto;
}

/* Mobile and Tablet Related Tools */
#related-tools-mobile {
    display: none;
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.05);
    margin-top: 0;
    color: #000;
}

/* 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;
}

/* Time format specific styles */
.time-input-wrapper {
    position: relative;
    width: 100%;
}

.custom-time-input {
    display: none;
    gap: 3px;
    align-items: center;
    width: 100%;
    flex-wrap: wrap;
}

.custom-time-input input {
    flex: 1;
    text-align: center;
    padding: 8px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-family: inherit;
    font-size: 1rem;
    min-width: 0;
    color: #000;
}

.custom-time-input input::placeholder {
    color: #999;
    opacity: 1;
}

.custom-time-input input:focus::placeholder {
    opacity: 0.5;
}

.custom-time-input select {
    flex: 1;
    padding: 8px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-family: inherit;
    font-size: 1rem;
    min-width: 0;
    color: #000;
}

.custom-time-input span {
    color: var(--text-light);
    font-weight: bold;
}

.time-input-wrapper.show-custom .custom-time-input {
    display: flex;
}

.time-input-wrapper.show-custom input[type="time"] {
    display: none;
}

/* Fix for number input appearance */
.custom-time-input input[type="number"] {
    -moz-appearance: textfield;
}

.custom-time-input input[type="number"]::-webkit-outer-spin-button,
.custom-time-input input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* Ensure proper sizing for time inputs - updated for seconds */
.custom-time-input input {
    width: 50px;
}

.custom-time-input select {
    width: 70px;
}

/* For 24-hour format with seconds */
.time-input-24hour {
    display: none;
    gap: 3px;
    align-items: center;
    width: 100%;
}

.time-input-24hour input {
    width: 50px;
    text-align: center;
    padding: 8px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-family: inherit;
    font-size: 1rem;
    color: #000;
}

.time-input-wrapper.show-24hour .time-input-24hour {
    display: flex;
}

.time-input-wrapper.show-24hour input[type="time"] {
    display: none;
}

/* Tablet Layout */
@media (min-width: 768px) and (max-width: 1024px) {
    h1 {
        font-size: 1.5rem;
    }

    h2 {
        font-size: 1.25rem;
    }

    h3 {
        font-size: 1.125rem;
    }

    h4 {
        font-size: 1rem;
    }

    #ad-mobile, #ad-left, #ad-right {
        display: none;
    }

    #ad-tablet {
        display: block;
        width: 300px;
        height: 250px;
        margin: 10px auto 0;
        background-color: #e9ecef;
        line-height: 250px;
        color: #000;
    }

    .calculator-section {
        padding: 20px;
        margin-top: 0;
    }

    .time-inputs {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 15px;
    }

    .button-group {
        flex-direction: row;
    }

    .export-options {
        flex-direction: row;
    }

    .chart-wrapper {
        height: 250px;
    }

    /* Adjust time input sizes for tablet */
    .custom-time-input input,
    .time-input-24hour input {
        width: 45px;
    }

    .custom-time-input select {
        width: 65px;
    }

    /* Hide desktop related tools on tablet */
    .left-sidebar #related-tools {
        display: none;
    }

    /* Show mobile/tablet related tools */
    #related-tools-mobile {
        display: block;
        margin-top: 20px;
    }
}

/* Mobile Layout */
@media (max-width: 767px) {
    h1 {
        font-size: 1.25rem;
    }

    h2 {
        font-size: 1.125rem;
    }

    h3 {
        font-size: 1rem;
    }

    h4 {
        font-size: 0.9375rem;
    }

    /* Hide desktop related tools on mobile */
    .left-sidebar #related-tools {
        display: none;
    }

    /* Show mobile/tablet related tools */
    #related-tools-mobile {
        display: block;
        margin-top: 20px;
    }

    /* Adjust time input sizes for mobile */
    .custom-time-input,
    .time-input-24hour {
        gap: 2px;
    }

    .custom-time-input input,
    .time-input-24hour input {
        width: 40px;
        padding: 6px;
        font-size: 0.875rem;
    }

    .custom-time-input select {
        width: 60px;
        padding: 6px;
        font-size: 0.875rem;
    }
}

/* Desktop Layout */
@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;
        gap: 20px;
        margin: 0px;
    }

    .sidebar {
        width: 300px;
    }

    #ad-left, #ad-right {
        display: block;
    }

    #ad-mobile, #ad-tablet {
        display: none;
    }

    #ad-left {
        width: 300px;
        height: 250px;
        background-color: #e9ecef;
        line-height: 250px;
        margin-bottom: 20px;
        color: #000;
    }

    #ad-right {
        width: 300px;
        height: 600px;
        background-color: #e9ecef;
        line-height: 600px;
        color: #000;
    }

    .left-sidebar, .right-sidebar {
        position: sticky;
        top: 20px;
        align-self: flex-start;
    }

    .calculator-section {
        padding: 25px;
        margin-top: 0;
    }

    .time-inputs {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 20px;
    }

    .options-grid {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 15px;
    }

    .button-group {
        flex-direction: row;
    }

    .export-options {
        flex-direction: row;
    }

    .chart-wrapper {
        height: 300px;
        max-width: 400px;
    }

    /* Hide mobile/tablet related tools on desktop */
    #related-tools-mobile {
        display: none;
    }
}

.mobile-table {
    overflow-x: auto;
    margin: 20px 0;
    border: 1px solid #eee;
    border-radius: 8px;
    color: #000;
}

.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 tr:nth-child(even) {
    background-color: #fafafa;
}