/* Global Styles */
:root {
    --primary-color: #2563eb;
    --primary-dark: #1d4ed8;
    --secondary-color: #7c3aed;
    --accent-color: #10b981;
    --dark-color: #1f2937;
    --light-color: #f9fafb;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --info-color: #0ea5e9;
}

body {
    font-family: 'Inter', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    background-attachment: fixed;
    color: #374151;
}

/* Navigation */
.navbar-brand {
    font-weight: 700;
    font-size: 1.5rem;
    letter-spacing: -0.5px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.navbar-brand i {
    font-size: 1.8rem;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    color: transparent;
}

.navbar-brand .logo-text {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    color: transparent;
    font-weight: 800;
}

/* Updated navbar theme */
.navbar {
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color)) !important;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

/* Card Styles */
.card {
    border: none;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    border-radius: 1rem;
    transition: box-shadow 0.15s ease-in-out, transform 0.2s ease;
    background-color: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.card:hover {
    box-shadow: 0 8px 15px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.package-card {
    border: 2px solid #e9ecef;
    transition: all 0.3s ease;
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
}

.package-card:hover {
    border-color: var(--primary-color);
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(37, 99, 235, 0.15);
}

/* Button Styles */
.btn {
    border-radius: 0.5rem;
    font-weight: 500;
    padding: 0.5rem 1rem;
    transition: all 0.2s ease;
}

.btn-primary {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
}

.btn-primary:hover {
    background-color: var(--primary-dark);
    border-color: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(37, 99, 235, 0.3);
}

.btn-success {
    background: linear-gradient(135deg, var(--accent-color), #059669);
    border-color: var(--accent-color);
}

.btn-success:hover {
    background: linear-gradient(135deg, #059669, var(--accent-color));
    transform: translateY(-1px);
}

.btn-warning {
    background: linear-gradient(135deg, var(--warning-color), #d97706);
    border-color: var(--warning-color);
}

.btn-warning:hover {
    background: linear-gradient(135deg, #d97706, var(--warning-color));
    transform: translateY(-1px);
}

.btn-danger {
    background: linear-gradient(135deg, var(--danger-color), #dc2626);
    border-color: var(--danger-color);
}

.btn-danger:hover {
    background: linear-gradient(135deg, #dc2626, var(--danger-color));
    transform: translateY(-1px);
}

/* Form Styles */
.form-control, .form-select {
    border-radius: 0.5rem;
    border: 1px solid #d1d5db;
    padding: 0.75rem 1rem;
    transition: all 0.2s ease;
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.25rem rgba(37, 99, 235, 0.25);
}

/* Table Styles */
.table {
    border-collapse: collapse;
    background-color: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(10px);
    border-radius: 0.5rem;
    overflow: hidden;
}

.table th {
    border-top: none;
    font-weight: 600;
    background-color: rgba(37, 99, 235, 0.1);
}

.table td, .table th {
    vertical-align: middle;
    padding: 0.75rem;
}

/* Badge Styles */
.badge {
    border-radius: 0.375rem;
    font-weight: 500;
}

.badge.bg-success {
    background-color: var(--success-color) !important;
}

.badge.bg-warning {
    background-color: var(--warning-color) !important;
}

.badge.bg-danger {
    background-color: var(--danger-color) !important;
}

.badge.bg-info {
    background-color: var(--info-color) !important;
}

/* Footer */
footer {
    margin-top: auto;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    color: white;
}

/* Timeline Styles (for roadmap page) */
.timeline {
    position: relative;
    padding: 2rem 0;
}

.timeline::before {
    content: '';
    position: absolute;
    top: 0;
    left: 1rem;
    height: 100%;
    width: 2px;
    background: linear-gradient(to bottom, var(--primary-color), var(--secondary-color));
}

.timeline-item {
    position: relative;
    margin-bottom: 2rem;
    padding-left: 2.5rem;
}

.timeline-marker {
    position: absolute;
    left: 0;
    top: 0.5rem;
    width: 1.5rem;
    height: 1.5rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
}

.timeline-content {
    background: white;
    padding: 1.5rem;
    border-radius: 0.5rem;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    .timeline::before {
        left: 0.5rem;
    }
    
    .timeline-item {
        padding-left: 1.5rem;
    }
    
    .timeline-marker {
        left: 0;
    }
}

/* Mobile Responsive Enhancements */
@media (max-width: 767.98px) {
    .container, .container-fluid {
        padding-left: 15px;
        padding-right: 15px;
    }
    
    .display-4 {
        font-size: 1.8rem;
        line-height: 1.2;
    }
    
    .display-6 {
        font-size: 1.5rem;
    }
    
    .btn-lg {
        padding: 0.5rem 1rem;
        font-size: 0.9rem;
    }
    
    .card {
        margin-bottom: 1rem;
    }
    
    .row {
        margin-left: -10px;
        margin-right: -10px;
    }
    
    .col-md-4, .col-md-6, .col-md-8, .col-md-12 {
        padding-left: 10px;
        padding-right: 10px;
    }
    
    .hero-section {
        padding: 2rem 0 !important;
    }
    
    .table-responsive {
        font-size: 0.85rem;
    }
    
    .table th,
    .table td {
        padding: 0.5rem;
    }
    
    .navbar-brand img {
        height: 30px;
    }
    
    .main-content {
        padding-left: 10px;
        padding-right: 10px;
    }
}

/* Extra small devices (phones, less than 576px) */
@media (max-width: 575.98px) {
    .display-4 {
        font-size: 1.5rem;
    }
    
    .lead {
        font-size: 1rem;
    }
    
    .btn {
        width: 100%;
        margin-bottom: 0.5rem;
    }
    
    .d-flex.gap-3 {
        flex-direction: column;
    }
    
    .btn-group {
        flex-direction: column;
    }
    
    .text-center-mobile {
        text-align: center;
    }
    
    .hero-section h1 {
        font-size: 1.8rem;
    }
    
    .hero-section p {
        font-size: 0.95rem;
    }
}

/* Alert Styles */
.alert {
    border-radius: 0.5rem;
    border: none;
    backdrop-filter: blur(10px);
}

.alert-primary {
    background-color: rgba(37, 99, 235, 0.15);
    border-left: 4px solid var(--primary-color);
}

.alert-success {
    background-color: rgba(16, 185, 129, 0.15);
    border-left: 4px solid var(--success-color);
}

.alert-warning {
    background-color: rgba(245, 158, 11, 0.15);
    border-left: 4px solid var(--warning-color);
}

.alert-danger {
    background-color: rgba(239, 68, 68, 0.15);
    border-left: 4px solid var(--danger-color);
}

/* Utility Classes */
.text-break {
    word-break: break-word;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, var(--primary-dark), #6d28d9);
}

/* Sidebar styles */
.sidebar {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    padding: 1rem 0;
    width: 250px; /* Fixed width for consistency */
    overflow-y: auto; /* Make sidebar scrollable */
}

/* Ensure main content doesn't overlap with sidebar */
.main-content {
    padding-top: 20px;
    padding-bottom: 20px;
}

@media (min-width: 768px) {
    .main-content {
        margin-left: 0; /* Use Bootstrap grid instead of margin */
    }
    
    .sidebar {
        /* No fixed height for positioning */
    }
    
    .sidebar.collapsed {
        width: 0;
        margin-left: 0;
        display: none;
    }
    
    .main-content.sidebar-collapsed {
        margin-left: 0;
    }
}

@media (max-width: 767.98px) {
    .sidebar {
        width: 100%;
        position: relative;
        height: auto;
        padding: 0;
    }
    
    .main-content {
        margin-left: 0;
        margin-top: 1rem;
    }
}

.sidebar-sticky {
    position: -webkit-sticky;
    position: sticky;
    top: 56px; /* Align with navbar height */
    height: auto;
    padding-top: .5rem;
    overflow-x: hidden;
    overflow-y: auto; /* Scrollable */
}

.sidebar .nav-link {
    font-weight: 500;
    color: #374151;
    border-radius: 0.5rem;
    margin: 0.25rem 0.5rem;
    transition: all 0.2s ease;
}

.sidebar .nav-link.active {
    color: var(--primary-color);
    background-color: rgba(37, 99, 235, 0.1);
    border-left: 4px solid var(--primary-color);
    font-weight: 600;
}

.sidebar .nav-link:hover {
    color: var(--primary-color);
    background-color: rgba(37, 99, 235, 0.05);
}

/* Dashboard stats cards */
.dashboard-stats {
    margin-bottom: 2rem;
}

.stat-card {
    border-left: 4px solid var(--primary-color);
    transition: transform 0.2s;
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.1);
}

/* Form enhancements */
.form-control:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(37, 99, 235, 0.25);
}

/* Table enhancements */
.table th {
    border-top: none;
    font-weight: 600;
}



/* Alert enhancements */
.alert {
    border: none;
    border-radius: 8px;
}

/* Card enhancements */
.card {
    border: none;
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    transition: box-shadow 0.3s;
    background-color: rgba(255, 255, 255, 0.85);
}

.card:hover {
    box-shadow: 0 8px 15px rgba(0, 0, 0, 0.1);
}

/* Navigation enhancements */
.navbar-brand {
    font-weight: 600;
}

.navbar-nav .nav-link {
    font-weight: 500;
    color: rgba(255, 255, 255, 0.9) !important;
    transition: color 0.2s ease;
}

.navbar-nav .nav-link:hover {
    color: white !important;
}

/* Footer */
footer {
    margin-top: 3rem;
}

/* Additional utility classes */
.text-primary {
    color: var(--primary-color) !important;
}

.bg-primary {
    background-color: var(--primary-color) !important;
}

/* Active state for sidebar links */
.nav-link.active i {
    color: var(--primary-color);
}

/* Responsive sidebar adjustments */
@media (min-width: 768px) {
    .sidebar .nav-link {
        padding-left: 1.5rem;
        padding-right: 1.5rem;
    }
}

/* Custom theme colors */
.bg-gradient-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color)) !important;
    color: white;
}

.text-gradient {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    color: transparent;
}

.shadow-lg {
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05) !important;
}

/* Sidebar heading */
.sidebar-heading {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: #6b7280;
    font-weight: 600;
}

/* Modal backdrop fix */
.modal-backdrop {
    z-index: 1040 !important; /* Ensure proper z-index */
}

.modal-open {
    padding-right: 0 !important; /* Prevent body scroll lock */
}

/* Ensure modals work properly */
.modal {
    z-index: 1050 !important; /* Higher than backdrop */
}

/* Fix for stuck backdrop */
body.modal-open .modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

/* Ensure clickable elements work when modal is open */
.modal-open {
    overflow: auto;
}

/* Fix alignment issues for public pages */
.container, .container-fluid {
    margin-left: auto;
    margin-right: auto;
}

/* Fix public page alignment - ensure content starts from left */
main.main-content.col-12 {
    margin-left: 0;
    padding-left: 0;
    padding-right: 0;
}

/* Ensure proper alignment for public pages specifically */
body .container-fluid > .row > main.main-content.col-12 {
    flex: 0 0 100%;
    max-width: 100%;
    padding-left: 0;
    padding-right: 0;
}

/* Reset any potential offset */
.col-12 {
    padding-left: 15px;
    padding-right: 15px;
}

/* Specific fix for public pages - when no sidebar is present */
.container-fluid > .row main.main-content.col-12 {
    margin-left: 0;
    width: 100%;
    max-width: 100%;
    flex: 1 1 auto;
}

/* Ensure public pages content is properly aligned */
main.main-content.col-12 > div.mt-4 {
    margin-left: 0;
    margin-right: 0;
    width: 100%;
}

/* Fixes for pages with sidebar - user and admin dashboards */
main.main-content.col-md-9.col-lg-10,
main.main-content.col-md-9 {
    padding-left: 15px;
    padding-right: 15px;
}

/* Corrected page alignment fixes */
.container-fluid {
    padding-left: 15px;
    padding-right: 15px;
}

.container {
    padding-left: 15px;
    padding-right: 15px;
}

/* Additional fixes for different page layouts */
main.main-content.col-12 {
    padding-left: 0;
    padding-right: 0;
}

/* Ensure proper spacing for dashboard layouts - fix alignment issues */
main.main-content.col-md-9.ms-sm-auto.col-lg-10.px-md-4 {
    padding-left: 15px;
    padding-right: 15px;
}

/* Ensure proper alignment for dashboard content */
main.main-content .mt-4 {
    margin-left: 0;
    margin-right: 0;
}

/* Specific fix for sidebar alignment */
#sidebar {
    padding-left: 0;
    padding-right: 0;
    z-index: 100; /* Standard z-index for sidebar */
}

/* Ensure proper alignment between sidebar and main content */
.container-fluid > .row {
    margin-left: 0;
    margin-right: 0;
}

/* Ensure main content is properly positioned next to sidebar */
main.main-content.col-md-9.col-lg-10 {
    padding-left: 15px;
    padding-right: 15px;
}

/* Fix for proper sidebar/main content positioning */
.container-fluid > .row {
    position: relative;
    display: flex;
    flex-wrap: wrap;
}

/* Ensure proper layering */
#sidebar, main.main-content {
    position: relative;
}

/* Make sure main content doesn't overlap with sidebar */
main.main-content {
    min-height: 1px; /* Ensure element takes up space */
}

/* Ensure sidebar and main content are properly positioned side by side */
.row {
    display: flex;
    flex-wrap: wrap;
}

#sidebar {
    flex: 0 0 auto; /* Don't grow or shrink, use auto width */
}

main.main-content {
    flex: 1 1 0%; /* Grow to fill remaining space */
}

/* Ensure proper alignment for all content */
.text-start, .text-left {
    text-align: left !important;
}

.text-center {
    text-align: center !important;
}

.text-end, .text-right {
    text-align: right !important;
}

/* Ensure proper Bootstrap grid alignment */
.row {
    margin-left: 0;
    margin-right: 0;
}

.col, .col-1, .col-2, .col-3, .col-4, .col-5, .col-6, .col-7, .col-8, .col-9, .col-10, .col-11, .col-12,
.col-sm, .col-sm-1, .col-sm-2, .col-sm-3, .col-sm-4, .col-sm-5, .col-sm-6, .col-sm-7, .col-sm-8, .col-sm-9, .col-sm-10, .col-sm-11, .col-sm-12,
.col-md, .col-md-1, .col-md-2, .col-md-3, .col-md-4, .col-md-5, .col-md-6, .col-md-7, .col-md-8, .col-md-9, .col-md-10, .col-md-11, .col-md-12,
.col-lg, .col-lg-1, .col-lg-2, .col-lg-3, .col-lg-4, .col-lg-5, .col-lg-6, .col-lg-7, .col-lg-8, .col-lg-9, .col-lg-10, .col-lg-11, .col-lg-12,
.col-xl, .col-xl-1, .col-xl-2, .col-xl-3, .col-xl-4, .col-xl-5, .col-xl-6, .col-xl-7, .col-xl-8, .col-xl-9, .col-xl-10, .col-xl-11, .col-xl-12 {
    padding-left: 15px;
    padding-right: 15px;
}

/* Referral Level Styles */
.locked-level {
    color: #6c757d !important;
}

.unlocked-level {
    color: #28a745 !important;
    font-weight: bold;
}

.level-indicator {
    display: inline-block;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    text-align: center;
    line-height: 20px;
    font-size: 12px;
    margin-right: 5px;
}

.level-indicator.locked {
    background-color: #e9ecef;
    color: #6c757d;
}

.level-indicator.unlocked {
    background-color: #d4edda;
    color: #155724;
}
