@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&display=swap');

:root {
    --bg-base: #f3f4f6;
    --bg-surface: rgba(255, 255, 255, 0.85);
    --bg-card: rgba(255, 255, 255, 0.98);
    
    --primary: #7c3aed; /* Vibrant Purple */
    --primary-glow: rgba(124, 58, 237, 0.15);
    --secondary: #0ea5e9; /* Sky Blue */
    
    --text-primary: #111827; /* Dark Slate */
    --text-secondary: #4b5563; /* Gray */
    --text-muted: #9ca3af; /* Light Gray */
    
    --success: #10b981; /* Emerald Green */
    --warning: #f59e0b; /* Amber */
    --danger: #ef4444; /* Red */
    
    --border-color: rgba(0, 0, 0, 0.08);
    --border-focus: rgba(124, 58, 237, 0.4);
    
    --font-sans: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --transition-smooth: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

/* Reset */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-base);
    background-image: 
        radial-gradient(at 0% 0%, rgba(124, 58, 237, 0.08) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(14, 165, 233, 0.08) 0px, transparent 50%);
    background-attachment: fixed;
    color: var(--text-primary);
    font-family: var(--font-sans);
    min-height: 100vh;
    overflow-x: hidden;
    line-height: 1.5;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: var(--bg-base);
}
::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
}

/* Dashboard Layout */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar styling */
.sidebar {
    width: 280px;
    background: var(--bg-surface);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-right: 1px solid var(--border-color);
    padding: 2rem 1.5rem;
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    z-index: 100;
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 3rem;
}

.logo-icon {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 1.25rem;
    color: #fff;
    box-shadow: 0 4px 15px var(--primary-glow);
}

.logo-text {
    font-size: 1.5rem;
    font-weight: 800;
    background: linear-gradient(to right, var(--text-primary), var(--text-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: 0.5px;
}

.nav-links {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex-grow: 1;
}

.nav-item a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    border-radius: 12px;
    transition: var(--transition-smooth);
    border: 1px solid transparent;
}

.nav-item.active a, .nav-item a:hover {
    color: var(--primary);
    background: rgba(124, 58, 237, 0.08);
    border-color: rgba(124, 58, 237, 0.1);
}

.nav-item.active a {
    box-shadow: inset 4px 0 0 var(--primary);
    font-weight: 600;
}

.user-profile-menu {
    margin-top: auto;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
}

.user-profile-info {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 1rem;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(124, 58, 237, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
    font-weight: 600;
}

.user-details {
    overflow: hidden;
}

.user-name {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    text-overflow: ellipsis;
}

.user-role {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Main Content styling */
.main-content {
    margin-left: 280px;
    flex-grow: 1;
    padding: 2.5rem;
    min-height: 100vh;
}

.header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2.5rem;
}

.page-title {
    font-size: 2rem;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -0.5px;
}

.page-subtitle {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin-top: 4px;
}

/* Glass Card */
.glass-card {
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 1.8rem;
    margin-bottom: 1.8rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.03);
    transition: var(--transition-smooth);
}

.glass-card:hover {
    border-color: rgba(124, 58, 237, 0.2);
    box-shadow: 0 10px 30px rgba(124, 58, 237, 0.05);
    transform: translateY(-2px);
}

/* Metric Widgets Grid */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2.5rem;
}

.metric-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.metric-data h3 {
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-secondary);
    font-weight: 600;
}

.metric-data p {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-top: 8px;
}

.metric-icon {
    width: 52px;
    height: 52px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.metric-icon.purple { background: rgba(124, 58, 237, 0.1); color: var(--primary); }
.metric-icon.blue { background: rgba(14, 165, 233, 0.1); color: var(--secondary); }
.metric-icon.green { background: rgba(16, 185, 129, 0.1); color: var(--success); }
.metric-icon.amber { background: rgba(245, 158, 11, 0.1); color: var(--warning); }

/* Table styling */
.table-responsive {
    width: 100%;
    overflow-x: auto;
}

.custom-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.custom-table th {
    padding: 16px;
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border-color);
}

.custom-table td {
    padding: 18px 16px;
    font-size: 0.9rem;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
}

.custom-table tr:last-child td {
    border-bottom: none;
}

.custom-table tr {
    transition: var(--transition-smooth);
}

.custom-table tbody tr:hover {
    background: rgba(124, 58, 237, 0.02);
}

/* Badges */
.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 30px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: capitalize;
}

.badge.completed, .badge.approved { background: rgba(16, 185, 129, 0.12); color: var(--success); }
.badge.processing, .badge.pending { background: rgba(245, 158, 11, 0.12); color: var(--warning); }
.badge.failed, .badge.rejected { background: rgba(239, 68, 68, 0.12); color: var(--danger); }
.badge.expired { background: rgba(0, 0, 0, 0.05); color: var(--text-secondary); }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: var(--transition-smooth);
    border: 1px solid transparent;
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), #6d28d9);
    color: #fff;
    box-shadow: 0 4px 15px rgba(124, 58, 237, 0.25);
}

.btn-primary:hover {
    box-shadow: 0 6px 20px rgba(124, 58, 237, 0.35);
    transform: translateY(-1px);
}

.btn-outline {
    background: transparent;
    border-color: var(--border-color);
    color: var(--text-primary);
}

.btn-outline:hover {
    background: rgba(0, 0, 0, 0.02);
    border-color: var(--text-secondary);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.8rem;
    border-radius: 8px;
}

/* Authentication Pages */
.auth-wrapper {
    display: flex;
    min-height: 100vh;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.auth-container {
    width: 100%;
    max-width: 480px;
}

.auth-brand {
    text-align: center;
    margin-bottom: 2rem;
}

/* Form Controls */
.form-group {
    margin-bottom: 1.5rem;
}

.form-label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-secondary);
}

.form-control {
    width: 100%;
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 12px 16px;
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 0.95rem;
    transition: var(--transition-smooth);
}

.form-control:focus {
    outline: none;
    border-color: var(--border-focus);
    box-shadow: 0 0 10px rgba(124, 58, 237, 0.15);
    background: #fff;
}

.form-control::placeholder {
    color: var(--text-muted);
}

.form-control-file {
    padding: 8px 12px;
    background: rgba(0, 0, 0, 0.02);
}

.form-control-file::file-selector-button {
    background: rgba(124, 58, 237, 0.1);
    border: 1px solid rgba(124, 58, 237, 0.15);
    color: var(--primary);
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    margin-right: 12px;
    transition: var(--transition-smooth);
}

.form-control-file::file-selector-button:hover {
    background: var(--primary);
    color: #fff;
}

.form-text {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 6px;
}

/* Alerts */
.alert {
    padding: 14px 20px;
    border-radius: 12px;
    font-size: 0.9rem;
    font-weight: 500;
    margin-bottom: 1.5rem;
    border: 1px solid transparent;
}

.alert-success { background: rgba(16, 185, 129, 0.08); border-color: rgba(16, 185, 129, 0.15); color: #047857; }
.alert-danger { background: rgba(239, 68, 68, 0.08); border-color: rgba(239, 68, 68, 0.15); color: #b91c1c; }
.alert-warning { background: rgba(245, 158, 11, 0.08); border-color: rgba(245, 158, 11, 0.15); color: #b45309; }

/* Tabs Navigation */
.tabs-nav {
    display: flex;
    gap: 10px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 2rem;
}

.tab-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 10px 16px;
    font-family: var(--font-sans);
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: var(--transition-smooth);
}

.tab-btn:hover {
    color: var(--text-primary);
}

.tab-btn.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Copy Input / Key Viewer */
.copy-input-container {
    display: flex;
    gap: 10px;
}

.copy-input-container input {
    flex-grow: 1;
}

/* Code Snippets */
pre {
    background: #1f2937;
    border-radius: 12px;
    padding: 1.25rem;
    overflow-x: auto;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.85rem;
    border: 1px solid var(--border-color);
}

code {
    color: #38bdf8; /* Light Sky Blue for code readability on dark backgrounds */
}

/* Checkout Page UI */
.checkout-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 1.5rem;
}

.checkout-card {
    width: 100%;
    max-width: 440px;
    overflow: hidden;
}

.checkout-header {
    text-align: center;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 1.5rem;
    margin-bottom: 1.5rem;
}

.checkout-merchant {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.2px;
}

.checkout-amount {
    font-size: 2.2rem;
    font-weight: 800;
    color: var(--text-primary);
    margin-top: 10px;
    background: linear-gradient(135deg, var(--text-primary), var(--primary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.checkout-methods {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.payment-method-btn {
    border: 2px solid var(--border-color);
    background: #fff;
    border-radius: 16px;
    padding: 1.5rem 1rem;
    text-align: center;
    cursor: pointer;
    transition: var(--transition-smooth);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.payment-method-btn:hover {
    background: rgba(0, 0, 0, 0.01);
    border-color: var(--text-muted);
}

.payment-method-btn.selected {
    border-color: var(--primary);
    background: rgba(124, 58, 237, 0.05);
    box-shadow: 0 0 15px rgba(124, 58, 237, 0.1);
}

.method-logo {
    height: 48px;
    object-fit: contain;
    border-radius: 8px;
}

.method-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
}

/* Polling Loader Animation */
.loader-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid var(--border-color);
    border-top: 4px solid var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 20px auto;
}

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

.pulse-loader {
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 1; }
}

/* Success Screen Checkout */
.checkout-success-icon {
    width: 64px;
    height: 64px;
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    margin: 20px auto;
}

/* Mobile and Tablet Responsiveness */
@media (max-width: 991px) {
    .metrics-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }
    .sidebar {
        width: 80px;
        padding: 2rem 0.8rem;
    }
    .logo-text, .user-details, .nav-item span {
        display: none;
    }
    .logo-container {
        justify-content: center;
        margin-bottom: 2rem;
    }
    .main-content {
        margin-left: 80px;
        padding: 1.5rem;
    }
    .nav-item a {
        justify-content: center;
        padding: 12px;
    }
}

/* Mobile Top Bar Navigation */
.mobile-top-bar {
    display: none;
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border-color);
    padding: 12px 20px;
    position: sticky;
    top: 0;
    z-index: 1010;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 10px rgba(0,0,0,0.02);
}

.mobile-logo {
    display: flex;
    align-items: center;
    gap: 8px;
}

.mobile-logo .logo-icon {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 800;
    color: white;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    display: flex;
    align-items: center;
    justify-content: center;
}

.mobile-logo .logo-text {
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -0.5px;
}

.mobile-menu-toggle {
    background: transparent;
    border: none;
    font-size: 1.4rem;
    color: var(--text-primary);
    cursor: pointer;
    padding: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Sidebar Close Button */
.sidebar-close-btn {
    display: none;
    position: absolute;
    top: 18px;
    right: 18px;
    background: transparent;
    border: none;
    font-size: 1.4rem;
    color: var(--text-muted);
    cursor: pointer;
    padding: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Sidebar Overlay Backdrop */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(4px);
    z-index: 1015;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.sidebar-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

@media (max-width: 768px) {
    .mobile-top-bar {
        display: flex;
    }
    
    .sidebar-overlay {
        display: block;
    }
    
    .sidebar-close-btn {
        display: block;
    }
    
    .app-container {
        flex-direction: column;
    }
    
    .sidebar {
        position: fixed;
        top: 0;
        left: -285px; /* Slide out drawer */
        width: 280px;
        height: 100vh;
        z-index: 1020;
        transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        border-right: 1px solid var(--border-color);
        box-shadow: 10px 0 30px rgba(0, 0, 0, 0.05);
        display: flex;
        flex-direction: column;
        justify-content: space-between;
        padding: 2.2rem 1.5rem 1.8rem;
    }
    
    .sidebar.active {
        left: 0; /* Open state */
    }
    
    .logo-container {
        margin-bottom: 2.2rem;
        display: flex;
        justify-content: flex-start;
        width: 100%;
    }
    
    .logo-text {
        display: inline-block;
        font-size: 1.4rem;
    }
    
    .nav-links {
        display: flex;
        flex-direction: column;
        gap: 8px;
        width: 100%;
        margin-bottom: auto;
    }
    
    .nav-item {
        margin-bottom: 0;
        width: 100%;
    }
    
    .nav-item a {
        justify-content: flex-start;
        padding: 12px 16px;
        font-size: 0.98rem;
    }
    
    .nav-item span {
        display: inline-block;
        margin-left: 12px;
    }
    
    .user-profile-menu {
        margin-top: auto;
        padding-top: 1.5rem;
        border-top: 1px solid var(--border-color);
        display: flex;
        align-items: center;
        width: 100%;
    }
    
    .user-details {
        display: block;
    }
    
    .main-content {
        margin-left: 0;
        padding: 20px 15px;
        width: 100%;
    }
    
    .metrics-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .dashboard-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .tab-btn {
        padding: 8px 12px;
        font-size: 0.85rem;
    }
    
    .tabs-nav {
        flex-wrap: wrap;
        gap: 5px;
    }
    
    .custom-table th, .custom-table td {
        padding: 10px;
        font-size: 0.85rem;
    }
    
    .card {
        padding: 15px;
    }
    
    .header-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
        margin-bottom: 1.5rem;
    }
}
