/* Import Manrope Font (already enqueued in PHP, this is a fallback/reminder) */
@import url('https://fonts.googleapis.com/css2?family=Manrope:wght@400;700&display=swap');

/* --- Variable Definitions (CSS Custom Properties) --- */
:root {
    --usinvest-primary-color: #4E7387;
    --usinvest-secondary-color: #6a9cb7;
    --usinvest-dark-color: #233741;
    --usinvest-highlight-color: #ff4d37;
    --usinvest-red-color: #96151d;
    --usinvest-text-color: #333;
    --usinvest-light-bg: #f8f9fa;
    --usinvest-font-family: 'Manrope', sans-serif;
}

/* --- General Styles --- */
.usinvest-container {
    font-family: var(--usinvest-font-family);
    color: var(--usinvest-text-color);
    background-color: #fff; /* Or a very light grey for slight contrast from page */
    padding: 20px;
    border-radius: 5px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    margin-bottom: 20px;
}

.usinvest-container h2 {
    color: var(--usinvest-dark-color);
    text-align: left;
    margin-bottom: 65px;
    font-weight: 500;
}

.usinvest-container h3 {
    color: var(--usinvest-primary-color);
    margin-top: 0;
    margin-bottom: 15px;
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
    font-weight: 500;
}

/* --- Layout Containers --- */
#usinvest-top-container {
    display: flex;
    flex-wrap: wrap; /* Allow wrapping for responsiveness */
    gap: 20px; /* Space between left and right containers */
    margin-bottom: 20px;
}

#usinvest-input-container {
    flex: 1; /* Take up available space */
    min-width: 300px; /* Minimum width before wrapping */
    padding-right: 20px; /* Spacing if side-by-side */
    border-right: 1px solid #eee;
}
#usinvest-input-container:last-child { /* If it's the only child (when metrics is below) */
    border-right: none;
    padding-right: 0;
}


#usinvest-metrics-container {
    flex: 1;
    min-width: 280px;
}

#usinvest-chart-container {
    width: 100%;
    margin-bottom: 20px;
    min-height: 450px; /* Ensure chart has some space */
}

/* --- Input Groups and Fields --- */
.usinvest-input-group {
    margin-bottom: 15px;
}

.usinvest-input-group label {
    display: block;
    margin-bottom: 6px;
    font-size: 14px;
    color: var(--usinvest-dark-color);
    font-weight: 700;
}

.usinvest-input-group input[type="date"],
.usinvest-input-group input[type="number"],
.usinvest-input-group input[type="text"] {
    width: 100%; /* Make inputs take available width within their group */
    max-width: 120px; /* Max width for typical inputs */
    padding: 4px 1px; /* Adjusted padding */
    font-size: 14px; /* Slightly larger for readability */
    background-color: rgba(78, 115, 135, 0.05); /* 5-10% primary */
    border: none;
    border-bottom: 1.5px solid var(--usinvest-primary-color);
    border-radius: 3px 3px 0 0; /* Slight rounding at top */
    transition: border-color 0.3s ease, background-color 0.3s ease;
    box-sizing: border-box;
}
.usinvest-input-group input[type="text"]#usinvest-initial-investment,
.usinvest-input-group input[type="text"]#usinvest-recurring-investment,
.usinvest-input-group input[type="text"]#usinvest-withdrawal-value {
    width: 120px; /* Specific width for these amount inputs */
}


.usinvest-input-group input[type="date"]:focus,
.usinvest-input-group input[type="number"]:focus,
.usinvest-input-group input[type="text"]:focus {
    border-bottom-color: var(--usinvest-highlight-color);
    background-color: rgba(78, 115, 135, 0.08);
    outline: none;
}

.usinvest-radio-group label {
    font-weight: normal;
    margin-right: 15px;
    font-size: 13px;
    display: inline-flex; /* Align checkbox and text */
    align-items: center;
}
.usinvest-radio-group input[type="radio"] {
    margin-right: 5px;
    accent-color: var(--usinvest-primary-color); /* Modern way to color radios/checkboxes */
}
#usinvest-withdrawal-value-unit {
    margin-left: 5px;
    font-size: 13px;
    color: var(--usinvest-dark-color);
}

/* --- Buttons --- */
#usinvest-asset-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 10px;
}

.usinvest-asset-button,
#usinvest-more-metrics-toggle {
    background-color: var(--usinvest-primary-color);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 3px;
    cursor: pointer;
    font-size: 13px;
    font-family: var(--usinvest-font-family);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: background-color 0.2s ease, transform 0.1s ease, box-shadow 0.2s ease;
}

.usinvest-asset-button:hover,
#usinvest-more-metrics-toggle:hover {
    background-color: var(--usinvest-dark-color);
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.15);
}

.usinvest-asset-button.active, /* For selected asset */
.usinvest-asset-button:active, /* For click press */
#usinvest-more-metrics-toggle:active {
    background-color: var(--usinvest-highlight-color);
    transform: translateY(1px);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

/* --- Metrics Display --- */
#usinvest-metrics-results p {
    margin: 0 0 10px 0;
    font-size: 14px;
    line-height: 1.6;
}
#usinvest-metrics-results span {
    font-weight: 700;
    color: var(--usinvest-primary-color);
}
#usinvest-selected-asset-name-metrics {
    font-weight: normal;
    color: var(--usinvest-highlight-color);;
}

/* --- More Metrics Table --- */
#usinvest-more-metrics-toggle {
    display: block; /* Make it full width available */
    width: 100%;
    margin-bottom: 10px;
    text-align: left;
}
.usinvest-arrow {
    font-size: 20px;
    float: right;
    transition: transform 0.3s ease;
}
.usinvest-arrow.up {
    transform: rotate(180deg);
}

#usinvest-more-metrics-table-wrapper {
    overflow-x: auto; /* For responsiveness on small screens */
}

#usinvest-more-metrics-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
    font-size: 13px;
}

#usinvest-more-metrics-table th {
    border: 1px solid #ddd;
    padding: 8px;
    text-align: center;
}


#usinvest-more-metrics-table td {
    border: 1px solid #ddd;
    padding: 8px;
    text-align: right;
}

#usinvest-more-metrics-table th {
    background-color: var(--usinvest-secondary-color);
    color: white;
    font-weight: 700;
}

#usinvest-more-metrics-table tbody tr:nth-child(even) {
    background-color: var(--usinvest-light-bg);
}
#usinvest-more-metrics-table tbody tr:hover {
    background-color: rgba(106, 156, 183, 0.15); /* Light secondary hover */
}

/* --- Loader and Error Messages --- */
.usinvest-loader {
    text-align: center;
    padding: 15px;
    font-size: 14px;
    color: var(--usinvest-primary-color);
}
.usinvest-error-message {
    background-color: rgba(150, 21, 29, 0.1); /* Light red */
    color: var(--usinvest-red-color);
    padding: 10px 15px;
    border: 1px solid var(--usinvest-red-color);
    border-radius: 3px;
    margin-top: 15px;
    font-size: 14px;
}


/* --- Responsive Adjustments --- */
@media (max-width: 768px) {
    #usinvest-top-container {
        flex-direction: column; /* Stack input and metrics containers */
    }
    #usinvest-input-container {
        padding-right: 0;
        border-right: none;
        margin-bottom: 20px; /* Add space when stacked */
    }
    .usinvest-input-group input[type="date"],
    .usinvest-input-group input[type="number"],
    .usinvest-input-group input[type="text"] {
        max-width: 100%; /* Allow inputs to take full width on mobile */
    }
    .usinvest-input-group input[type="text"]#usinvest-initial-investment,
    .usinvest-input-group input[type="text"]#usinvest-recurring-investment,
    .usinvest-input-group input[type="text"]#usinvest-withdrawal-value {
        width: 150px; /* Give a bit more space on mobile if possible */
    }
}