/**
 * OneDFCCI Giving Frontend Styles
 * 
 * Styles for the frontend donation form shortcode
 * 
 * @package OneDFCCI_Giving
 * @since 1.0.0
 */

/* Container and Layout */
.onedfcci-donation-form-container {
    max-width: 600px;
    margin: 0 auto;
    padding: 20px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen-Sans, Ubuntu, Cantarell, 'Helvetica Neue', sans-serif;
    position: relative;
}

.onedfcci-form-title {
    display: none;
}

/* Progress Bar */
.onedfcci-form-progress {
    margin-bottom: 40px;
}

.onedfcci-progress-bar {
    width: 100%;
    height: 6px;
    background-color: #e9ecef;
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 15px;
}

.onedfcci-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #3498db, #2980b9);
    border-radius: 3px;
    transition: width 0.3s ease;
}

.onedfcci-progress-steps {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 5px;
}

.onedfcci-step {
    font-size: 11px;
    color: #6c757d;
    padding: 4px 8px;
    border-radius: 4px;
    border: 1px solid #e9ecef;
    transition: all 0.3s ease;
    text-align: center;
    min-width: 50px;
}

.onedfcci-step.active {
    border-color: #3498db;
    color: #3498db;
    font-weight: 500;
}

.onedfcci-step.completed {
    border-color: #27ae60;
    color: #27ae60;
}

/* Form Steps */
.onedfcci-donation-form {
    position: relative;
    min-height: 400px;
}

.onedfcci-form-step {
    display: none;
    animation: fadeIn 0.3s ease;
}

.onedfcci-form-step.active {
    display: block;
}

.onedfcci-form-step h3 {
    margin: 0 0 25px 0;
    color: #2c3e50;
    font-size: 22px;
    font-weight: 600;
    text-align: center;
}

/* Form Fields */
.onedfcci-form-field {
    margin-bottom: 25px;
}

/* Local Church Field Transition */
.onedfcci-local-church-field {
    transition: all 0.3s ease;
    overflow: hidden;
}

.onedfcci-local-church-field[style*="display: none"] {
    max-height: 0;
    margin-bottom: 0;
    opacity: 0;
}

.onedfcci-local-church-field:not([style*="display: none"]) {
    max-height: 200px;
    opacity: 1;
}

.onedfcci-form-field label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #34495e;
    font-size: 14px;
}

.onedfcci-form-field label.required::after {
    content: ' *';
    color: #e74c3c;
}

.onedfcci-form-field input[type="text"],
.onedfcci-form-field input[type="email"],
.onedfcci-form-field input[type="tel"],
.onedfcci-form-field input[type="number"],
.onedfcci-form-field select,
.onedfcci-form-field textarea {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 16px;
    line-height: 1.5;
    transition: all 0.3s ease;
    box-sizing: border-box;
}

.onedfcci-form-field input:focus,
.onedfcci-form-field select:focus,
.onedfcci-form-field textarea:focus {
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
    outline: none;
}

.onedfcci-form-field input.error,
.onedfcci-form-field select.error,
.onedfcci-form-field textarea.error {
    border-color: #e74c3c;
    box-shadow: 0 0 0 3px rgba(231, 76, 60, 0.1);
}

.onedfcci-field-error {
    color: #e74c3c;
    font-size: 13px;
    margin-top: 5px;
    display: block;
    min-height: 18px;
}

/* Amount Field */
.onedfcci-amount-input {
    position: relative;
    display: flex;
    align-items: center;
}

.onedfcci-currency-symbol {
    position: absolute;
    left: 16px;
    font-weight: bold;
    color: #3498db;
    font-size: 16px;
    z-index: 2;
    pointer-events: none;
    user-select: none;
}

.onedfcci-amount-input input {
    padding-left: 55px;
}

/* Method Instructions */
.onedfcci-method-instructions {
    margin-top: 15px;
    padding: 15px;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    border-left: 4px solid #3498db;
    font-size: 14px;
    line-height: 1.6;
    display: none;
}

.onedfcci-method-instructions.show {
    display: block;
    animation: slideDown 0.3s ease;
}

/* File Upload */
.onedfcci-file-upload-area {
    position: relative;
}

.onedfcci-file-upload-area input[type="file"] {
    position: absolute;
    opacity: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
}

.onedfcci-upload-placeholder {
    border: 2px dashed #bdc3c7;
    border-radius: 8px;
    padding: 40px 20px;
    text-align: center;
    transition: all 0.3s ease;
}

.onedfcci-upload-placeholder:hover {
    border-color: #3498db;
}

.onedfcci-upload-placeholder.dragover {
    border-color: #3498db;
    transform: scale(1.02);
}

.onedfcci-upload-icon {
    font-size: 48px;
    margin-bottom: 15px;
}

.onedfcci-upload-placeholder p {
    margin: 0 0 10px 0;
    font-size: 16px;
    color: #34495e;
    font-weight: 500;
}

.onedfcci-upload-placeholder small {
    color: #7f8c8d;
    font-size: 13px;
}

.onedfcci-file-preview {
    margin-top: 15px;
    padding: 15px;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    display: none;
}

.onedfcci-file-preview.show {
    display: block;
}

.onedfcci-file-preview img {
    max-width: 200px;
    max-height: 150px;
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.onedfcci-file-info {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    color: #34495e;
}

.onedfcci-file-info .file-icon {
    font-size: 24px;
}

.onedfcci-remove-file {
    background: #e74c3c;
    color: white;
    border: none;
    padding: 5px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    margin-left: auto;
}

/* Character Counter */
.onedfcci-char-counter {
    text-align: right;
    font-size: 12px;
    color: #7f8c8d;
    margin-top: 5px;
}

.onedfcci-char-counter.warning {
    color: #e67e22;
}

.onedfcci-char-counter.danger {
    color: #e74c3c;
}

/* Summary Section */
.onedfcci-donation-summary {
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 25px;
    margin-bottom: 25px;
}

.onedfcci-reference-display {
    text-align: center;
    margin-bottom: 25px;
    padding-bottom: 20px;
    border-bottom: 2px solid #e9ecef;
}

.onedfcci-reference-display h4 {
    margin: 0 0 10px 0;
    color: #2c3e50;
    font-size: 16px;
}

.onedfcci-reference-number {
    font-family: 'Courier New', monospace;
    font-size: 20px;
    font-weight: bold;
    color: #3498db;
    padding: 12px 20px;
    border-radius: 4px;
    border: 1px solid #3498db;
    display: inline-block;
    letter-spacing: 1px;
}

.onedfcci-summary-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 15px;
}

.onedfcci-summary-item {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 12px 0;
    border-bottom: 1px solid #e9ecef;
}

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

.onedfcci-summary-item label {
    font-weight: 600;
    color: #34495e;
    margin: 0;
    min-width: 100px;
}

.onedfcci-summary-item span {
    color: #2c3e50;
    text-align: right;
    flex: 1;
    margin-left: 15px;
}

.onedfcci-message-item span,
.onedfcci-proof-item span {
    word-break: break-word;
}

/* Navigation Buttons */
.onedfcci-form-navigation {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 30px;
    gap: 15px;
}

.onedfcci-btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 120px;
}

.onedfcci-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.onedfcci-btn-primary {
    background: #3498db;
    color: white;
}

.onedfcci-btn-primary:hover:not(:disabled) {
    background: #2980b9;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(52, 152, 219, 0.3);
}

.onedfcci-btn-secondary {
    background: #95a5a6;
    color: white;
}

.onedfcci-btn-secondary:hover:not(:disabled) {
    background: #7f8c8d;
    transform: translateY(-2px);
}

.onedfcci-btn-success {
    background: #27ae60;
    color: white;
}

.onedfcci-btn-success:hover:not(:disabled) {
    background: #229954;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(39, 174, 96, 0.3);
}

.onedfcci-btn.loading {
    opacity: 0.7;
    pointer-events: none;
}

.onedfcci-btn.loading::after {
    content: '';
    width: 16px;
    height: 16px;
    border: 2px solid transparent;
    border-top: 2px solid currentColor;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-left: 8px;
}

/* Messages */
.onedfcci-form-messages {
    margin-top: 30px;
}

.onedfcci-success-message,
.onedfcci-error-message {
    padding: 30px 20px;
    border-radius: 4px;
    text-align: center;
    border: 1px solid #e9ecef;
}

.onedfcci-success-message {
    color: #2c3e50;
}

.onedfcci-success-message h3 {
    margin: 0 0 20px 0;
    color: #27ae60;
    font-size: 24px;
    font-weight: 600;
}

.onedfcci-final-reference {
    font-family: 'Courier New', monospace;
    font-size: 20px;
    font-weight: bold;
    color: #27ae60;
    padding: 12px 20px;
    border-radius: 4px;
    border: 1px solid #27ae60;
    display: inline-block;
    margin: 20px 0;
    letter-spacing: 1px;
}

.onedfcci-error-message {
    color: #721c24;
    border-color: #e74c3c;
}

.onedfcci-error-message h3 {
    margin: 0 0 15px 0;
    color: #e74c3c;
    font-size: 20px;
    font-weight: 600;
}

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

@keyframes slideDown {
    from {
        opacity: 0;
        max-height: 0;
    }
    to {
        opacity: 1;
        max-height: 200px;
    }
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Responsive Design */
@media (max-width: 768px) {
    .onedfcci-donation-form-container {
        margin: 10px;
        padding: 15px;
    }
    
    .onedfcci-form-title {
        font-size: 24px;
    }
    
    .onedfcci-progress-steps {
        justify-content: center;
    }
    
    .onedfcci-step {
        font-size: 10px;
        padding: 3px 6px;
        min-width: 40px;
    }
    
    .onedfcci-form-step h3 {
        font-size: 20px;
    }
    
    .onedfcci-form-navigation {
        flex-direction: column;
    }
    
    .onedfcci-btn {
        width: 100%;
        max-width: 300px;
    }
    
    .onedfcci-summary-item {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .onedfcci-summary-item span {
        margin-left: 0;
        margin-top: 5px;
        text-align: left;
    }
    
    .onedfcci-reference-number {
        font-size: 16px;
        padding: 10px 15px;
    }
    
    .onedfcci-final-reference {
        font-size: 18px;
        padding: 12px 20px;
    }
}

@media (max-width: 480px) {
    .onedfcci-donation-form-container {
        margin: 5px;
        padding: 10px;
    }
    
    .onedfcci-upload-placeholder {
        padding: 30px 15px;
    }
    
    .onedfcci-upload-icon {
        font-size: 36px;
    }
    
    .onedfcci-form-field input,
    .onedfcci-form-field select,
    .onedfcci-form-field textarea {
        font-size: 16px; /* Prevent zoom on iOS */
    }
}

/* Dark Theme Support */
@media (prefers-color-scheme: dark) {
    .onedfcci-donation-form-container[data-theme="auto"] {
        background: #2c3e50;
        color: #ecf0f1;
    }
    
    .onedfcci-donation-form-container[data-theme="auto"] .onedfcci-form-title,
    .onedfcci-donation-form-container[data-theme="auto"] .onedfcci-form-step h3 {
        color: #ecf0f1;
    }
    
    .onedfcci-donation-form-container[data-theme="auto"] .onedfcci-form-field input,
    .onedfcci-donation-form-container[data-theme="auto"] .onedfcci-form-field select,
    .onedfcci-donation-form-container[data-theme="auto"] .onedfcci-form-field textarea {
        background: #34495e;
        border-color: #4a5f7a;
        color: #ecf0f1;
    }
    
    .onedfcci-donation-form-container[data-theme="auto"] .onedfcci-donation-summary {
        background: #34495e;
    }
}

/* Print Styles */
@media print {
    .onedfcci-donation-form-container {
        box-shadow: none;
        border: 1px solid #000;
    }
    
    .onedfcci-form-navigation,
    .onedfcci-form-progress {
        display: none;
    }
    
    .onedfcci-form-step {
        display: block !important;
        page-break-inside: avoid;
    }
}

/* Forms Disabled Notice */
.onedfcci-forms-disabled-notice {
    max-width: 600px;
    margin: 20px auto;
    padding: 20px;
    background-color: #fff3cd;
    border: 1px solid #ffeaa7;
    border-radius: 8px;
    text-align: center;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen-Sans, Ubuntu, Cantarell, 'Helvetica Neue', sans-serif;
}

.onedfcci-forms-disabled-notice p {
    margin: 0;
    color: #856404;
    font-size: 16px;
    font-weight: 500;
}