/**
 * Supup Donation Tax Deduction — styles.
 *
 * Covers three surfaces:
 *   - Inline DTD area injected under the donation amount (.dtd-area)
 *   - Standalone shortcode calculator (.dtd-shortcode-calc)
 *   - WP/Elementor widget calculator (.dtd-widget)
 *
 * @package SupupDonationTaxDeduction
 */

/* ==========================================================================
   Inline area
   ========================================================================== */

.dtd-area {
    margin-top: 8px;
    margin-bottom: 10px;
}

.dtd-area .dtd-deduction,
.dtd-area .dtd-encouragement {
    padding: 10px 15px;
    border-radius: 6px;
    font-size: 0.9em;
    text-align: center;
    transition: opacity 0.3s ease;
    margin: 5px 0;
}

.dtd-area .dtd-encouragement {
    background-color: #e7f3ff;
    border: 1px solid #b3d9ff;
    color: #0056b3;
}

.dtd-area .dtd-deduction {
    background-color: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
}

.dtd-area .dtd-message-text {
    font-weight: 500;
    line-height: 1.4;
    display: inline-block;
}

.wc-donation-frontend-form .dtd-area {
    border-top: 1px solid #e0e0e0;
    padding-top: 10px;
    margin-top: 15px;
}

/* ==========================================================================
   Shortcode calculator
   ========================================================================== */

.dtd-shortcode-calc {
    max-width: 500px;
    margin: 20px auto;
    padding: 25px;
    border: 2px solid #e0e6ed;
    border-radius: 10px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.dtd-calc-title {
    margin-top: 0;
    color: #2c3e50;
    text-align: center;
    font-size: 1.5em;
}

.dtd-calc-explanation {
    color: #6c757d;
    font-style: italic;
    margin-bottom: 20px;
    text-align: left;
    line-height: 1.5;
}

.dtd-input-group {
    margin-bottom: 20px;
}

.dtd-input-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #495057;
}

.dtd-input-wrapper {
    position: relative;
}

.dtd-calc-amount {
    width: 100%;
    padding: 12px 50px 12px 15px;
    border: 2px solid #ced4da;
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.3s ease;
}

.dtd-calc-amount:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

.dtd-currency-symbol {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: #6c757d;
    font-weight: 600;
}

.dtd-calc-results {
    background: white;
    padding: 18px 20px;
    border-radius: 8px;
    border: 1px solid #dee2e6;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

/* Default (plain) row: side-by-side, label left, amount right */
.dtd-result-row {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: baseline;
    column-gap: 16px;
    row-gap: 4px;
    margin-bottom: 8px;
    padding: 6px 0;
    border-bottom: 1px solid #f0f2f4;
}

.dtd-result-row:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.dtd-result-row .dtd-label {
    flex: 1 1 auto;
    color: #495057;
    line-height: 1.4;
}

.dtd-result-row .dtd-amount {
    flex: 0 0 auto;
    margin-left: auto;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
    color: #2c3e50;
    font-weight: 500;
}

/* Highlighted rows: green cards, label stacked above big amount */
.dtd-result-row.dtd-deduction,
.dtd-result-row.dtd-actual {
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
    background-color: #e8f5e9;
    border: 1px solid #c3e6cb;
    border-radius: 8px;
    padding: 12px 16px;
    margin-top: 10px;
    margin-bottom: 0;
}

.dtd-result-row.dtd-deduction .dtd-label,
.dtd-result-row.dtd-actual .dtd-label {
    color: #155724;
    font-size: 0.95em;
    font-weight: 600;
    line-height: 1.3;
    opacity: 0.85;
}

.dtd-result-row.dtd-deduction .dtd-amount,
.dtd-result-row.dtd-actual .dtd-amount {
    color: #155724;
    font-size: 1.4em;
    font-weight: 700;
    margin-left: 0;
    line-height: 1.1;
}

/* Final block (Actual cost): a bit more emphasis */
.dtd-result-row.dtd-actual {
    background-color: #c3e6cb;
    border-color: #9bd5a8;
}

.dtd-result-row.dtd-actual .dtd-amount {
    font-size: 1.6em;
}

/* ==========================================================================
   Widget calculator
   ========================================================================== */

.dtd-widget {
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
    margin-bottom: 20px;
    border: 1px solid #e9ecef;
}

.dtd-widget-explanation {
    font-size: 14px;
    color: #6c757d;
    margin-bottom: 15px;
}

.dtd-widget-form label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    font-size: 14px;
    color: #495057;
}

.dtd-widget-amount {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ced4da;
    border-radius: 6px;
    margin-bottom: 15px;
    font-size: 14px;
}

.dtd-widget-amount:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.1);
}

.dtd-widget-result {
    padding: 12px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.dtd-widget-block {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    padding: 10px 12px;
    border-radius: 6px;
    margin-bottom: 8px;
}

.dtd-widget-block:last-child {
    margin-bottom: 0;
}

.dtd-widget-block .dtd-widget-label {
    font-size: 0.95em;
    font-weight: 600;
    opacity: 0.85;
}

.dtd-widget-block .dtd-widget-value {
    font-weight: 700;
    font-size: 1.3em;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.dtd-widget-result-actual {
    background-color: #c3e6cb;
    border: 1px solid #9bd5a8;
    color: #155724;
}

.dtd-widget-result-actual .dtd-widget-value {
    font-size: 1.5em;
}

.dtd-widget-result-savings {
    background-color: #f1f3f5;
    border: 1px solid #e9ecef;
    color: #495057;
}

.dtd-widget-rate {
    font-size: 0.7em;
    font-weight: 500;
    opacity: 0.7;
    margin-left: 4px;
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 480px) {
    .dtd-shortcode-calc {
        margin: 10px 0;
        padding: 16px;
    }

    .dtd-calc-title {
        font-size: 1.25em;
    }

    .dtd-calc-results {
        padding: 14px;
    }

    .dtd-result-row {
        gap: 10px;
        font-size: 0.95em;
    }

    .dtd-result-row.dtd-actual {
        padding: 12px 14px;
        font-size: 1em;
    }
}

/* ==========================================================================
   Accessibility
   ========================================================================== */

.dtd-deduction:focus,
.dtd-encouragement:focus {
    outline: 2px solid #0073aa;
    outline-offset: 2px;
}
