/* Instapay Modal - Professional UI/UX Design */

#instapay-modal {
    position: fixed;
    inset: 0;
    display: none;
    z-index: 99999;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

#instapay-modal.instapay-modal--active {
    display: block;
    animation: fadeIn 0.2s ease-out;
}

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

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

.instapay-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
}

.instapay-modal__dialog {
    position: relative;
    margin: 3vh auto;
    max-width: 600px;
    max-height: 94vh;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.3s ease-out;
    overflow: hidden;
}

.instapay-modal__content {
    padding: 32px;
    max-height: 94vh;
    overflow-y: auto;
}

.instapay-modal__close {
    position: absolute;
    top: 16px;
    right: 16px;
    background: #ffffff;
    border: 2px solid rgba(99, 102, 241, 0.4);
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.18);
    width: 44px;
    height: 44px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    z-index: 50;
}

.instapay-modal__close:hover {
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 14px 28px rgba(15, 23, 42, 0.22);
}

.instapay-modal__close svg {
    color: #4c1d95;
    width: 22px;
    height: 22px;
    opacity: 1;
}

/* Modal Header */
.instapay-modal__header {
    text-align: center;
    margin-bottom: 32px;
}

.instapay-modal__icon {
    display: inline-flex;
    margin-bottom: 16px;
}

.instapay-modal__header h2 {
    font-size: 28px;
    font-weight: 700;
    margin: 0 0 8px 0;
    color: #1a1a1a;
}

.instapay-modal__subtitle {
    font-size: 15px;
    color: #666;
    margin: 0;
    line-height: 1.5;
}

/* Total Display */
.instapay-total-wrapper {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    padding: 20px 24px;
    border-radius: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.instapay-total-label {
    font-size: 15px;
    font-weight: 500;
    opacity: 0.9;
}

.instapay-total {
    font-size: 24px;
    font-weight: 700;
}

/* Section */
.instapay-section {
    margin-bottom: 24px;
}

.instapay-section__title {
    font-size: 16px;
    font-weight: 600;
    color: #333;
    margin: 0 0 16px 0;
}

/* Accounts List */
.instapay-accounts {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.instapay-account {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.instapay-account:hover {
    border-color: #667eea;
    background: #f8f9ff;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.1);
}

.instapay-account input[type="radio"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.instapay-account:has(input[type="radio"]:checked) {
    border-color: #667eea;
    background: #f8f9ff;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.instapay-account input[type="radio"]:checked ~ .instapay-account__check {
    opacity: 1;
    transform: scale(1);
}

.instapay-account__icon-wrapper {
    flex-shrink: 0;
}

.instapay-account__icon {
    width: 56px;
    height: 56px;
    border-radius: 12px;
    object-fit: cover;
    border: 2px solid #f0f0f0;
}

.instapay-account__icon-placeholder svg {
    display: block;
}

.instapay-account__details {
    flex: 1;
    min-width: 0;
}

.instapay-account__name {
    display: block;
    font-size: 16px;
    font-weight: 600;
    color: #1a1a1a;
    margin-bottom: 4px;
}

.instapay-account__number {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-size: 18px;
    color: #1f2933;
    font-family: 'Courier New', monospace;
    font-weight: 700;
}

.instapay-account__holder {
    display: block;
    margin-top: 4px;
    font-size: 13px;
    color: #4b5563;
}

.instapay-copy-btn {
    background: none;
    border: none;
    padding: 4px;
    border-radius: 6px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #666;
    opacity: 0.7;
    transition: all 0.15s ease;
}

.instapay-copy-btn svg {
    pointer-events: none;
}

.instapay-copy-btn:hover {
    opacity: 1;
    background: rgba(0,0,0,0.05);
}

.instapay-copy-btn:focus-visible {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

.instapay-copy-success {
    color: #0f9d58 !important;
    background: rgba(15, 157, 88, 0.08) !important;
    opacity: 1 !important;
}

.instapay-copy-error {
    color: #d93025 !important;
    background: rgba(217, 48, 37, 0.08) !important;
    opacity: 1 !important;
}

.instapay-account__check {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #667eea;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    opacity: 0;
    transform: scale(0);
    transition: all 0.2s ease;
}

/* Upload Area */
.instapay-upload-wrapper {
    margin-bottom: 20px;
}

.instapay-upload-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px 24px;
    border: 2px dashed #d0d0d0;
    border-radius: 12px;
    background: #fafafa;
    cursor: pointer;
    transition: all 0.2s ease;
}

.instapay-upload-area:hover {
    border-color: #667eea;
    background: #f8f9ff;
}

.instapay-upload-area input[type="file"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.instapay-upload-icon {
    margin-bottom: 16px;
}

.instapay-upload-text {
    font-size: 16px;
    font-weight: 600;
    color: #333;
    margin-bottom: 8px;
}

.instapay-upload-hint {
    font-size: 14px;
    color: #999;
}

.instapay-upload-preview {
    margin-top: 16px;
    max-width: 100%;
}

.instapay-upload-preview img {
    max-width: 100%;
    max-height: 200px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* Actions */
.instapay-actions {
    margin-top: 24px;
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

/* Buttons */
.instapay-button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 14px 28px;
    border: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
}

.instapay-button--primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.instapay-button--primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.instapay-button--primary span,
.instapay-button--primary svg,
.instapay-button--primary {
    color: #fff !important;
    fill: none;
    stroke: #fff;
}

.instapay-button--primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.instapay-button--secondary {
    background: #f5f5f5;
    color: #333;
}

.instapay-button--secondary:hover:not(:disabled) {
    background: #e8e8e8;
}

.instapay-button svg {
    flex-shrink: 0;
}

/* Errors */
.instapay-errors {
    background: #fff5f5;
    color: #c53030;
    padding: 14px 16px;
    border-radius: 8px;
    border-left: 4px solid #c53030;
    font-size: 14px;
    margin-top: 16px;
    display: none;
}

.instapay-errors:not(:empty) {
    display: block;
}

/* No Accounts Message */
.instapay-no-accounts {
    text-align: center;
    padding: 32px;
    color: #999;
    font-size: 15px;
}

/* Responsive */
@media (max-width: 640px) {
    .instapay-modal__dialog {
        margin: 0;
        max-width: 100%;
        max-height: 100vh;
        border-radius: 0;
    }

    .instapay-modal__content {
        padding: 24px;
        max-height: 100vh;
    }

    .instapay-modal__header h2 {
        font-size: 24px;
    }

    .instapay-actions {
        flex-direction: column-reverse;
    }

    .instapay-button {
        width: 100%;
        justify-content: center;
    }
}
