/* Simple Custom Popup Modal */

/* Overlay background */
.simple-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    display: none;
}

.simple-modal-overlay.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Modal container */
.simple-modal {
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
}

/* Modal header */
.simple-modal-header {
    background: #007bff;
    color: white;
    padding: 15px 20px;
    border-radius: 8px 8px 0 0;
    display: flex;
    justify-content: between;
    align-items: center;
}

.simple-modal-title {
    margin: 0;
    font-size: 1.2rem;
    flex: 1;
}

.simple-modal-close {
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.2s;
}

.simple-modal-close:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

/* Modal body */
.simple-modal-body {
    padding: 20px;
}

/* Modal footer */
.simple-modal-footer {
    padding: 15px 20px;
    border-top: 1px solid #dee2e6;
    background: #f8f9fa;
    border-radius: 0 0 8px 8px;
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

/* Form styles */
.form-group {
    margin-bottom: 15px;
}

.form-label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: #333;
}

.form-control, .form-select {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.form-control:focus, .form-select:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
}

.form-text {
    font-size: 12px;
    color: #666;
    margin-top: 3px;
}

/* Buttons */
.btn {
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    text-decoration: none;
    display: inline-block;
    transition: background-color 0.2s;
}

.btn-primary {
    background-color: #007bff;
    color: white;
}

.btn-primary:hover {
    background-color: #0056b3;
}

.btn-secondary {
    background-color: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background-color: #545b62;
}

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

/* Form validation */
.form-control.is-invalid, .form-select.is-invalid {
    border-color: #dc3545;
}

/* Alert messages */
.alert {
    padding: 12px;
    margin: 10px 0;
    border-radius: 4px;
    border: 1px solid transparent;
}

.alert-danger {
    background-color: #f8d7da;
    border-color: #f5c6cb;
    color: #721c24;
}

.alert-success {
    background-color: #d4edda;
    border-color: #c3e6cb;
    color: #155724;
}

/* Loading spinner */
.spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s linear infinite;
    margin-right: 8px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Responsive */
@media (max-width: 768px) {
    .simple-modal {
        width: 95%;
        margin: 10px;
    }
    
    .simple-modal-header,
    .simple-modal-body,
    .simple-modal-footer {
        padding: 15px;
    }
}

/* Success alert positioning */
#success-alert-container {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    min-width: 300px;
    max-width: 500px;
}

/* QR Code Modal positioning */
#qrCodeModal .modal-dialog {
    max-width: 500px;
}

/* Override Bootstrap's default modal centering */
#qrCodeModal.modal {
    padding-right: 0 !important;
}

#qrCodeModal .modal-dialog.position-relative {
    margin: 0 auto;
    transform: none !important;
}

/* Ensure QR code is properly sized */
#qrcode-canvas {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 0 auto;
    padding: 10px;
    background-color: white;
    border-radius: 4px;
}
