/* General Wrapper and Layout */
.tcn-calculator-wrapper {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    max-width: 1200px;
    margin: 20px auto;
    padding: 15px;
    background-color: #f8f9fa;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    font-size: 14px;
    color: #333;
}

.tcn-header {
    display: flex;
    flex-wrap: wrap; /* Default: allow wrapping for mobile */
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #e6a085;
}

.tcn-main-title {
    font-size: 22px; /* Mobile first font size */
    font-weight: 700;
    color: #D97757;
    margin: 0 0 10px 0; /* Bottom margin for mobile when it wraps */
    line-height: 1.2;
    flex-basis: 100%; /* Mobile first: title takes full width */
}

@media (min-width: 480px) {
    .tcn-main-title {
        font-size: 26px;
        margin-bottom: 0; /* Reset bottom margin */
        flex-basis: auto; /* Allow title to not take full width on larger screens / tablets */
    }
}

/* Language Slider Toggle - Mobile First Styles */
.tcn-lang-slider-toggle {
    width: 100px;
    height: 36px;
    display: flex;
    align-items: center;
    background-color: #e5e7eb;
    border-radius: 18px;
    padding: 3px;
    cursor: pointer;
    position: relative;
    user-select: none;
    box-shadow: inset 0 1px 3px 0 rgba(0, 0, 0, 0.05);
    margin-left: auto; /* Push to right if title wraps on mobile */
}

.tcn-lang-option-bg {
    width: 50%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 500;
    color: #6b7280;
    z-index: 1;
    transition: color 0.3s ease-in-out;
}

.tcn-lang-thumb {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 47px;
    height: 30px;
    background-color: #D97757;
    border-radius: 15px;
    box-shadow: 0 2px 4px -1px rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.06);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s ease-in-out;
    z-index: 2;
}

.tcn-lang-thumb span {
    font-size: 12px;
    font-weight: 600;
    color: white;
    white-space: nowrap;
}

.tcn-lang-slider-toggle[data-current-lang="zh"] .tcn-lang-thumb {
    transform: translateX(0px);
}
.tcn-lang-slider-toggle[data-current-lang="en"] .tcn-lang-thumb {
    transform: translateX(47px);
}

.tcn-lang-slider-toggle[data-current-lang="zh"] .tcn-lang-option-bg[data-lang="zh"],
.tcn-lang-slider-toggle[data-current-lang="en"] .tcn-lang-option-bg[data-lang="en"] {
    color: transparent;
}
.tcn-lang-slider-toggle[data-current-lang="zh"] .tcn-lang-option-bg[data-lang="en"],
.tcn-lang-slider-toggle[data-current-lang="en"] .tcn-lang-option-bg[data-lang="zh"] {
    color: #6b7280;
}

/* Language Slider - Larger screens (Tablet/Desktop Small) */
@media (min-width: 480px) {
    .tcn-lang-slider-toggle {
        width: 112px;
        height: 40px;
        border-radius: 20px;
        padding: 4px;
    }
    .tcn-lang-option-bg {
        font-size: 14px;
    }
    .tcn-lang-thumb {
        top: 4px;
        left: 4px;
        width: 48px;
        height: 32px;
        border-radius: 16px;
    }
    .tcn-lang-thumb span {
        font-size: 14px;
    }
    .tcn-lang-slider-toggle[data-current-lang="en"] .tcn-lang-thumb {
        transform: translateX(56px); /* Adjusted for larger slider */
    }
}

/* Desktop view specific alignment for header */
@media (min-width: 992px) { /* This breakpoint matches your grid's desktop view */
    .tcn-header {
        flex-wrap: nowrap; /* Prevent title and toggle from wrapping */
    }
    .tcn-main-title {
        flex-grow: 1; /* Title takes available horizontal space */
        flex-shrink: 1; /* Title can shrink if needed, preventing overflow */
        margin-right: 20px; /* Add some space between title and language toggle */
        /* font-size: 26px; and margin-bottom: 0; from 480px breakpoint will apply */
        /* flex-basis: auto; from 480px breakpoint will apply */
    }
    .tcn-lang-slider-toggle {
        flex-shrink: 0; /* Prevent language toggle from shrinking */
        margin-left: 0; /* Reset margin-left from mobile, as space-between will handle positioning */
    }
}


/* Grid for inputs and results */
.tcn-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
}

@media (min-width: 992px) {
    .tcn-grid {
        grid-template-columns: 1fr 1fr;
        gap: 30px;
    }
}

.tcn-column-inputs, .tcn-column-results {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Sections */
.tcn-section {
    background-color: #ffffff;
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 1px 5px rgba(0,0,0,0.08);
}

.tcn-section-title {
    font-size: 18px;
    font-weight: 600;
    color: #D97757;
    margin-top: 0;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #E6A085;
}

/* Form Elements */
.tcn-form-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 15px;
}
@media (min-width: 576px) {
    .tcn-form-grid {
        grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    }
}


.tcn-calculator-wrapper label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    color: #555;
    font-size: 13px;
}
.tcn-calculator-wrapper label.tcn-dim-label {
    display: inline-block;
    margin-right: 5px;
    font-size: 12px;
}


.tcn-calculator-wrapper input[type="number"],
.tcn-calculator-wrapper input[type="text"],
.tcn-calculator-wrapper select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ced4da;
    border-radius: 6px;
    box-sizing: border-box;
    font-size: 14px;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.tcn-calculator-wrapper input:focus,
.tcn-calculator-wrapper select:focus {
    border-color: #D97757;
    box-shadow: 0 0 0 0.2rem rgba(217, 119, 87, 0.25);
    outline: none;
}


.tcn-dimension-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 15px;
}
.tcn-dimension-grid div {
    display: flex;
    align-items: center;
}
.tcn-dimension-grid input[type="number"] {
    flex-grow: 1;
}


.tcn-calculator-wrapper small {
    display: block;
    font-size: 11px;
    color: #6c757d;
    margin-top: 4px;
}

/* Results and Summary */
.tcn-logistics-summary .tcn-summary-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 15px;
}
@media (min-width: 576px) {
    .tcn-logistics-summary .tcn-summary-grid {
        grid-template-columns: 1fr 1fr;
    }
}

.tcn-summary-card, .tcn-price-card {
    background-color: #FFF2EE;
    padding: 15px;
    border-radius: 6px;
    border: 1px solid #E6A085;
}
.tcn-price-card {
    margin-bottom: 15px;
}

.tcn-summary-card h3, .tcn-price-card h3 {
    font-size: 15px;
    color: #D97757;
    margin-top: 0;
    margin-bottom: 10px;
}

.tcn-summary-card p, .tcn-price-card p {
    margin: 5px 0;
    font-size: 13px;
    display: flex;
    justify-content: space-between;
}
.tcn-summary-card p span:last-child,
.tcn-price-card p span:last-child {
    font-weight: 500;
}


.tcn-fill-rate-bar-container {
    margin-top: 10px;
}
.tcn-fill-rate-label {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    margin-bottom: 3px;
}
.tcn-progress-bar {
    width: 100%;
    background-color: #e9ecef;
    border-radius: 10px;
    height: 10px;
    overflow: hidden;
}
.tcn-progress-bar div {
    height: 100%;
    background-color: #D97757;
    border-radius: 10px;
    transition: width 0.3s ease-in-out;
}
.tcn-progress-bar div.overfill {
    background-color: #dc3545;
}

.tcn-warning-message {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
    padding: 10px 15px;
    border-radius: 4px;
    margin-bottom: 15px;
    font-size: 13px;
}
.tcn-warning-message strong {
    font-weight: 600;
}


/* Collapsible Section */
.tcn-collapsible-trigger {
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.tcn-arrow {
    transition: transform 0.3s ease;
    font-size: 16px;
}
.tcn-collapsible-trigger.open .tcn-arrow {
    transform: rotate(180deg);
}
.tcn-collapsible-content {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #eee;
}
.tcn-incoterm-desc {
    background-color: #FFF2EE;
    padding: 12px;
    border-radius: 4px;
    margin-bottom: 10px;
    font-size: 13px;
}
.tcn-incoterm-desc strong {
    color: #D97757;
    display: block;
    margin-bottom: 5px;
    font-size: 14px;
}
.tcn-incoterm-desc p {
    margin: 0;
    color: #444;
}

/* Footer */
.tcn-footer {
    margin-top: 30px;
    padding: 15px;
    text-align: center;
    font-size: 12px;
    color: #6c757d;
    background-color: #FFF2EE;
    border: 1px solid #E6A085;
    border-radius: 6px;
}
.tcn-footer p {
    margin: 0;
}
