/* --- SWP Calculator Plugin Styles --- */
/* This stylesheet is designed to be theme-agnostic. */
/* All styles are scoped within #swp-plugin-container to prevent conflicts. */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

#swp-plugin-container {
    --swp-primary-color: #0052cc;
    --swp-primary-hover: #0041a3;
    --swp-secondary-color: #f0f2f5;
    --swp-secondary-hover: #e1e4e8;
    --swp-text-primary: #1a1d21;
    --swp-text-secondary: #5a6169;
    --swp-border-color: #d0d7de;
    --swp-bg-color: #ffffff;
    --swp-success-color: #1f7a3b;
    --swp-error-color: #d92d20;
    --swp-font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
    
    box-sizing: border-box;
    font-family: var(--swp-font-family);
    line-height: 1.6;
    color: var(--swp-text-primary);
}

#swp-plugin-container *,
#swp-plugin-container *::before,
#swp-plugin-container *::after {
    box-sizing: inherit;
}

.swp-calculator-wrapper {
    min-width: 600px;
    max-width: auto;
    margin: 2rem auto;
    padding: 1rem;
}

.swp-card {
    background-color: var(--swp-bg-color);
    border: 1px solid var(--swp-border-color);
    border-radius: 12px;
    padding: 2rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.swp-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin: 0 0 0.25rem 0;
    color: var(--swp-text-primary);
}

.swp-subtitle {
    font-size: 1rem;
    margin: 0 0 2rem 0;
    color: var(--swp-text-secondary);
}

.swp-grid {
    display: grid;
    gap: 1.5rem;
}

.swp-grid-cols-1 { grid-template-columns: repeat(1, minmax(0, 1fr)); }
@media (min-width: 768px) {
    .md\:swp-grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.swp-input-group {
    display: flex;
    flex-direction: column;
}

.swp-label {
    font-size: 0.9rem;
    font-weight: 500;
    margin-bottom: 0.75rem;
    color: var(--swp-text-secondary);
}

.swp-slider-value {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 0.5rem;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--swp-primary-color);
}

.swp-text-muted {
    font-size: 0.85rem;
    font-weight: 400;
    color: var(--swp-text-secondary);
}

/* --- Custom Slider Styles --- */
.swp-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 8px;
    background: var(--swp-secondary-color);
    border-radius: 5px;
    outline: none;
    transition: opacity .2s;
}

.swp-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    background: var(--swp-primary-color);
    cursor: pointer;
    border-radius: 50%;
    border: 3px solid var(--swp-bg-color);
    box-shadow: 0 0 0 1px var(--swp-border-color);
}

.swp-slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    background: var(--swp-primary-color);
    cursor: pointer;
    border-radius: 50%;
    border: 3px solid var(--swp-bg-color);
    box-shadow: 0 0 0 1px var(--swp-border-color);
}

/* --- Results Section --- */
.swp-results-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--swp-border-color);
}
@media (min-width: 640px) {
    .swp-results-grid { grid-template-columns: repeat(2, 1fr); }
}

.swp-result-box {
    background-color: var(--swp-secondary-color);
    padding: 1.25rem;
    border-radius: 8px;
    text-align: center;
}

.swp-result-title {
    font-size: 0.9rem;
    font-weight: 500;
    margin: 0 0 0.5rem 0;
    color: var(--swp-text-secondary);
}

.swp-result-value {
    font-size: 1.75rem;
    font-weight: 700;
    margin: 0;
    color: var(--swp-success-color);
}
#swp-projected-value.negative {
    color: var(--swp-error-color);
}


/* --- Action Buttons --- */
.swp-action-buttons-container {
    display: flex;
    justify-content: center;
    margin-top: 1.5rem;
}

.swp-btn {
    padding: 0.75rem 1.5rem;
    font-size: 0.95rem;
    font-weight: 600;
    border-radius: 8px;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    text-align: center;
}

.swp-btn-primary {
    background-color: var(--swp-primary-color);
    color: #fff;
}
.swp-btn-primary:hover {
    background-color: var(--swp-primary-hover);
}
.swp-btn-primary.active {
    background-color: var(--swp-primary-hover);
    box-shadow: 0 0 0 3px rgba(0, 82, 204, 0.3);
}

/* --- Visualization & Table --- */
.swp-viz-container {
    margin-top: 2rem;
}

.swp-table-wrapper {
    overflow-x: auto;
    max-height: 400px;
    border: 1px solid var(--swp-border-color);
    border-radius: 8px;
}

.swp-results-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.swp-results-table th,
.swp-results-table td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--swp-border-color);
    font-size: 0.9rem;
}

.swp-results-table th {
    background-color: var(--swp-secondary-color);
    font-weight: 600;
    position: sticky;
    top: 0;
}

.swp-results-table tbody tr:last-child td {
    border-bottom: none;
}

.swp-results-table tbody tr:nth-child(even) {
    background-color: #f8f9fa;
}

.swp-results-table td:nth-child(3),
.swp-results-table td:nth-child(4),
.swp-results-table td:nth-child(5) {
    text-align: right;
}

.swp-hidden {
    display: none;
}