/* Reset */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Variables */
:root {
    --color-primary: #007AFF;
    --color-primary-hover: #0051D5;
    --color-text: #1d1d1f;
    --color-text-secondary: #86868b;
    --color-border: #d2d2d7;
    --color-background: #fbfbfd;
    --color-surface: #ffffff;
    --radius-sm: 10px;
    --radius-md: 12px;
    --radius-lg: 18px;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
    --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
    background: var(--color-background);
    color: var(--color-text);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    min-height: 100vh;
}

/* Layout */
.page-wrapper {
    max-width: 640px;
    margin: 0 auto;
    padding: 40px 20px 80px;
}

.content-container {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    overflow: hidden;
}

/* Header */
.header {
    text-align: center;
    padding: 48px 32px 32px;
    border-bottom: 1px solid var(--color-border);
}

.title {
    font-size: 32px;
    font-weight: 600;
    letter-spacing: -0.5px;
    margin-bottom: 8px;
    color: var(--color-text);
}

.description {
    font-size: 17px;
    color: var(--color-text-secondary);
    font-weight: 400;
    max-width: 400px;
    margin: 0 auto;
}

/* Form */
.donation-form {
    padding: 32px;
}

.form-section {
    margin-bottom: 40px;
}

.form-section:last-child {
    margin-bottom: 0;
}

.section-title {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--color-text);
    letter-spacing: -0.3px;
}

/* Input Groups */
.input-group {
    margin-bottom: 20px;
}

.input-label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--color-text);
    margin-bottom: 8px;
}

.optional {
    color: var(--color-text-secondary);
    font-weight: 400;
}

.input-field {
    width: 100%;
    padding: 12px 16px;
    font-size: 17px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-surface);
    color: var(--color-text);
    transition: var(--transition);
    font-family: inherit;
}

.input-field:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 4px rgba(0, 122, 255, 0.08);
}

.input-field::placeholder {
    color: var(--color-text-secondary);
}

.input-textarea {
    resize: vertical;
    min-height: 80px;
}

.input-hint {
    font-size: 13px;
    color: var(--color-text-secondary);
    margin-top: 6px;
}

.input-wrapper {
    position: relative;
}

.input-amount {
    padding-right: 40px;
    font-size: 24px;
    font-weight: 500;
    text-align: left;
}

.input-suffix {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 20px;
    font-weight: 500;
    color: var(--color-text-secondary);
    pointer-events: none;
}

/* Amount Selection */
.amount-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 24px;
}

.amount-option {
    position: relative;
    padding: 20px;
    background: var(--color-surface);
    border: 2px solid var(--color-border);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition);
    font-family: inherit;
}

.amount-option:hover {
    border-color: var(--color-primary);
    background: rgba(0, 122, 255, 0.04);
    transform: scale(1.02);
}

.amount-option.active {
    border-color: var(--color-primary);
    background: var(--color-primary);
}

.amount-option.active .amount-value {
    color: white;
}

.amount-value {
    display: block;
    font-size: 24px;
    font-weight: 600;
    color: var(--color-text);
    text-align: center;
    transition: var(--transition);
}

/* Checkbox */
.checkbox-wrapper {
    display: flex;
    align-items: flex-start;
    cursor: pointer;
    padding: 16px;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.checkbox-wrapper:hover {
    background: rgba(0, 0, 0, 0.02);
}

.checkbox-input {
    margin-right: 12px;
    width: 20px;
    height: 20px;
    cursor: pointer;
    accent-color: var(--color-primary);
    flex-shrink: 0;
}

.checkbox-label {
    font-size: 15px;
    color: var(--color-text);
    line-height: 1.4;
    user-select: none;
}

/* Form Actions */
.form-actions {
    margin-top: 32px;
    padding-top: 24px;
    border-top: 1px solid var(--color-border);
}

.btn-primary {
    width: 100%;
    padding: 16px 24px;
    background: var(--color-primary);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-size: 17px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    font-family: inherit;
    box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
    background: var(--color-primary-hover);
    box-shadow: 0 4px 16px rgba(0, 122, 255, 0.3);
}

.btn-primary:active {
    transform: scale(0.98);
}

.btn-text {
    display: block;
}

.secure-badge {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-top: 16px;
    font-size: 13px;
    color: var(--color-text-secondary);
}

.secure-badge svg {
    opacity: 0.6;
}

/* Footer */
.footer {
    text-align: center;
    padding: 24px 20px;
    margin-top: 32px;
}

.footer p {
    font-size: 13px;
    color: var(--color-text-secondary);
}

/* Messages */
.error-message {
    background: #fff1f0;
    border: 1px solid #ffccc7;
    border-radius: var(--radius-md);
    padding: 20px;
    margin: 20px 0;
    color: #cf1322;
}

.error-message ul {
    margin-left: 20px;
    margin-top: 8px;
}

.error-message li {
    margin: 6px 0;
}

/* Estilos para página de éxito */
.success-message {
    text-align: center;
}

.icon-success {
    font-size: 80px;
    margin-bottom: 20px;
    animation: bounceIn 0.6s ease;
}

@keyframes bounceIn {
    0% {
        transform: scale(0);
    }
    50% {
        transform: scale(1.2);
    }
    100% {
        transform: scale(1);
    }
}

.icon-error {
    font-size: 80px;
    margin-bottom: 20px;
}

.payment-details {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 20px;
    margin: 20px 0;
    text-align: left;
}

.payment-details h3 {
    color: #333;
    margin-bottom: 15px;
    text-align: center;
}

.payment-details table {
    width: 100%;
    border-collapse: collapse;
}

.payment-details td {
    padding: 10px;
    border-bottom: 1px solid #e0e0e0;
}

.payment-details td:first-child {
    color: #666;
}

.payment-details td:last-child {
    text-align: right;
    color: #333;
}

.info-text {
    background: #e7f3ff;
    padding: 15px;
    border-radius: 8px;
    margin: 20px 0;
    color: #0066cc;
}

.thank-you-message {
    margin: 30px 0;
    padding: 20px;
    background: linear-gradient(135deg, #d4fc79 0%, #96e6a1 100%);
    border-radius: 10px;
}

.thank-you-message p {
    margin: 10px 0;
    color: #2d5016;
}

.error-details {
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    border-radius: 8px;
    padding: 15px;
    margin: 20px 0;
}

.error-details p {
    margin: 8px 0;
    color: #856404;
}

.actions {
    margin-top: 30px;
}

/* Modal estilo Apple */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: fadeInOverlay 0.3s ease-out;
}

.modal-overlay.show {
    display: flex;
}

.modal-container {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    max-width: 400px;
    width: 100%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-content {
    padding: 0;
}

.modal-header {
    padding: 24px 24px 16px;
    border-bottom: 1px solid var(--color-border);
}

.modal-title {
    font-size: 20px;
    font-weight: 600;
    color: var(--color-text);
    text-align: center;
    letter-spacing: -0.3px;
}

.modal-body {
    padding: 0;
}

.summary-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 16px 24px;
    border-bottom: 1px solid var(--color-border);
}

.summary-row:last-child {
    border-bottom: none;
}

.summary-amount {
    padding: 20px 24px;
}

.summary-amount .summary-value {
    font-size: 32px;
    font-weight: 600;
    color: var(--color-primary);
}

.summary-label {
    font-size: 15px;
    color: var(--color-text-secondary);
}

.summary-value {
    font-size: 17px;
    font-weight: 500;
    color: var(--color-text);
    text-align: right;
    max-width: 60%;
}

.summary-message {
    font-size: 15px;
    font-weight: 400;
    line-height: 1.4;
}

.modal-footer {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    padding: 16px;
    border-top: 1px solid var(--color-border);
    background: rgba(0, 0, 0, 0.02);
}

.btn-modal {
    padding: 12px 20px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 17px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    font-family: inherit;
}

.btn-cancel {
    background: var(--color-surface);
    color: var(--color-text);
    border: 1px solid var(--color-border);
}

.btn-cancel:hover {
    background: rgba(0, 0, 0, 0.04);
}

.btn-confirm {
    background: var(--color-primary);
    color: white;
}

.btn-confirm:hover {
    background: var(--color-primary-hover);
}

.btn-confirm:active,
.btn-cancel:active {
    transform: scale(0.97);
}

/* Error Modal */
.modal-error .modal-container {
    max-width: 400px;
}

.error-icon {
    display: flex;
    justify-content: center;
    margin-bottom: 16px;
}

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

.error-list li {
    padding: 14px 16px;
    background: var(--color-surface);
    border-radius: var(--radius-sm);
    margin-bottom: 8px;
    font-size: 15px;
    color: var(--color-text);
    display: flex;
    align-items: flex-start;
    gap: 12px;
    line-height: 1.4;
}

.error-list li:last-child {
    margin-bottom: 0;
}

.error-list li::before {
    content: "•";
    color: #FF3B30;
    font-size: 20px;
    line-height: 1;
    flex-shrink: 0;
    font-weight: 700;
}

.modal-footer-single {
    grid-template-columns: 1fr;
    padding: 16px;
}

.btn-primary-full {
    padding: 14px 20px;
    background: var(--color-primary);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 17px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    font-family: inherit;
}

.btn-primary-full:hover {
    background: var(--color-primary-hover);
}

.btn-primary-full:active {
    transform: scale(0.97);
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInOverlay {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.content-container {
    animation: fadeIn 0.4s ease-out;
}

/* Responsive */
@media (max-width: 640px) {
    .page-wrapper {
        padding: 20px 16px 60px;
    }
    
    .header {
        padding: 32px 24px 24px;
    }
    
    .title {
        font-size: 28px;
    }
    
    .description {
        font-size: 15px;
    }
    
    .donation-form {
        padding: 24px;
    }
    
    .section-title {
        font-size: 18px;
    }
    
    .amount-grid {
        gap: 10px;
    }
    
    .amount-option {
        padding: 16px;
    }
    
    .amount-value {
        font-size: 20px;
    }
    
    .input-amount {
        font-size: 20px;
    }
    
    .input-suffix {
        font-size: 18px;
    }
    
    /* Modal responsive */
    .modal-container {
        max-width: calc(100% - 32px);
        margin: 0 16px;
    }
    
    .modal-header {
        padding: 20px 20px 12px;
    }
    
    .modal-title {
        font-size: 18px;
    }
    
    .summary-row {
        padding: 14px 20px;
    }
    
    .summary-amount {
        padding: 18px 20px;
    }
    
    .summary-amount .summary-value {
        font-size: 28px;
    }
    
    .summary-label {
        font-size: 14px;
    }
    
    .summary-value {
        font-size: 15px;
    }
    
    .modal-footer {
        padding: 12px;
        gap: 10px;
    }
    
    .btn-modal {
        padding: 11px 16px;
        font-size: 16px;
    }
    
    .btn-primary-full {
        padding: 12px 16px;
        font-size: 16px;
    }
    
    .modal-error .modal-container {
        max-width: calc(100% - 32px);
    }
    
    .error-list li {
        padding: 12px 14px;
        font-size: 14px;
    }
}
