/* MPD Donation - Modern Style */

/* Scoped Variables */
.mpd-donation-wrapper {
    --mpd-blue: #0d6efd;
    --mpd-blue-dark: #0b5ed7;
    --mpd-green: #198754;
    --mpd-green-dark: #157347;
    --mpd-text: #212529;
    --mpd-gray: #6c757d;
    --mpd-light: #f8f9fa;
    --mpd-border: #dee2e6;
    --mpd-radius: 8px;
    --mpd-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    max-width: 800px;
    margin: 40px auto;
    background: #fff;
    padding: 40px;
    border-radius: var(--mpd-radius);
    box-shadow: var(--mpd-shadow);
    color: var(--mpd-text);
    overflow: hidden;
    box-sizing: border-box;
}

.mpd-donation-wrapper h3 {
    text-align: center;
    color: var(--mpd-blue);
    font-size: 2rem;
    margin-bottom: 40px;
    font-weight: 700;
}

.mpd-donation-section {
    margin-bottom: 40px;
    background: #fff;
    position: relative;
    padding-left: 0;
    padding-right: 0;
    border: none;
}

/* Fancy Step Numbers for headers (like Adeziune screenshot) */
.mpd-donation-section h4 {
    display: flex;
    align-items: center;
    font-size: 1.25rem;
    color: var(--mpd-text);
    margin-bottom: 15px;
    margin-top: 0;
    font-weight: 600;
    border: none;
    padding-left: 0;
}

.mpd-section-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background-color: var(--mpd-green); 
    color: #fff;
    border-radius: 50%;
    margin-right: 12px;
    font-size: 16px;
    font-weight: bold;
    flex-shrink: 0;
}

.mpd-donation-section p.description {
    color: var(--mpd-gray);
    font-size: 0.95rem;
    margin-bottom: 20px;
    margin-left: 44px; /* Align with text start */
}

/* Forms */
.mpd-form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

@media (max-width: 600px) {
    .mpd-donation-wrapper h3 {
        font-size: 1.5rem; /* Smaller title on mobile */
        margin-bottom: 30px;
    }
    .mpd-form-row {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    .mpd-donation-wrapper {
        padding: 20px 16px;
        margin: 15px auto;
    }
    /* Payment method cards - compact pe mobil */
    .mpd-payment-method-switcher {
        gap: 8px !important;
    }
    .mpd-payment-method-switcher > label {
        padding: 10px 12px !important;
        gap: 8px !important;
    }
    .mpd-payment-method-switcher strong {
        font-size: 13px;
    }
    .mpd-payment-method-switcher small {
        font-size: 10px !important;
    }
    /* Donor type switcher - compact pe mobil */
    .mpd-donor-type-switcher {
        gap: 8px !important;
    }
    .mpd-donor-type-switcher > label {
        padding: 8px 10px !important;
    }
    .mpd-donor-type-switcher strong {
        font-size: 12px !important;
    }
}

.mpd-form-group {
    margin-bottom: 15px;
}

.mpd-form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--mpd-text);
    font-size: 0.95rem;
}

.mpd-form-group input[type="text"],
.mpd-form-group input[type="email"],
.mpd-form-group input[type="tel"],
.mpd-form-group input[type="number"],
.mpd-form-group select,
.mpd-form-group textarea {
    width: 100%;
    padding: 12px 15px;
    font-size: 1rem;
    line-height: 1.5;
    color: var(--mpd-text);
    background-color: #fff;
    border: 1px solid var(--mpd-border);
    border-radius: 6px; /* Slightly smaller radius for inputs */
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
    box-sizing: border-box;
}

.mpd-form-group input:focus {
    border-color: #86b7fe;
    outline: 0;
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}

/* File Input Custom Styling */
.mpd-form-group input[type="file"] {
    padding: 10px;
    background: var(--mpd-light);
    border: 1px dashed var(--mpd-border);
}

/* --- Step 3 ID Upload Style --- */
.mpd-id-upload-card {
    border-radius: 18px;
    border: 1px dashed #cbd5e1;
    background: #f9fafb;
    padding: 16px 16px 14px;
    margin-bottom: 20px;
    text-align: center;
}

.mpd-id-upload-top {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    margin-bottom: 12px;
    width: 100%;
}

.mpd-id-upload-button {
    width: 100%;
    border-radius: 12px;
    background: #047857; /* Dark Green */
    color: #f9fafb;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 20px;
    font-weight: 600;
    font-size: 15px;
    border: none;
    cursor: pointer;
    text-align: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: background 0.2s;
}

.mpd-id-upload-button:hover {
    background: #065f46;
}

.mpd-id-upload-button svg {
    width: 20px;
    height: 20px;
}

.mpd-id-upload-preview {
    width: 100%;
    min-height: 240px;
    border-radius: 12px;
    background: #f3f4f6;
    border: 2px dashed #d1d5db;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 8px;
    position: relative;
}

.mpd-id-upload-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

#placeholder-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

.mpd-id-texts {
    text-align: center;
}

.mpd-id-upload-fileinfo {
    font-size: 12px;
    color: #4b5563;
    margin-bottom: 2px;
    font-weight: 600;
}

.mpd-id-upload-help {
    font-size: 11px;
    color: #6b7280;
}

.mpd-id-delete-btn {
    margin-top: 10px;
    background: #ef4444;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    display: none;
}

.mpd-id-delete-btn:hover {
    background: #dc2626;
}

/* Amounts Grid */
.mpd-amounts {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 10px;
    margin-bottom: 15px;
}

.amount-btn {
    background: #fff;
    border: 2px solid var(--mpd-blue);
    color: var(--mpd-blue);
    padding: 12px;
    font-size: 1rem;
    font-weight: 600;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
}

.amount-btn:hover {
    background-color: #e7f1ff;
    color: var(--mpd-blue-dark);
}

.amount-btn.active {
    background-color: var(--mpd-blue);
    color: #fff;
    box-shadow: 0 4px 6px rgba(13, 110, 253, 0.3);
}

/* Input "Altă sumă" */
.mpd-amounts input[type="number"] {
    border: 2px dashed var(--mpd-blue);
    border-radius: 6px;
    padding: 12px;
    font-size: 1rem;
    font-weight: 600;
    color: var(--mpd-blue);
    text-align: center;
    outline: none;
    transition: all 0.2s ease;
    background: #fff;
    width: 100%;
    box-sizing: border-box;
}
.mpd-amounts input[type="number"]::placeholder {
    color: var(--mpd-blue);
    opacity: 0.6;
}
.mpd-amounts input[type="number"]:focus {
    border-color: var(--mpd-blue-dark);
    background: #e7f1ff;
    box-shadow: 0 0 0 3px rgba(13, 110, 253, 0.15);
}


/* --- Blue Credit Card Payment Interface (From Adeziune Step 6) --- */

.mpd-credit-card-wrapper {
    perspective: 1000px;
    margin: 20px auto;
    max-width: 450px;
    width: 100%;
}

.mpd-credit-card {
    /* Beautiful Blue Gradient */
    background: linear-gradient(135deg, #004e92 0%, #000428 100%);
    border-radius: 16px;
    padding: 25px;
    color: #fff;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.2);
    position: relative;
    overflow: hidden;
    /* Slightly taller than standard (1.58) to ensure bottom fields aren't cut off */
    aspect-ratio: 1.5; 
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.mpd-credit-card::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.15) 0%, transparent 60%);
    pointer-events: none;
}

/* Chip styling */
.mpd-card-chip {
    width: 40px;
    height: 28px;
    background: linear-gradient(135deg, #fbbf24 0%, #d97706 100%);
    border-radius: 5px;
    position: relative;
    flex-shrink: 0;
}

.mpd-card-chip::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    width: 100%;
    height: 1px;
    background: rgba(0,0,0,0.2);
}

.mpd-card-input-group {
    margin-bottom: 0;
    position: relative;
    z-index: 2;
}

.mpd-card-input-group label {
    display: block;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    opacity: 0.9;
    margin-bottom: 4px;
    font-weight: 600;
    color: #e2e8f0;
    text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

.mpd-card-input {
    display: block;
    width: 100%;
    /* Force transparent/glassy background to override theme defaults */
    background-color: rgba(255, 255, 255, 0.15) !important;
    border: 1px solid rgba(255, 255, 255, 0.3) !important;
    border-radius: 10px !important; /* Rounded corners */
    color: #fff !important;
    font-family: 'Courier New', monospace;
    font-size: 18px;
    padding: 10px 12px !important; /* Increased padding */
    outline: none;
    transition: all 0.3s;
    box-shadow: none !important;
    height: 46px !important; /* Fixed height to prevent collapse */
    min-height: 46px; /* Ensure clickability */
    line-height: normal !important; /* Allow centering */
    box-sizing: border-box;
    position: relative; /* Ensure z-index works */
    z-index: 10;
}

.mpd-card-input:focus {
    background-color: rgba(255, 255, 255, 0.25) !important;
    border-color: #fff !important;
    box-shadow: 0 0 0 3px rgba(255,255,255,0.1) !important;
}

.mpd-card-input::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

.mpd-card-top-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 10px;
}

.mpd-card-middle-row {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    margin: 10px 0;
}

.mpd-card-bottom-row {
    display: flex;
    gap: 20px;
    align-items: flex-end;
    margin-bottom: 5px; /* Extra space at bottom */
}

.mpd-card-logo {
    text-align: right;
    opacity: 0.9;
    margin-bottom: 8px;
}

.mpd-logo-visa {
    font-weight: bold;
    font-style: italic;
    font-size: 14px; /* Reduced size */
    line-height: 1;
}

.mpd-logo-mastercard {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-top: 2px;
    font-weight: 600;
}

/* Mobile Responsiveness for Card */
@media (max-width: 480px) {
    .mpd-credit-card {
        padding: 20px;
        border-radius: 12px;
        /* CRITICAL FIX: Allow height to grow automatically so fields aren't cut off */
        aspect-ratio: auto;
        height: auto;
        min-height: 240px;
        display: flex;
        flex-direction: column;
        gap: 15px; /* Consistent spacing between rows */
        justify-content: flex-start;
    }
    .mpd-card-input-group label {
        font-size: 10px;
        margin-bottom: 3px;
    }
    .mpd-card-input {
        font-size: 14px !important; /* Force smaller font on mobile */
        padding: 8px 10px !important;
    }
    /* Specific fix for card number on mobile to override inline styles */
    #mpd_card_number {
        font-size: 15px !important; 
        letter-spacing: 1px !important; /* Reduce spacing to fit */
    }
    .mpd-card-chip {
        width: 35px;
        height: 25px;
    }
    .mpd-logo-visa {
        font-size: 14px;
    }
    .mpd-logo-mastercard {
        font-size: 9px;
    }
    
    /* Reset margins because we use gap on the container now */
    .mpd-card-top-row {
        margin-bottom: 0;
    }
    .mpd-card-middle-row {
        margin: 0;
    }
    .mpd-card-bottom-row {
        margin-bottom: 0;
        gap: 15px;
    }
    
    /* Adjust placeholder font size on mobile */
    .mpd-card-input::placeholder {
        font-size: 13px;
    }
}


/* Buttons */
.mpd-donation-footer {
    margin-top: 40px;
    text-align: center;
}

#submit-donation {
    background-color: var(--mpd-blue);
    color: white;
    font-size: 1.1rem;
    font-weight: 600;
    padding: 14px 40px;
    border: none;
    border-radius: 50px; /* Pill shape */
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 4px 6px rgba(13, 110, 253, 0.3);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

@media (max-width: 480px) {
    #submit-donation {
        font-size: 0.85rem;
        padding: 12px 24px;
        letter-spacing: 0.3px;
    }
}

#submit-donation:hover {
    background-color: var(--mpd-blue-dark);
    transform: translateY(-1px);
    box-shadow: 0 6px 12px rgba(13, 110, 253, 0.3);
}

#submit-donation:disabled {
    background-color: var(--mpd-gray);
    cursor: not-allowed;
    transform: none;
}

/* Camera Buttons */
#btn-open-camera, #btn-take-photo, #btn-close-camera, #btn-retake {
    padding: 8px 16px;
    border-radius: 4px;
    border: none;
    cursor: pointer;
    font-weight: 500;
    margin-right: 5px;
    transition: background 0.2s;
}

#btn-open-camera {
    background-color: var(--mpd-gray); /* Secondary gray */
    color: white;
}

#btn-open-camera:hover {
    background-color: #5c636a;
}

#btn-take-photo {
    background-color: var(--mpd-green);
    color: white;
}

/* Success/Error Messages */
.donation-success {
    display: inline-block;
    padding: 15px 20px;
    background-color: #d1e7dd;
    color: #0f5132;
    border-radius: 8px;
    border: 1px solid #badbcc;
    margin-top: 20px;
    font-weight: 600;
}

.donation-error {
    display: inline-block;
    padding: 15px 20px;
    background-color: #f8d7da;
    color: #842029;
    border-radius: 8px;
    border: 1px solid #f5c2c7;
    margin-top: 20px;
    font-weight: 600;
}

#camera-container {
    background: #000;
    padding: 10px;
    border-radius: 8px;
    text-align: center;
}

#camera-preview {
    text-align: center;
    padding: 10px;
    border: 1px solid var(--mpd-border);
    border-radius: 8px;
    background: var(--mpd-light);
}

#camera-preview img {
    border-radius: 4px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    max-width: 100%;
    margin-bottom: 10px;
}

/* --- Remove Number Arrows --- */
input[type=number]::-webkit-inner-spin-button, 
input[type=number]::-webkit-outer-spin-button { 
  -webkit-appearance: none; 
  margin: 0; 
}
input[type=number] {
  -moz-appearance: textfield;
}

/* --- Info Modal Styles --- */
.mpd-modal {
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease;
}

.mpd-modal.open {
    opacity: 1;
    visibility: visible;
}

.mpd-modal-content {
    background-color: #fefefe;
    margin: auto;
    padding: 30px;
    border: 1px solid #888;
    width: 90%;
    max-width: 600px;
    border-radius: 12px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    position: relative;
    font-size: 14px;
    line-height: 1.6;
    transform: translateY(-20px);
    transition: transform 0.3s ease;
}

.mpd-modal.open .mpd-modal-content {
    transform: translateY(0);
}

.mpd-modal-content h4 {
    margin-top: 0;
    margin-bottom: 20px;
    font-size: 18px;
    color: #333;
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
}

.mpd-modal-close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    line-height: 20px;
    position: absolute;
    right: 20px;
    top: 20px;
}

.mpd-modal-close:hover,
.mpd-modal-close:focus {
    color: black;
    text-decoration: none;
    cursor: pointer;
}
}