.ic-container *,
.ic-container *::before,
.ic-container *::after {
    box-sizing: border-box;
}

.ic-container {
    max-width: 800px;
    margin: 0 auto;
    background-color: white;
    border-radius: 10px;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    color: #333;
    margin-bottom: 40px;
}

.ic-calc-wrap {
    display: flex;
    flex-wrap: wrap;
}

.ic-input-sec,
.ic-result-sec {
    min-width: 300px;
    padding: 5px 20px 25px;
}

.ic-input-sec {
    flex: 1;
    border-right: 1px solid #e1e5eb;
}

.ic-result-sec {
    flex: 1.2;
    /* Make result column slightly wider */
    background-color: white;
}

.ic-heading {
    text-align: center;
    color: #2c3e50;
    padding-top: 5px;
    margin-bottom: 10px;
    margin-top: 5px;
}

.ic-switch-wrap {
    display: flex;
    margin-bottom: 20px;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #ddd;
    flex-wrap: wrap;
    /* Allow buttons to wrap to the next line */
    min-height: 45px;
    /* Reserve space to prevent CLS on wrap */
}

.ic-switch-btn {
    flex: 1;
    padding: 6px;
    font-size: 16px;
    line-height: 1.2;
    text-align: center;
    background-color: #f8f9fa;
    color: #555;
    border: none;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s ease;
    white-space: normal;
    /* Allow text to wrap */
    min-height: 40px;
    /* Ensure a minimum height */
}

.ic-switch-btn.active {
    background-color: #155C8E;
    color: white;
}

.ic-switch-btn:active {
    transform: scale(0.97);
    transition-duration: 0.1s;
}

/* Override theme hover/focus/active styles for buttons */
.ic-switch-btn:not(.active):hover,
.ic-switch-btn:not(.active):focus,
.ic-switch-btn:not(.active):active {
    background-color: #f8f9fa;
    /* Keep original background */
    color: #555;
    /* Keep original text color */
}

.ic-group {
    margin-bottom: 15px;
}

.ic-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: #555;
}

.ic-input-sec input[type="text"],
.ic-input-sec input[type="number"],
.ic-input-sec select {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 16px;
    background-color: #fff;
    font-weight: 500;
}

/* Override theme styles for focus, hover, active states */
.ic-input-sec input[type="text"],
.ic-input-sec input[type="number"],
.ic-input-sec select {
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.ic-input-sec input[type="text"]:focus,
.ic-input-sec input[type="number"]:focus,
.ic-input-sec select:focus {
    border-color: #80bdff;
    /* Highlight border on focus */
    outline: 0;
    box-shadow: 0 0 0 1px rgba(0, 123, 255, .25);
    background-color: #fff;
}

.ic-input-sec .ic-group select,
.ic-input-sec .ic-group input[type="text"],
.ic-input-sec .ic-group input[type="number"] {
    width: 100%;
}

/* Remove number spinner */
input[type=number]::-webkit-inner-spin-button,
input[type=number]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

input[type=number] {
    appearance: textfield;
    -webkit-appearance: none;
    -moz-appearance: textfield;
}

/* Custom arrow for select dropdown */
.ic-group select,
.ic-date-row select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background: url("data:image/svg+xml,%3Csvg width='24' height='24' viewBox='0 0 20 20' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M6 8L10 12L14 8' stroke='%236B7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat right 5px center;
    background-size: 20px 20px;
    padding-right: 30px;
    cursor: pointer;
}

.ic-rate-box {
    display: flex;
    gap: 10px;
    background-color: white;
}

.box-background {
    background-color: white;
}

.ic-rate-box input {
    flex: 3;
}

.ic-rate-box select {
    flex: 1;

}

.ic-date-wrap,
.ic-period-wrap {
    display: none;
    margin-top: 10px;
    margin-bottom: 10px;
}

.ic-date-row {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
}

.ic-date-row select,
.ic-date-row input {
    flex: 1;
}

.ic-period-inputs {
    display: flex;
    gap: 10px;
}

.ic-period-group {
    flex: 1;
}

.ic-period-group label {
    display: block;
    color: #555;
    text-align: center;
    margin-bottom: 5px;
    font-weight: 500;
}

.ic-period-group input {
    text-align: center;
}

.ic-result-item {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
    padding-bottom: 10px;
    border-bottom: 1px dashed #eee;
}

.ic-result-label {
    font-weight: 500;
    color: #555;
}

.ic-result-value {
    font-weight: 500;
    color: #2c3e50;
}

.ic-total {
    margin-top: 10px;
    padding-top: 15px;
    border-top: 2px solid #3498db;
}

.ic-total .ic-result-value {
    color: #165c8a;
    font-size: 1.1rem;
}

#ic-result-head {
    margin-top: 0;
}

.ic-buttons-wrap {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 20px;
}

.ic-download-btn,
.ic-copy-btn,
.ic-clear-btn {
    padding: 8px 13px;
    border: none;
    border-radius: 5px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease-out;
    color: white;
}

.ic-switch-btn:focus,
.ic-download-btn:focus,
.ic-copy-btn:focus,
.ic-download-btn,
.ic-copy-btn,
.ic-clear-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.ic-download-btn {
    background-color: #176326;
}

.ic-download-btn:hover,
.ic-download-btn:focus,
.ic-download-btn {
    background-color: #176326;
    /* Keep original background */
}

.ic-download-btn:active {
    transform: scale(0.95);
}

.ic-copy-btn {
    background-color: #0054B3;
}

.ic-copy-btn:hover,
.ic-copy-btn:focus,
.ic-copy-btn {
    background-color: #0054B3;
    /* Keep original background */
}

.ic-copy-btn:active {
    transform: scale(0.95);
}

.ic-clear-btn {
    background-color: #dc3545;
}

.ic-clear-btn:hover,
.ic-clear-btn:focus,
.ic-clear-btn {
    background-color: #dc3545;
    /* Keep original background */
}

.ic-clear-btn:active {
    transform: scale(0.95);
}

.ic-switch-btn:focus,
.ic-download-btn:focus,
.ic-copy-btn:focus,
.ic-clear-btn:focus {
    box-shadow: none;
    /* Remove focus box-shadow */
}

.ic-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    display: none;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.ic-download-btn.loading .ic-spinner {
    display: block;
}

.ic-download-btn.loading .ic-btn-text {
    margin-right: 8px;
}



.ic-watermark {
    text-align: center;
    margin-top: 15px;
    padding-top: 15px;
    font-size: 14px;
    color: #888;
    border-top: 1px solid #eee;
    display: none;
    /* Hidden by default, shown only for download */
}

.faq-list {
    margin-top: 1rem;
}

.faq-list dt {
    font-weight: 500;
    font-size: 1.1em;
}

.faq-list dd {
    margin-left: 0;
    margin-top: 0.5rem;
    margin-bottom: 1rem;
    padding-left: 1rem;
    padding-bottom: 10px;
    border-bottom: 1px dashed #ddd;
}

@media (max-width: 768px) {

    .ic-container {
        margin: 0;
        margin-bottom: 40px;
        border-radius: 0;
        box-shadow: none;
        border-top: 1px solid #e1e5eb;
        border-bottom: 1px solid #e1e5eb;
    }

    .ic-input-sec,
    .ic-result-sec {
        flex: 100%;
        padding: 5px 1px;
    }

    .ic-input-sec {
        border-right: none;
    }

    #ic-result-head {
        text-align: center;
        margin-top: 0;
    }

    .ic-switch-btn {
        font-size: 15px;
    }

    .ic-switch-wrap {
        width: 100%;
        margin: 0 0 20px 0;
    }

    .ic-input-sec .ic-group select,
    .ic-input-sec .ic-group input[type="text"],
    .ic-input-sec .ic-group input[type="number"],
    .ic-rate-box,
    #ic-compound-group select,
    #ic-compound-group input {
        width: 100%;
        min-width: auto;
        max-width: 100%;
    }

    .ic-result-label {
        flex-shrink: 1;
        /* Allow label to shrink if needed */
    }

    .ic-result-value {
        text-align: right;
        /* Align value to the right */
    }
    
    .ic-buttons-wrap {
        margin-bottom: 20px;
    }
}