/**
 * Fund Allocation Slider Styles
 * Multi-fund percentage allocation UI for donation forms
 */

/* Container */
.fund-allocation-section {
    margin: 1.5rem 0;
    padding: 1.25rem;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.fund-allocation-section h4 {
    margin: 0 0 0.25rem 0;
    font-size: 1rem;
    font-weight: 600;
    color: #333;
}

.fund-allocation-section .section-subtitle {
    margin: 0 0 1rem 0;
    font-size: 0.875rem;
    color: #6c757d;
}

/* Fund Options List */
.fund-options {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

/* Individual Fund Option */
.fund-option {
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    padding: 0.875rem;
    transition: all 0.2s ease;
}

.fund-option:hover {
    border-color: #adb5bd;
}

.fund-option.selected {
    border-color: var(--primary-color, #0d6efd);
    background: #f8f9ff;
}

/* Fund Header (Checkbox + Name) */
.fund-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.fund-checkbox {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    flex: 1;
}

.fund-checkbox input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--primary-color, #0d6efd);
}

.fund-name {
    font-weight: 500;
    color: #333;
    flex: 1;
}

/* Allocation Controls (shown when selected) */
.fund-allocation-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid #e9ecef;
}

/* Slider */
.fund-slider {
    flex: 1;
    height: 8px;
    -webkit-appearance: none;
    appearance: none;
    background: #e9ecef;
    border-radius: 4px;
    outline: none;
    cursor: pointer;
}

.fund-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    background: var(--primary-color, #0d6efd);
    border-radius: 50%;
    cursor: pointer;
    transition: transform 0.1s ease;
}

.fund-slider::-webkit-slider-thumb:hover {
    transform: scale(1.1);
}

.fund-slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    background: var(--primary-color, #0d6efd);
    border-radius: 50%;
    cursor: pointer;
    border: none;
}

/* Percentage Input Group */
.percentage-input-group {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    min-width: 80px;
}

.fund-percentage-input {
    width: 50px;
    padding: 0.375rem 0.5rem;
    font-size: 0.875rem;
    border: 1px solid #ced4da;
    border-radius: 4px;
    text-align: right;
}

.fund-percentage-input:focus {
    outline: none;
    border-color: var(--primary-color, #0d6efd);
    box-shadow: 0 0 0 2px rgba(13, 110, 253, 0.1);
}

.percentage-input-group span {
    color: #6c757d;
    font-size: 0.875rem;
}

/* Lock Button */
.lock-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    padding: 0;
    border: 1px solid #ced4da;
    border-radius: 4px;
    background: #fff;
    color: #6c757d;
    cursor: pointer;
    transition: all 0.15s ease;
}

.lock-btn:hover {
    background: #f8f9fa;
    border-color: #adb5bd;
}

.lock-btn.locked {
    background: #e9ecef;
    color: #495057;
    border-color: #adb5bd;
}

.lock-btn i {
    font-size: 0.75rem;
}

/* Fund Amount Display */
.fund-amount {
    min-width: 70px;
    text-align: right;
    font-weight: 600;
    color: #333;
}

/* Allocation Summary */
.allocation-summary {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.5rem;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #e9ecef;
    font-size: 0.9375rem;
}

.allocation-summary .total-label {
    color: #6c757d;
}

.allocation-summary .total-percentage {
    font-weight: 600;
    color: #333;
    min-width: 45px;
    text-align: right;
}

.allocation-summary.valid .total-percentage {
    color: #198754;
}

.allocation-summary.invalid .total-percentage {
    color: #dc3545;
}

.allocation-summary i {
    font-size: 1rem;
}

.allocation-summary .fa-check-circle {
    color: #198754;
}

.allocation-summary .fa-exclamation-circle {
    color: #dc3545;
}

/* Fund Breakdown (shows dollar amounts) */
.fund-breakdown {
    margin-top: 1rem;
    padding: 0.75rem;
    background: #f1f3f5;
    border-radius: 4px;
    font-size: 0.875rem;
}

.fund-breakdown-title {
    font-weight: 500;
    color: #495057;
    margin-bottom: 0.5rem;
}

.fund-breakdown-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.fund-breakdown-item {
    display: flex;
    justify-content: space-between;
    padding: 0.25rem 0;
    color: #495057;
}

.fund-breakdown-item .fund-name {
    font-weight: normal;
}

.fund-breakdown-item .fund-amount {
    font-weight: 500;
}

/* Responsive adjustments */
@media (max-width: 576px) {
    .fund-allocation-controls {
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .fund-slider {
        order: 1;
        width: 100%;
        flex: none;
    }

    .percentage-input-group {
        order: 2;
    }

    .fund-amount {
        order: 3;
        flex: 1;
    }

    .lock-btn {
        order: 4;
    }
}

/* Animation for adding/removing funds */
.fund-option.adding {
    animation: slideIn 0.2s ease;
}

.fund-option.removing {
    animation: slideOut 0.2s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideOut {
    from {
        opacity: 1;
        transform: translateY(0);
    }
    to {
        opacity: 0;
        transform: translateY(-10px);
    }
}

/* ============================================
   Per-Amount Fund Allocation Styles
   ============================================ */

/* Amount card grid */
.amount-fund-grid {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* Individual amount card */
.amount-fund-card {
    background: #fff;
    border: 2px solid #e9ecef;
    border-radius: 10px;
    padding: 1rem;
    transition: all 0.2s ease;
}

.amount-fund-card:hover {
    border-color: #adb5bd;
}

.amount-fund-card.selected {
    border-color: var(--primary-color, #0d6efd);
    background: #f8f9ff;
}

/* Amount header with main checkbox */
.amount-fund-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.amount-checkbox-wrapper {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.amount-checkbox-wrapper input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
    accent-color: var(--primary-color, #0d6efd);
}

.amount-fund-amount {
    font-size: 1.25rem;
    font-weight: 600;
    color: #333;
    cursor: pointer;
}

/* Custom amount input */
.amount-fund-custom-input {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid #e9ecef;
}

.amount-fund-custom-input .input-group {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.amount-fund-custom-input .input-prefix {
    font-size: 1.1rem;
    color: #6c757d;
}

.amount-fund-custom-input input {
    flex: 1;
    padding: 0.5rem;
    font-size: 1rem;
    border: 1px solid #ced4da;
    border-radius: 6px;
    max-width: 150px;
}

/* Fund allocations section */
.amount-fund-allocations {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #e9ecef;
}

.fund-allocation-label {
    font-size: 0.875rem;
    font-weight: 500;
    color: #6c757d;
    margin-bottom: 0.75rem;
}

/* Individual fund option within an amount */
.amount-fund-option {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 0.75rem;
    margin-bottom: 0.5rem;
}

.amount-fund-option-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.fund-checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-weight: 500;
    color: #333;
}

.fund-checkbox-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: var(--primary-color, #0d6efd);
}

.fund-percentage-display {
    font-weight: 600;
    color: var(--primary-color, #0d6efd);
    min-width: 40px;
    text-align: right;
}

/* Slider row */
.amount-fund-slider-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px dashed #dee2e6;
}

.amount-fund-slider {
    flex: 1;
    height: 6px;
    -webkit-appearance: none;
    appearance: none;
    background: #e9ecef;
    border-radius: 3px;
    outline: none;
    cursor: pointer;
}

.amount-fund-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    background: var(--primary-color, #0d6efd);
    border-radius: 50%;
    cursor: pointer;
    transition: transform 0.1s ease;
}

.amount-fund-slider::-webkit-slider-thumb:hover {
    transform: scale(1.1);
}

.amount-fund-slider::-moz-range-thumb {
    width: 18px;
    height: 18px;
    background: var(--primary-color, #0d6efd);
    border-radius: 50%;
    cursor: pointer;
    border: none;
}

.fund-dollar-amount {
    min-width: 60px;
    text-align: right;
    font-weight: 500;
    color: #495057;
    font-size: 0.9rem;
}

/* Amount fund total */
.amount-fund-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid #dee2e6;
    font-weight: 600;
}

.amount-fund-total-percent {
    font-size: 1.1rem;
}

/* Error message */
.amount-fund-error {
    color: #dc3545;
    font-size: 0.8rem;
    margin-top: 0.5rem;
    text-align: right;
}

/* Responsive */
@media (max-width: 576px) {
    .amount-fund-slider-row {
        flex-wrap: wrap;
    }

    .amount-fund-slider {
        width: 100%;
        order: 1;
    }

    .fund-dollar-amount {
        order: 2;
        margin-left: auto;
    }
}

/* ============================================
   Simple Fund Selector Styles (dropdown per amount)
   ============================================ */

/* Fund selector container - no border since parent .amount-fund-options has one */
.amount-fund-selector {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.fund-select-label {
    font-size: 0.875rem;
    font-weight: 500;
    color: #6c757d;
    white-space: nowrap;
}

.amount-fund-select {
    flex: 1;
    padding: 0.5rem 0.75rem;
    font-size: 0.9375rem;
    border: 1px solid #ced4da;
    border-radius: 6px;
    background: #fff;
    color: #333;
    cursor: pointer;
    max-width: 300px;
}

.amount-fund-select:focus {
    outline: none;
    border-color: var(--primary-color, #0d6efd);
    box-shadow: 0 0 0 2px rgba(13, 110, 253, 0.1);
}

.amount-fund-select:hover {
    border-color: #adb5bd;
}

/* Responsive - stack label and select on mobile */
@media (max-width: 576px) {
    .amount-fund-selector {
        flex-direction: column;
        align-items: stretch;
        gap: 0.5rem;
    }

    .amount-fund-select {
        max-width: none;
    }
}

/* ============================================
   Per-Amount Recurring Options Styles
   ============================================ */

/* Container for fund selector + recurring options */
.amount-fund-options {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid #e9ecef;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

/* Recurring options container - separator from fund selector above */
.amount-recurring-options {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid #e9ecef;
}

/* One-time / Recurring toggle buttons */
.amount-type-toggle {
    display: inline-flex;
    border: 1px solid #ced4da;
    border-radius: 6px;
    overflow: hidden;
}

.amount-type-btn {
    padding: 0.375rem 0.75rem;
    font-size: 0.8125rem;
    font-weight: 500;
    border: none;
    background: #fff;
    color: #6c757d;
    cursor: pointer;
    transition: all 0.15s ease;
}

.amount-type-btn:first-child {
    border-right: 1px solid #ced4da;
}

.amount-type-btn:hover {
    background: #f8f9fa;
}

.amount-type-btn.active {
    background: var(--primary-color, #0d6efd);
    color: #fff;
}

/* Frequency dropdown */
.amount-frequency-select {
    display: flex;
    align-items: center;
}

.amount-frequency {
    padding: 0.375rem 0.75rem;
    font-size: 0.8125rem;
    border: 1px solid #ced4da;
    border-radius: 6px;
    background: #fff;
    color: #333;
    cursor: pointer;
    min-width: 100px;
}

.amount-frequency:focus {
    outline: none;
    border-color: var(--primary-color, #0d6efd);
    box-shadow: 0 0 0 2px rgba(13, 110, 253, 0.1);
}

/* Responsive - stack recurring options on mobile */
@media (max-width: 576px) {
    .amount-fund-options {
        gap: 0.5rem;
    }

    .amount-recurring-options {
        flex-direction: column;
        align-items: stretch;
        gap: 0.5rem;
    }

    .amount-type-toggle {
        width: 100%;
    }

    .amount-type-btn {
        flex: 1;
        text-align: center;
    }

    .amount-frequency {
        width: 100%;
    }
}

/* Recurring badge in totals card */
.recurring-badge {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 500;
    padding: 0.15rem 0.5rem;
    margin-left: 0.5rem;
    border-radius: 4px;
    background: var(--primary-color, #0d6efd);
    color: #fff;
    vertical-align: middle;
}
