:root {
    --shell-primary: #0A66C2;
    --shell-bg: #f4f7f9;
}

.shell-body { font-family: 'Segoe UI', sans-serif; background: var(--shell-bg); margin: 0; padding: 0; padding-bottom: 100px; }

.shell-header-wrapper { position: sticky; top: 0; z-index: 2000; padding: 0px 15px 0 15px; background: var(--shell-bg); /* Ensure the wrapper itself has a background color */}
.shell-header {
    background: linear-gradient(135deg, #1f78d6 0%, var(--shell-primary) 100%);
    color: white; padding: 1.2rem 1.8rem; display: flex; align-items: center;
    justify-content: space-between; border-radius: 24px 24px 0 0;
}

.shell-brand-right { text-align: right; }
.shell-logo { font-size: 1.25rem; font-weight: 800; line-height: 1; }
.shell-subtitle { font-size: 0.8rem; opacity: 0.9; margin-top: 4px; font-weight: 400; text-transform: capitalize; }

/* Left Slot Styling */
.shell-header-left-slot { display: flex; align-items: center; }
.shell-back-btn { width: 40px; height: 40px; border-radius: 50%; background: rgba(255,255,255,0.2); display: flex; align-items: center; justify-content: center; cursor: pointer; }

/* Dashboard-specific logo/photo in header */
.shell-header-user-img { width: 40px; height: 40px; border-radius: 50%; border: 2px solid white; object-fit: cover; }

.shell-nav-bar {
    position: fixed; bottom: 0; width: 100%; background: white; display: flex; 
    padding: 15px 0; border-radius: 25px 25px 0 0; box-shadow: 0 -10px 30px rgba(0,0,0,0.05);
}
.shell-nav-item { flex: 1; text-align: center; color: #b2bec3; text-decoration: none; font-size: 0.75rem; }
.shell-nav-item i { font-size: 1.4rem; display: block; margin-bottom: 4px; }
.shell-nav-item.active { color: var(--shell-primary); font-weight: 700; }

/* Glossy Professional Modal */
.shell-modal-overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100vw; height: 100vh;
    background: rgba(15, 23, 42, 0.5); /* Modern Navy Tint */
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: none; /* Controlled by JS */
    align-items: center;
    justify-content: center;
    z-index: 99999;
    padding: 20px;
    box-sizing: border-box;
}

.shell-modal-overlay.active { display: flex; }

.shell-modal-card {
    background: rgba(255, 255, 255, 0.95);
    width: 100%;
    max-width: 340px;
    border-radius: 32px;
    border: 1px solid rgba(255, 255, 255, 0.4);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    overflow: hidden;
    animation: modalSlideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.sm-icon-wrapper {
    width: 70px; height: 70px;
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    margin: 30px auto 15px;
    color: var(--shell-primary);
    font-size: 28px;
    border: 4px solid white;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.05);
}

.sm-body { padding: 0 25px; text-align: center; }
.sm-body h3 { 
    margin: 0 0 8px; font-size: 1.3rem; 
    color: #0f172a; font-weight: 800; 
}
.sm-body p { 
    margin: 0 0 30px; color: #64748b; 
    font-size: 1rem; line-height: 1.6; 
}

.sm-footer { 
    padding: 0 20px 25px; 
    display: flex; gap: 12px; 
}

/* Glossy Button Effects */
.sm-btn {
    flex: 1; padding: 15px; border: none; 
    border-radius: 18px; font-weight: 700; 
    font-size: 0.95rem; cursor: pointer; transition: 0.3s;
}

.sm-btn-glossy {
    background: linear-gradient(135deg, #1f78d6 0%, #0A66C2 100%);
    color: white;
    box-shadow: 0 8px 20px rgba(10, 102, 194, 0.3), inset 0 2px 4px rgba(255,255,255,0.3);
}

.sm-btn-glass {
    background: #f1f5f9; color: #475569;
}

.sm-btn:active { transform: scale(0.95); opacity: 0.9; }

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

.shell-modal-card {
    background: white;
    width: 90%;
    max-width: 400px;
    /* FIX: Leave 5% gap on top/bottom */
    max-height: 90vh; 
    border-radius: 28px;
    position: relative;
    display: flex;
    flex-direction: column; /* Allows body to grow/shrink */
    overflow: hidden;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    animation: modalSlideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.sm-body {
    flex: 1; /* Takes up remaining space */
    overflow-y: auto; /* Internal scroll if content is long */
    padding: 0 25px;
    text-align: center;
}

/* Enhanced configuration button */
.config-btn {
    background: #f1f5f9;
    color: #64748b;
    border: none;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.7rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.config-btn:hover {
    background: #0A66C2;
    color: white;
}

.config-btn.configured {
    background: #10b981;
    color: white;
}

/* Amount comparison */
.original-amount {
    text-decoration: line-through;
    color: #94a3b8;
    font-size: 0.75rem;
}

.configured-amount {
    color: #0A66C2;
    font-weight: 800;
}
/* [file name]: shell.css - ADD TO EXISTING FILE */
/* Ensure modal content is properly styled for scrolling */

#sm-message {
    max-height: 60vh; /* Limit height */
    overflow-y: auto; /* Allow scrolling */
    padding-right: 8px; /* Space for scrollbar */
    margin-bottom: 10px;
    /* Reset any transform/translate that might affect positioning */
    transform: none !important;
    position: relative !important;
}

/* Modal container should also reset position */
.shell-modal-card {
    max-height: 85vh;
    overflow-y: auto;
    animation: modalSlideIn 0.3s ease;
    /* Ensure it starts from top */
    align-self: flex-start;
    margin-top: 20px;
}

/* Modal overlay should support scrolling from top */
.shell-modal-overlay {
    align-items: flex-start; /* Important: Start from top */
    justify-content: center;
    padding-top: 40px;
    padding-bottom: 40px;
    overflow-y: auto;
}

/* Custom scrollbar for modal content */
#sm-message::-webkit-scrollbar {
    width: 6px;
}

#sm-message::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 10px;
}

#sm-message::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 10px;
}

#sm-message::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Animation for modal appearance */
@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* PURE CSS: Auto-scroll only when needed */
.sm-body {
    padding: 25px;
    overflow-y: auto; /* Always allow scroll */
    scrollbar-gutter: stable; /* Reserve space for scrollbar */
    max-height: calc(85vh - 160px);
    
    /* Fancy scrollbar that hides when not scrolling */
    scrollbar-width: thin;
    scrollbar-color: transparent transparent;
    transition: scrollbar-color 0.3s;
}

.sm-body:hover,
.sm-body:focus,
.sm-body:focus-within {
    scrollbar-color: #cbd5e1 #f8fafc;
}

/* Webkit scrollbar styling */
.sm-body::-webkit-scrollbar {
    width: 8px;
}

.sm-body::-webkit-scrollbar-track {
    background: transparent;
}

.sm-body::-webkit-scrollbar-thumb {
    background: transparent;
    border-radius: 4px;
}

.sm-body:hover::-webkit-scrollbar-thumb,
.sm-body:focus::-webkit-scrollbar-thumb,
.sm-body:focus-within::-webkit-scrollbar-thumb {
    background: #cbd5e1;
}

.sm-body:hover::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}
/* Add to your CSS file or create a style tag */
.shell-modal-overlay:not(.active) {
    display: none !important;
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
}

#pg-gateway-modal:not(.active) {
    display: none !important;
}





/* Add this to your CSS or create a style tag */
body.modal-open {
    overflow: auto !important;
}

body:has(.shell-modal-overlay.active),
body:has(#pg-gateway-modal.active) {
    overflow: hidden !important;
}

/* Ensure only one modal is visible at a time */
.shell-modal-overlay.active ~ .shell-modal-overlay,
#pg-gateway-modal.active ~ #pg-gateway-modal,
.shell-modal-overlay.active ~ #pg-gateway-modal,
#pg-gateway-modal.active ~ .shell-modal-overlay {
    display: none !important;
    opacity: 0 !important;
    z-index: -9999 !important;
}

/* Force hide all non-active modals */
.shell-modal-overlay:not(.active),
#pg-gateway-modal:not(.active) {
    display: none !important;
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
    z-index: -1 !important;
}

/* Force modal visibility */
#pg-gateway-modal {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    background: rgba(0, 0, 0, 0.5) !important;
    display: none !important;
    align-items: center !important;
    justify-content: center !important;
    z-index: 99998 !important;
    opacity: 0 !important;
    transition: opacity 0.3s ease !important;
}

#pg-gateway-modal.active {
    display: flex !important;
    opacity: 1 !important;
}

#pg-gateway-modal .shell-modal {
    background: white !important;
    border-radius: 20px !important;
    max-width: 450px !important;
    width: 90% !important;
    max-height: 80vh !important;
    overflow: hidden !important;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3) !important;
}

/* Add to your CSS or create a style tag */
#pg-gateway-modal .shell-modal {
    background: white;
    border-radius: 24px;
    max-width: 420px;
    width: 90%;
    max-height: 85vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    margin: 20px; /* Add margin for smaller screens */
}

#pg-gateway-modal .shell-modal-header {
    flex-shrink: 0;
    padding: 25px 25px 15px 25px;
}

#pg-gateway-modal .shell-modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 0 25px 25px 25px;
    min-height: 200px;
    display: flex;
    flex-direction: column;
}

#pg-gateway-modal .sm-footer {
    flex-shrink: 0;
    padding: 20px 25px;
    background: #f8fafc;
    border-top: 1px solid #e2e8f0;
    display: flex;
    gap: 12px;
}

#pg-status-text {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

/* Ensure buttons have proper spacing */
#pg-status-text .complete-payment-btn,
#pg-status-text .view-history-btn {
    margin-top: 15px;
    width: 100%;
    box-sizing: border-box;
}

/* Responsive adjustments */
@media (max-width: 480px) {
    #pg-gateway-modal .shell-modal {
        max-width: 95%;
        margin: 10px;
        max-height: 90vh;
    }
    
    #pg-gateway-modal .shell-modal-body {
        padding: 0 20px 20px 20px;
    }
    
    #pg-gateway-modal .sm-footer {
        padding: 15px 20px;
        flex-direction: column;
    }
    
    #pg-gateway-modal .sm-footer .sm-btn {
        width: 100%;
        margin: 5px 0;
    }
}

/* Add clean styles for payment gateway */
#pg-gateway-modal .shell-modal {
    background: white;
    border-radius: 24px;
    max-width: 420px;
    width: 90%;
    max-height: 80vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    margin: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
}

#pg-gateway-modal .shell-modal-header {
    flex-shrink: 0;
    padding: 25px 25px 20px 25px;
    background: linear-gradient(135deg, #0A66C2 0%, #0d4b8a 100%);
    color: white;
    position: relative;
}

#pg-gateway-modal .shell-modal-header .sm-icon-container {
    background: rgba(255, 255, 255, 0.2);
    width: 50px;
    height: 50px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 15px;
    font-size: 1.3rem;
}

#pg-gateway-modal .shell-modal-header h3 {
    color: white;
    font-size: 1.3rem;
    margin: 0;
    font-weight: 700;
}

#pg-gateway-modal .shell-modal-header .sm-close {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

#pg-gateway-modal .shell-modal-header .sm-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

#pg-gateway-modal .shell-modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 25px;
    display: flex;
    flex-direction: column;
}

#pg-gateway-modal .sm-footer {
    flex-shrink: 0;
    padding: 20px 25px;
    background: #f8fafc;
    border-top: 1px solid #e2e8f0;
}

/* Transaction details - clean vertical layout */
.transaction-details {
    background: #f8fafc;
    border-radius: 12px;
    padding: 20px;
    margin: 20px 0;
    border: 1px solid #e2e8f0;
}

.detail-row {
    margin-bottom: 15px;
    display: flex;
    flex-direction: column;
}

.detail-row:last-child {
    margin-bottom: 0;
}

.detail-label {
    font-size: 0.85rem;
    color: #64748b;
    font-weight: 500;
    margin-bottom: 4px;
}

.detail-value {
    font-size: 1rem;
    color: #1e293b;
    font-weight: 600;
    word-break: break-all;
}

.detail-value.amount {
    font-size: 1.5rem;
    font-weight: 700;
    color: #0A66C2;
}

.detail-value.status {
    color: #f59e0b;
    font-weight: 600;
}

/* Action buttons */
.action-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 20px;
}

.action-btn {
    padding: 16px;
    border-radius: 12px;
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: all 0.2s;
    width: 100%;
}

.action-btn.primary {
    background: #10b981;
    color: white;
}

.action-btn.primary:hover {
    background: #0da371;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.action-btn.secondary {
    background: #f1f5f9;
    color: #64748b;
    border: 1px solid #e2e8f0;
}

.action-btn.secondary:hover {
    background: #e2e8f0;
}

/* Payment success state */
.payment-success {
    text-align: center;
}

.success-icon {
    font-size: 3.5rem;
    color: #10b981;
    margin-bottom: 20px;
}

.success-message {
    font-size: 1.3rem;
    color: #1e293b;
    font-weight: 700;
    margin-bottom: 10px;
}

.success-details {
    background: #f0f9ff;
    border-radius: 12px;
    padding: 20px;
    margin: 20px 0;
    border: 1px solid #bfdbfe;
}

/* Responsive */
@media (max-width: 480px) {
    #pg-gateway-modal .shell-modal {
        max-width: 95%;
        margin: 10px;
        max-height: 90vh;
    }
    
    #pg-gateway-modal .shell-modal-header {
        padding: 20px 20px 15px 20px;
    }
    
    #pg-gateway-modal .shell-modal-body {
        padding: 20px;
    }
    
    #pg-gateway-modal .sm-footer {
        padding: 15px 20px;
    }
}