/**
 * PBC Free Tools - Shared Styles
 *
 * Brand Colors:
 * - Primary Red: #F5393B
 * - Hover Red: #d42f31
 * - Light Gray: #F6F6F6
 * - Border Gray: #E5E5E5
 */

/* CSS Custom Properties */
.pbc-calculator {
    --pbc-primary: #F5393B;
    --pbc-primary-hover: #d42f31;
    --pbc-gray: #F6F6F6;
    --pbc-border: #E5E5E5;
    --pbc-dark: #000000;
    --pbc-white: #FFFFFF;
    --pbc-text: #333333;
    --pbc-text-light: #666666;
    --pbc-success: #10B981;
    --pbc-warning: #F59E0B;
    --pbc-error: #EF4444;

    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    max-width: 600px;
    margin: 0 auto;
    background: var(--pbc-white);
    border-radius: 16px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
    overflow: hidden;
}

/* Form Section */
.pbc-calc-form {
    padding: 32px;
}

.pbc-calc-title {
    font-size: 24px;
    font-weight: 700;
    color: var(--pbc-dark);
    margin: 0 0 8px 0;
    text-align: center;
}

.pbc-calc-subtitle {
    font-size: 14px;
    color: var(--pbc-text-light);
    margin: 0 0 32px 0;
    text-align: center;
}

/* Field Styles */
.pbc-calc-field {
    margin-bottom: 24px;
}

.pbc-calc-field label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--pbc-dark);
    margin-bottom: 8px;
}

.pbc-calc-optional {
    font-weight: 400;
    color: var(--pbc-text-light);
    font-size: 12px;
}

.pbc-calc-hint {
    font-size: 12px;
    color: var(--pbc-text-light);
    margin: 8px 0 0 0;
}

/* Input Row */
.pbc-calc-input-row {
    display: flex;
    align-items: center;
    background: var(--pbc-gray);
    border: 1px solid var(--pbc-border);
    border-radius: 8px;
    padding: 0 16px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.pbc-calc-input-row:focus-within {
    border-color: var(--pbc-primary);
    box-shadow: 0 0 0 3px rgba(245, 57, 59, 0.1);
}

.pbc-calc-currency,
.pbc-calc-percent {
    font-size: 16px;
    font-weight: 600;
    color: var(--pbc-text-light);
}

.pbc-calc-input {
    flex: 1;
    border: none;
    background: transparent;
    font-size: 16px;
    font-weight: 600;
    color: var(--pbc-dark);
    padding: 14px 8px;
    outline: none;
    font-family: inherit;
}

.pbc-calc-input::-webkit-outer-spin-button,
.pbc-calc-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.pbc-calc-input[type=number] {
    -moz-appearance: textfield;
}

/* Slider Styles */
.pbc-calc-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 6px;
    background: var(--pbc-border);
    border-radius: 3px;
    outline: none;
    margin: 12px 0 8px 0;
    cursor: pointer;
}

.pbc-calc-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    background: var(--pbc-primary);
    border-radius: 50%;
    cursor: pointer;
    border: 3px solid var(--pbc-white);
    box-shadow: 0 2px 6px rgba(245, 57, 59, 0.3);
    transition: transform 0.15s, box-shadow 0.15s;
}

.pbc-calc-slider::-webkit-slider-thumb:hover {
    transform: scale(1.1);
    box-shadow: 0 3px 10px rgba(245, 57, 59, 0.4);
}

.pbc-calc-slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    background: var(--pbc-primary);
    border-radius: 50%;
    cursor: pointer;
    border: 3px solid var(--pbc-white);
    box-shadow: 0 2px 6px rgba(245, 57, 59, 0.3);
}

.pbc-calc-range-labels {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: var(--pbc-text-light);
}

.pbc-calc-computed {
    font-size: 13px;
    color: var(--pbc-text-light);
    margin-top: 8px;
}

.pbc-calc-computed strong {
    color: var(--pbc-dark);
    font-weight: 600;
}

/* Select Styles */
.pbc-calc-select {
    width: 100%;
    padding: 14px 16px;
    font-size: 16px;
    font-weight: 500;
    color: var(--pbc-dark);
    background: var(--pbc-gray);
    border: 1px solid var(--pbc-border);
    border-radius: 8px;
    cursor: pointer;
    font-family: inherit;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23666666' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
    padding-right: 48px;
}

.pbc-calc-select:focus {
    outline: none;
    border-color: var(--pbc-primary);
    box-shadow: 0 0 0 3px rgba(245, 57, 59, 0.1);
}

/* Checkbox / Toggle */
.pbc-calculator .pbc-calc-toggle {
    display: flex !important;
    align-items: center !important;
    gap: 12px !important;
    cursor: pointer;
    padding: 12px 16px;
    background: var(--pbc-gray);
    border: 1px solid var(--pbc-border);
    border-radius: 8px;
    flex-wrap: nowrap;
}

.pbc-calculator .pbc-calc-toggle input,
.pbc-calculator .pbc-calc-toggle input[type="checkbox"] {
    display: none !important;
    appearance: none !important;
    -webkit-appearance: none !important;
    width: 0 !important;
    height: 0 !important;
    position: absolute !important;
    opacity: 0 !important;
}

.pbc-calculator .pbc-calc-toggle-switch {
    width: 44px !important;
    min-width: 44px !important;
    height: 24px !important;
    background: var(--pbc-border);
    border-radius: 12px;
    position: relative;
    transition: background-color 0.2s;
    flex-shrink: 0;
    display: block !important;
}

.pbc-calculator .pbc-calc-toggle-switch::after {
    content: '' !important;
    position: absolute !important;
    top: 2px !important;
    left: 2px !important;
    width: 20px !important;
    height: 20px !important;
    background: var(--pbc-white) !important;
    border-radius: 50% !important;
    transition: transform 0.2s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.pbc-calculator .pbc-calc-toggle input:checked + .pbc-calc-toggle-switch {
    background: var(--pbc-primary);
}

.pbc-calculator .pbc-calc-toggle input:checked + .pbc-calc-toggle-switch::after {
    transform: translateX(20px);
}

.pbc-calculator .pbc-calc-toggle-label {
    font-size: 14px;
    color: var(--pbc-text);
    flex: 1;
}

/* Calculate Button */
.pbc-calc-btn {
    width: 100%;
    padding: 16px 24px;
    font-size: 16px;
    font-weight: 600;
    color: var(--pbc-white);
    background: linear-gradient(135deg, var(--pbc-primary) 0%, var(--pbc-primary-hover) 100%);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-family: inherit;
    transition: transform 0.15s, box-shadow 0.15s;
    margin-top: 16px;
}

.pbc-calc-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(245, 57, 59, 0.35);
}

.pbc-calc-btn:active {
    transform: translateY(0);
}

.pbc-calc-btn-secondary {
    background: transparent;
    color: var(--pbc-text);
    border: 1px solid var(--pbc-border);
}

.pbc-calc-btn-secondary:hover {
    border-color: var(--pbc-text-light);
    background: var(--pbc-gray);
    box-shadow: none;
    transform: none;
}

/* Results Section */
.pbc-calc-results {
    padding: 0 32px 32px;
}

/* Primary Result Box */
.pbc-calc-result-primary {
    background: linear-gradient(135deg, var(--pbc-primary) 0%, var(--pbc-primary-hover) 100%);
    color: var(--pbc-white);
    padding: 32px;
    border-radius: 12px;
    text-align: center;
    margin-bottom: 24px;
}

.pbc-calc-result-label {
    font-size: 14px;
    font-weight: 500;
    opacity: 0.9;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.pbc-calc-result-value {
    font-size: 48px;
    font-weight: 700;
    line-height: 1.1;
    margin-bottom: 4px;
}

.pbc-calc-result-sublabel {
    font-size: 14px;
    opacity: 0.8;
}

/* Breakdown Section */
.pbc-calc-breakdown {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 24px;
}

.pbc-calc-breakdown-item {
    flex: 1;
    min-width: 120px;
    background: var(--pbc-gray);
    padding: 16px;
    border-radius: 8px;
    text-align: center;
}

.pbc-calc-breakdown-value {
    display: block;
    font-size: 24px;
    font-weight: 700;
    color: var(--pbc-dark);
    margin-bottom: 4px;
}

.pbc-calc-breakdown-label {
    font-size: 12px;
    color: var(--pbc-text-light);
}

/* Summary Cards */
.pbc-calc-summary {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 24px;
}

.pbc-calc-summary-card {
    background: var(--pbc-gray);
    padding: 16px;
    border-radius: 8px;
    text-align: center;
}

.pbc-calc-summary-card.full-width {
    grid-column: span 2;
}

.pbc-calc-summary-label {
    display: block;
    font-size: 12px;
    color: var(--pbc-text-light);
    margin-bottom: 4px;
}

.pbc-calc-summary-value {
    font-size: 18px;
    font-weight: 700;
    color: var(--pbc-dark);
}

/* Status Messages */
.pbc-calc-status {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 16px;
    border-radius: 8px;
    margin-bottom: 24px;
}

.pbc-calc-status-success {
    background: rgba(16, 185, 129, 0.1);
}

.pbc-calc-status-warning {
    background: rgba(245, 158, 11, 0.1);
}

.pbc-calc-status-error {
    background: rgba(239, 68, 68, 0.1);
}

.pbc-calc-status-icon {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pbc-calc-status-success .pbc-calc-status-icon {
    background: var(--pbc-success);
}

.pbc-calc-status-warning .pbc-calc-status-icon {
    background: var(--pbc-warning);
}

.pbc-calc-status-error .pbc-calc-status-icon {
    background: var(--pbc-error);
}

.pbc-calc-status-icon::after {
    content: '';
    display: block;
}

.pbc-calc-status-success .pbc-calc-status-icon::after {
    width: 6px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
    margin-top: -2px;
}

.pbc-calc-status-warning .pbc-calc-status-icon::after,
.pbc-calc-status-error .pbc-calc-status-icon::after {
    content: '!';
    color: white;
    font-weight: 700;
    font-size: 14px;
}

.pbc-calc-status-message {
    font-size: 14px;
    color: var(--pbc-text);
    line-height: 1.5;
}

.pbc-calc-status-message strong {
    font-weight: 600;
}

/* Disclaimer */
.pbc-calc-disclaimer {
    font-size: 12px;
    color: var(--pbc-text-light);
    padding: 16px;
    background: var(--pbc-gray);
    border-radius: 8px;
    margin-bottom: 24px;
    line-height: 1.5;
}

/* Progress Donut */
.pbc-calc-progress {
    text-align: center;
    margin-bottom: 24px;
}

.pbc-calc-progress h4 {
    font-size: 16px;
    font-weight: 600;
    color: var(--pbc-dark);
    margin: 0 0 16px 0;
}

.pbc-calc-donut-wrap {
    position: relative;
    width: 140px;
    height: 140px;
    margin: 0 auto;
}

.pbc-calc-donut {
    width: 100%;
    height: 100%;
}

.pbc-calc-donut-bg {
    stroke: var(--pbc-border);
}

.pbc-calc-donut-fill {
    transition: stroke-dasharray 0.8s ease-out;
}

.pbc-calc-donut-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 28px;
    font-weight: 700;
    color: var(--pbc-dark);
}

.pbc-calc-progress-label {
    font-size: 13px;
    color: var(--pbc-text-light);
    margin: 12px 0 0 0;
}

/* Tax Breakdown Table */
.pbc-calc-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 24px;
}

.pbc-calc-table th,
.pbc-calc-table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--pbc-border);
}

.pbc-calc-table th {
    font-size: 12px;
    font-weight: 600;
    color: var(--pbc-text-light);
    text-transform: uppercase;
    background: var(--pbc-gray);
}

.pbc-calc-table td {
    font-size: 14px;
    color: var(--pbc-dark);
}

.pbc-calc-table tr:last-child td {
    border-bottom: none;
}

.pbc-calc-table .total-row {
    background: var(--pbc-gray);
    font-weight: 600;
}

/* Responsive */
@media (max-width: 768px) {
    .pbc-calc-form,
    .pbc-calc-results {
        padding: 24px;
    }

    .pbc-calc-title {
        font-size: 20px;
    }

    .pbc-calc-result-primary {
        padding: 24px;
    }

    .pbc-calc-result-value {
        font-size: 40px;
    }

    .pbc-calc-breakdown-value {
        font-size: 20px;
    }

    .pbc-calc-donut-wrap {
        width: 120px;
        height: 120px;
    }

    .pbc-calc-donut-text {
        font-size: 24px;
    }
}

@media (max-width: 480px) {
    .pbc-calculator {
        border-radius: 12px;
    }

    .pbc-calc-form,
    .pbc-calc-results {
        padding: 20px;
    }

    .pbc-calc-title {
        font-size: 18px;
    }

    .pbc-calc-result-value {
        font-size: 36px;
    }

    .pbc-calc-breakdown {
        flex-direction: column;
    }

    .pbc-calc-summary {
        grid-template-columns: 1fr;
    }

    .pbc-calc-summary-card.full-width {
        grid-column: span 1;
    }
}
