.crypto-calculator-wrapper {
    --brand-purple-lightest: #f5f3ff;
    --brand-purple-light: #e0e7ff;
    --brand-purple-medium: #2193ee;
    --brand-purple-dark: #2193ee;
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --background-body: #f9fafb;
    --border-color: #d1d5db;
    --white: #ffffff;
    
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    box-sizing: border-box;
    display: flex; /* Added for centering */
    justify-content: center; /* Added for centering */
    width: 100%; /* Ensure it takes full width */
}

.crypto-calculator-wrapper .calculator-container {
    background-color: var(--white);
    border-radius: 24px;
    padding: 32px;
    max-width: 800px;
    width: 100%;
    margin: 2em 0;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
    text-align: left;
}

.crypto-calculator-wrapper .calculator-header h2 {
    font-size: 28px;
    font-weight: 700;
    margin: 0 0 8px 0;
    color: var(--text-primary);
}

.crypto-calculator-wrapper .calculator-header p {
    font-size: 16px;
    color: var(--text-secondary);
    margin: 0 0 32px 0;
    line-height: 1.6;
    max-width: 90%;
}

.crypto-calculator-wrapper .calculator-inputs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    margin-bottom: 40px;
}

.crypto-calculator-wrapper .form-group {
    display: flex;
    flex-direction: column;
}

.crypto-calculator-wrapper .form-group label {
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 8px;
    color: var(--text-secondary);
}

.crypto-calculator-wrapper .input-group {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap; /* Allow buttons to wrap */
}

.crypto-calculator-wrapper .input-field {
    font-family: inherit;
    font-size: 16px;
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    width: 100%;
    transition: border-color 0.2s, box-shadow 0.2s;
    flex-grow: 1;
    min-width: 120px; /* Ensure input field has a minimum width */
}

.crypto-calculator-wrapper .input-field:focus {
    outline: none;
    border-color: var(--brand-purple-medium);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.crypto-calculator-wrapper input[type=number]::-webkit-inner-spin-button,
.crypto-calculator-wrapper input[type=number]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.crypto-calculator-wrapper input[type=number] {
    -moz-appearance: textfield;
}

.crypto-calculator-wrapper .preset-btn,
.crypto-calculator-wrapper .rate-adjust-btn {
    background-color: var(--brand-purple-lightest);
    color: var(--brand-purple-medium);
    border: 1px solid var(--brand-purple-light);
    border-radius: 8px;
    padding: 10px 16px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s, color 0.2s, transform 0.1s;
    flex-shrink: 0; /* Prevent buttons from shrinking */
}

.crypto-calculator-wrapper .preset-btn:hover,
.crypto-calculator-wrapper .rate-adjust-btn:hover {
    background-color: var(--brand-purple-light);
    color: var(--brand-purple-dark);
}

.crypto-calculator-wrapper .preset-btn:active,
.crypto-calculator-wrapper .rate-adjust-btn:active {
    transform: translateY(1px);
}

.crypto-calculator-wrapper .rate-adjust-btn {
    padding: 10px;
    line-height: 1;
    width: 46px;
    height: 46px;
    font-size: 20px;
    display: flex; /* Center +/- */
    justify-content: center;
    align-items: center;
}

.crypto-calculator-wrapper .calculator-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 24px;
    border-top: 1px solid #e5e7eb;
    flex-wrap: wrap; /* Allow items to wrap */
    gap: 24px; /* Gap between results and button when wrapped */
}

.crypto-calculator-wrapper .results-wrapper {
    display: flex;
    gap: 40px;
    align-items: flex-start;
    flex-wrap: wrap; /* Allow result items to wrap */
    flex-grow: 1; /* Allow it to take available space */
}

.crypto-calculator-wrapper .results-header {
    font-size: 16px;
    color: var(--text-secondary);
    margin-bottom: 12px;
    width: 100%; /* Ensure header takes full width */
}

.crypto-calculator-wrapper .result-item .value {
    font-size: 36px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 4px 0;
    white-space: nowrap; /* Prevent numbers from breaking */
}

.crypto-calculator-wrapper .result-item .label {
    font-size: 14px;
    color: var(--text-secondary);
}

.crypto-calculator-wrapper .cta-button {
    background-color: var(--brand-purple-medium);
    color: var(--white) !important;
    border: none;
    border-radius: 8px;
    padding: 14px 28px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    transition: background-color 0.2s, transform 0.1s;
    flex-shrink: 0; /* Prevent button from shrinking */
}

.crypto-calculator-wrapper .cta-button:hover {
    background-color: var(--brand-purple-dark);
}

.crypto-calculator-wrapper .cta-button:active {
    transform: translateY(1px);
}

/* --- Responsive Design --- */

/* Medium screens (e.g., tablets in portrait) */
@media (max-width: 768px) {
    .crypto-calculator-wrapper .calculator-inputs {
        grid-template-columns: 1fr; /* Stack inputs */
        gap: 32px; /* More space between stacked input groups */
    }

    .crypto-calculator-wrapper .input-group {
        flex-wrap: wrap;
        justify-content: flex-start; /* Align items to the start */
    }

    .crypto-calculator-wrapper .input-group .input-field {
        min-width: unset; /* Allow it to take full width */
        width: 100%;
        margin-bottom: 8px; /* Space between input and buttons */
    }
    
    .crypto-calculator-wrapper .input-group .preset-btn {
        flex-basis: calc(33.33% - 8px); /* 3 buttons per row on small screen */
        max-width: calc(33.33% - 8px);
        box-sizing: border-box;
    }

    .crypto-calculator-wrapper .input-group .rate-adjust-btn {
        width: 48px;
        height: 48px;
        font-size: 22px;
    }
    
    .crypto-calculator-wrapper .calculator-footer {
        flex-direction: column;
        align-items: flex-start; /* Align profit/ROI to left */
    }

    .crypto-calculator-wrapper .results-wrapper {
        width: 100%;
        justify-content: space-between; /* Space out profit and ROI */
    }

    .crypto-calculator-wrapper .cta-button {
        width: 100%;
        text-align: center;
        padding: 16px 28px; /* Slightly larger touch target */
    }
}

/* Small screens (e.g., mobile phones) */
@media (max-width: 500px) {
    .crypto-calculator-wrapper .calculator-container {
        padding: 24px;
        border-radius: 16px;
    }

    .crypto-calculator-wrapper .calculator-header h2 {
        font-size: 24px;
    }

    .crypto-calculator-wrapper .calculator-header p {
        font-size: 15px;
        margin-bottom: 24px;
        max-width: 100%;
    }
    
    .crypto-calculator-wrapper .calculator-inputs {
        gap: 24px;
        margin-bottom: 32px;
    }

    .crypto-calculator-wrapper .input-group {
        flex-direction: row; /* Keep buttons in a row for now */
        flex-wrap: wrap; /* Allow wrapping */
        gap: 6px; /* Smaller gap */
    }

    .crypto-calculator-wrapper .input-group .preset-btn {
        flex-basis: calc(33.33% - 4px); /* Three buttons per row */
        max-width: calc(33.33% - 4px);
        padding: 8px 10px;
        font-size: 13px;
    }

    .crypto-calculator-wrapper .input-group .input-field {
        margin-bottom: 12px;
    }

    .crypto-calculator-wrapper .results-wrapper {
        flex-direction: column; /* Stack profit and ROI */
        gap: 24px;
        align-items: flex-start;
    }

    .crypto-calculator-wrapper .result-item .value {
        font-size: 32px;
    }

    .crypto-calculator-wrapper .result-item .label {
        font-size: 13px;
    }
}

/* Extra small screens (very narrow phones) */
@media (max-width: 375px) {
    .crypto-calculator-wrapper .calculator-header h2 {
        font-size: 22px;
    }
    .crypto-calculator-wrapper .input-group .preset-btn {
        flex-basis: calc(50% - 4px); /* Two buttons per row */
        max-width: calc(50% - 4px);
    }
}

