/**
 * Clean & Brand-Consistent Styling for Resilience Donation Form
 * Tailored to match the website design system.
 */

:root {
    --rzp-brand-color: #1b3e46;
    --rzp-brand-hover: #143037;
    --rzp-text-color: #333333;
    --rzp-text-muted: #666666;
    --rzp-border-color: #cccccc;
    --rzp-error-color: #d93838;
    --rzp-error-bg: #fff5f5;
    --rzp-error-border: #fed7d7;
    --rzp-success-color: #2f855a;
    --rzp-success-bg: #f0fff4;
    --rzp-font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --rzp-font-scale: 1;
}

.rzp-donation-container {
    font-family: var(--rzp-font-family);
    max-width: 760px;
    margin: 20px auto;
    padding: 10px 0;
    background: transparent;
    color: var(--rzp-text-color);
}

.rzp-donation-container h2.rzp-form-title {
    font-size: calc(32px * var(--rzp-font-scale));
    font-weight: 700;
    color: var(--rzp-brand-color);
    margin-top: 0;
    margin-bottom: 30px;
    text-align: left;
    border: none;
    padding: 0;
}

.rzp-form-styled {
    display: block;
}

/* Grid Layout for Fields */
.rzp-fields-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px 40px;
    margin-bottom: 25px;
}

@media (max-width: 600px) {
    .rzp-fields-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
}

/* Input Fields Styles (Underlined Layout) */
.rzp-input-field {
    display: flex;
    flex-direction: column;
    margin-bottom: 25px;
    text-align: left;
}

.rzp-input-field.rzp-full-width {
    margin-bottom: 25px;
}

.rzp-input-field label {
    font-size: calc(13px * var(--rzp-font-scale));
    color: var(--rzp-text-muted);
    margin-bottom: 6px;
    font-weight: 500;
    transition: color 0.2s ease;
}

.rzp-field-sublabel {
    font-size: 11px;
    color: #777777;
    margin-top: -2px;
    margin-bottom: 8px;
    line-height: 1.4;
    display: block;
}

.rzp-input-field input {
    border: none !important;
    border-bottom: 1px solid var(--rzp-border-color) !important;
    background: transparent !important;
    padding: 10px 0 !important;
    font-size: calc(15px * var(--rzp-font-scale)) !important;
    color: var(--rzp-text-color) !important;
    width: 100% !important;
    box-sizing: border-box !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    outline: none !important;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.rzp-input-field input:focus {
    border-bottom-color: var(--rzp-brand-color) !important;
}

.rzp-input-field input[readonly] {
    color: var(--rzp-text-muted) !important;
    border-bottom-style: dashed !important;
    cursor: default !important;
}

.rzp-mobile-input-wrap {
    display: flex;
    align-items: center;
    border-bottom: 1px solid var(--rzp-border-color);
    transition: border-color 0.2s ease;
    width: 100%;
}

.rzp-mobile-input-wrap:focus-within {
    border-bottom-color: var(--rzp-brand-color);
}

.rzp-mobile-prefix {
    font-size: calc(15px * var(--rzp-font-scale));
    color: var(--rzp-text-muted);
    font-weight: 600;
    padding: 10px 8px 10px 0;
    user-select: none;
    line-height: normal;
}

.rzp-mobile-input-wrap input {
    border-bottom: none !important;
    padding-left: 0 !important;
    flex: 1;
}

/* Disclaimer text */
.rzp-disclaimer-text {
    font-size: calc(14px * var(--rzp-font-scale));
    color: var(--rzp-text-color);
    margin: 25px 0 20px 0;
    text-align: left;
}

/* DPDP privacy notice and consent block (VAPT DP-01 to DP-04) */
.rzp-privacy-notice {
    font-size: calc(13px * var(--rzp-font-scale));
    color: var(--rzp-text-color);
    line-height: 1.5;
    margin: 20px 0;
    padding: 14px 16px;
    border: 1px solid var(--rzp-border-color);
    border-radius: 6px;
    background: #fafafa;
    max-height: 220px;
    overflow-y: auto;
}

.rzp-privacy-notice p {
    margin: 0 0 8px 0;
}

.rzp-privacy-notice p:last-child {
    margin-bottom: 0;
}

.rzp-privacy-links a {
    color: var(--rzp-brand-color);
    text-decoration: underline;
}

.rzp-privacy-contact {
    display: block;
    margin-top: 4px;
    color: var(--rzp-text-muted);
}

.rzp-consent-field {
    font-size: calc(14px * var(--rzp-font-scale));
    color: var(--rzp-text-color);
    margin: 0 0 12px 0;
}

.rzp-consent-field label {
    display: flex;
    gap: 8px;
    align-items: flex-start;
    cursor: pointer;
}

.rzp-consent-field input[type="checkbox"] {
    margin-top: 3px;
    flex-shrink: 0;
}

/* reCAPTCHA v2 checkbox (VAPT F-03) */
.rzp-recaptcha:not(:empty) {
    margin: 4px 0 16px 0;
}

.rzp-required {
    color: var(--rzp-error-color);
    font-weight: bold;
    margin-left: 2px;
}

/* Donation Type Segmented Button Bar */
.rzp-radio-section {
    margin-bottom: 25px;
    text-align: left;
}

.rzp-type-selector {
    display: inline-flex;
    background-color: #f0f4f5;
    border-radius: 25px;
    padding: 4px;
    gap: 4px;
    width: 100%;
    max-width: 340px;
    box-sizing: border-box;
}

.rzp-type-btn {
    flex: 1;
    text-align: center;
    position: relative;
    cursor: pointer;
    user-select: none;
}

.rzp-type-btn input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    margin: 0 !important;
}

.rzp-type-text {
    display: block;
    padding: 10px 16px;
    font-size: calc(14px * var(--rzp-font-scale));
    font-weight: 600;
    color: var(--rzp-brand-color);
    border-radius: 20px;
    transition: background-color 0.25s ease, color 0.25s ease, box-shadow 0.25s ease;
}

.rzp-type-btn input[type="radio"]:checked + .rzp-type-text {
    background-color: var(--rzp-brand-color);
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(27, 62, 70, 0.2);
}

/* Preset Amounts Grid (Production-Grade UX) */
.rzp-amounts-section {
    margin-bottom: 30px;
    text-align: left;
}

.rzp-amounts-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
}

@media (max-width: 768px) {
    .rzp-amounts-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 480px) {
    .rzp-amounts-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

.rzp-amount-card {
    position: relative;
    cursor: pointer;
    user-select: none;
}

.rzp-amount-card input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    margin: 0 !important;
}

.rzp-amount-card-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 12px 10px;
    border: 1px solid var(--rzp-border-color);
    border-radius: 8px;
    font-size: calc(15px * var(--rzp-font-scale));
    font-weight: 600;
    color: var(--rzp-text-color);
    background-color: #ffffff;
    transition: border-color 0.2s ease, background-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
    text-align: center;
}

.rzp-amount-card-custom .rzp-amount-card-content {
    font-size: 13px;
    font-weight: 500;
}

.rzp-amount-card:hover .rzp-amount-card-content {
    border-color: var(--rzp-brand-color);
    background-color: #f7fafc;
}

.rzp-amount-card input[type="radio"]:checked + .rzp-amount-card-content {
    border-color: var(--rzp-brand-color);
    background-color: #eef7f8;
    color: var(--rzp-brand-color);
    box-shadow: 0 0 0 1px var(--rzp-brand-color);
}

.rzp-amount-card.rzp-disabled-option {
    opacity: 0.4;
    cursor: not-allowed;
}

.rzp-amount-card.rzp-disabled-option .rzp-amount-card-content {
    background-color: #f7fafc;
    border-style: dashed;
    cursor: not-allowed;
    color: var(--rzp-text-muted);
}

.rzp-amount-card.rzp-disabled-option input[type="radio"] {
    cursor: not-allowed;
}

/* Amount Input Wrapper */
.rzp-amount-input-wrapper {
    margin-bottom: 30px;
}

/* Submit Button styling */
.rzp-submit-container {
    text-align: left;
    margin-top: 30px;
}

.rzp-submit-btn {
    background-color: var(--rzp-brand-color);
    color: #ffffff;
    border: none;
    padding: 12px 42px;
    font-size: 15px;
    font-weight: 600;
    border-radius: 25px;
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.1s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    box-shadow: none;
    outline: none;
}

.rzp-submit-btn:hover:not(:disabled) {
    background-color: var(--rzp-brand-hover);
}

.rzp-submit-btn:active:not(:disabled) {
    transform: scale(0.98);
}

.rzp-submit-btn:disabled {
    background-color: #a0aec0;
    cursor: not-allowed;
}

/* Spinner */
.rzp-spinner {
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #ffffff;
    animation: rzp-spin 0.8s linear infinite;
    display: inline-block;
}

@keyframes rzp-spin {
    to { transform: rotate(360deg); }
}

/* Error feedback container */
.rzp-error-message {
    color: var(--rzp-error-color);
    background-color: var(--rzp-error-bg);
    border: 1px solid var(--rzp-error-border);
    padding: 12px 18px;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 25px;
    text-align: left;
    animation: rzp-fadeIn 0.2s ease;
}

.rzp-hidden {
    display: none !important;
}

/*
 * A11Y: available to assistive technology, invisible on screen.
 *
 * Deliberately NOT display:none or visibility:hidden -- both remove the element
 * from the accessibility tree entirely, which would defeat the purpose. The
 * clip-path/1px technique keeps it in the tree while taking it out of the
 * visual layout. white-space:nowrap stops a long label being clipped to a
 * single unreadable character.
 *
 * Used to give the donation-frequency and amount radio groups an accessible
 * name, which they previously lacked.
 */
.rzp-visually-hidden {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    clip-path: inset(50%) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

/* Success panel styling */
.rzp-success-panel {
    text-align: center;
    padding: 40px 20px;
    background-color: var(--rzp-success-bg);
    border: 1px solid #c6f6d5;
    border-radius: 8px;
    margin: 20px 0;
    animation: rzp-scaleUp 0.3s ease;
}

.rzp-success-icon {
    color: var(--rzp-success-color);
    margin-bottom: 18px;
}

.rzp-success-icon svg {
    width: 56px;
    height: 56px;
    margin: 0 auto;
}

.rzp-success-panel h2 {
    font-size: 24px;
    font-weight: 700;
    color: var(--rzp-brand-color);
    margin-top: 0;
    margin-bottom: 12px;
}

.rzp-success-panel p {
    font-size: 15px;
    color: var(--rzp-text-color);
    line-height: 1.6;
    max-width: 520px;
    margin: 0 auto 24px auto;
}

.rzp-reset-form-btn {
    background-color: var(--rzp-brand-color);
    color: #ffffff;
    border: none;
    padding: 10px 28px;
    font-size: 14px;
    font-weight: 600;
    border-radius: 20px;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.rzp-reset-form-btn:hover {
    background-color: var(--rzp-brand-hover);
}

/* Error Redirect Panel Styling */
.rzp-error-panel {
    text-align: center;
    padding: 40px 20px;
    color: #842029;
    background-color: #f8d7da;
    border: 1px solid #f5c2c7;
    border-radius: 8px;
    margin: 20px 0;
    animation: rzp-scaleUp 0.3s ease;
}

.rzp-error-panel h2 {
    font-size: 24px;
    font-weight: 700;
    margin-top: 0;
    margin-bottom: 12px;
    color: #842029;
}

.rzp-error-panel p {
    font-size: 15px;
    line-height: 1.6;
    max-width: 520px;
    margin: 0 auto 24px auto;
}

@keyframes rzp-fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes rzp-scaleUp {
    from { opacity: 0; transform: scale(0.96); }
    to { opacity: 1; transform: scale(1); }
}
