/* Override Bootstrap Primary Colors */
.btn-primary {
    background-color: #4a5568 !important;
    border-color: #4a5568 !important;
}

.btn-primary:hover {
    background-color: #2d3748 !important;
    border-color: #2d3748 !important;
}

.btn-primary:focus {
    background-color: #2d3748 !important;
    border-color: #2d3748 !important;
    box-shadow: 0 0 0 0.2rem rgba(74, 85, 104, 0.25) !important;
}

.bg-primary {
    background-color: #4a5568 !important;
}

.text-primary {
    color: #4a5568 !important;
}

.border-primary {
    border-color: #4a5568 !important;
}

.navbar-dark.bg-primary {
    background: linear-gradient(135deg, #4a5568 0%, #718096 100%) !important;
}

/* Menu Button Styles */
.navbar-toggler {
    border: none;
    padding: 0.25rem 0.5rem;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    transition: all 0.3s ease;
}

.navbar-toggler:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.05);
}

.navbar-toggler:focus {
    box-shadow: 0 0 0 0.2rem rgba(255, 255, 255, 0.25);
}

.navbar-toggler-icon {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba%28255, 255, 255, 1%29' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
}

/* Top Navigation Bar Styles */
.navbar {
    background: linear-gradient(135deg, #4a5568 0%, #718096 100%) !important;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    z-index: 1050; /* Higher than footer and content */
    position: sticky;
    top: 0;
    padding: 0.25rem 0; /* Reduced padding for smaller height */
    min-height: auto; /* Remove default min-height */
}

.navbar-brand {
    font-size: 1.25rem;
    font-weight: 600;
    padding: 0.25rem 0; /* Reduced padding */
}

.navbar-nav .nav-link {
    padding: 0.375rem 0.75rem; /* Reduced padding */
    border-radius: 6px;
    margin: 0 0.125rem; /* Reduced margin */
    transition: all 0.3s ease;
}

.navbar-nav .nav-link:hover {
    background-color: rgba(255, 255, 255, 0.1);
    transform: translateY(-1px);
}

.navbar-nav .nav-link.active {
    background-color: rgba(255, 255, 255, 0.2);
    font-weight: 600;
}

.navbar-nav .nav-link i {
    font-size: 0.9rem;
}

/* Quick stats in navbar */
.navbar-text {
    font-size: 0.85rem; /* Slightly smaller */
    color: rgba(255, 255, 255, 0.9);
    padding: 0.25rem 0; /* Reduced padding */
}

.navbar-text strong {
    font-size: 0.9rem; /* Slightly smaller */
    font-weight: 600;
    color: white;
}

/* Navbar Profile Image */
.navbar-profile-image {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(255, 255, 255, 0.3);
    transition: all 0.3s ease;
}

.navbar-profile-image:hover {
    border-color: rgba(255, 255, 255, 0.6);
    transform: scale(1.1);
}

/* Profile Placeholder */
.navbar-profile-placeholder {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255, 255, 255, 0.8);
    font-size: 16px;
    transition: all 0.3s ease;
}

.navbar-profile-placeholder:hover {
    background-color: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.6);
    transform: scale(1.1);
}

/* User Profile Container */
.user-profile-container {
    position: relative;
}

/* User Info */
.user-info {
    text-align: left;
}

.user-name {
    font-size: 0.9rem;
    font-weight: 600;
    line-height: 1.2;
}

.user-role {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.7);
    line-height: 1;
}

/* User Profile Link */
.user-profile-link {
    padding: 0.5rem 0.75rem !important;
    border-radius: 8px !important;
    transition: all 0.3s ease;
}

.user-profile-link:hover {
    background-color: rgba(255, 255, 255, 0.1) !important;
    transform: translateY(-1px);
}

/* User Dropdown Menu */
.user-dropdown-menu {
    min-width: 280px;
    border: none;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    border-radius: 12px;
    padding: 0.5rem 0;
}

.user-dropdown-menu .dropdown-header {
    padding: 1rem 1rem 0.5rem 1rem;
    background-color: #f8f9fa;
    border-radius: 12px 12px 0 0;
    margin: -0.5rem -0.5rem 0 -0.5rem;
}

.user-dropdown-menu .dropdown-item {
    padding: 0.75rem 1rem;
    font-size: 0.9rem;
    transition: all 0.2s ease;
    border-radius: 0;
}

.user-dropdown-menu .dropdown-item:hover {
    background-color: #f8f9fa;
    color: #4a5568;
    transform: translateX(4px);
}

.user-dropdown-menu .dropdown-item i {
    width: 20px;
    text-align: center;
}

/* Dropdown Profile Image */
.dropdown-profile-image {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #e9ecef;
}

.dropdown-profile-placeholder {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background-color: #e9ecef;
    border: 2px solid #dee2e6;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6c757d;
    font-size: 20px;
}

/* Breadcrumb Navigation */
.breadcrumb {
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
}

.breadcrumb-item a {
    color: #4a5568;
    transition: color 0.3s ease;
}

.breadcrumb-item a:hover {
    color: #2d3748;
}

.breadcrumb-item.active {
    color: #718096;
}

/* Profile Image Styles */
.profile-image-container {
    position: relative;
}

.profile-image {
    width: 150px;
    height: 150px;
    object-fit: cover;
    border: 4px solid #e9ecef;
    transition: all 0.3s ease;
}

.profile-image:hover {
    border-color: #4a5568;
    transform: scale(1.05);
}

.profile-image-placeholder {
    width: 150px;
    height: 150px;
    background-color: #f8f9fa;
    border: 4px solid #e9ecef;
    margin: 0 auto;
    transition: all 0.3s ease;
}

.profile-image-placeholder:hover {
    background-color: #e9ecef;
    border-color: #4a5568;
}

.profile-image-preview {
    position: relative;
    display: inline-block;
}

.profile-image-preview::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 50%;
    opacity: 0;
    transition: opacity 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.profile-image-preview:hover::after {
    opacity: 1;
}

/* Upload Progress */
.upload-progress {
    margin-top: 1rem;
}

.upload-progress .progress {
    height: 8px;
    border-radius: 4px;
}

/* Mobile Responsive for Profile */
@media (max-width: 768px) {
    .profile-image,
    .profile-image-placeholder {
        width: 120px;
        height: 120px;
    }
    
    .profile-image-preview {
        margin-bottom: 1rem;
    }
}

.sidebar {
    min-height: calc(100vh - 56px); /* Account for navbar height */
    background: linear-gradient(135deg, #4a5568 0%, #718096 100%);
    transition: transform 0.3s ease-in-out;
}

.sidebar .nav-link {
    color: rgba(255, 255, 255, 0.8);
    padding: 12px 20px;
    margin: 5px 0;
    border-radius: 8px;
    transition: all 0.3s;
}

.sidebar .nav-link:hover,
.sidebar .nav-link.active {
    color: white;
    background: rgba(255, 255, 255, 0.1);
}

.card {
    border: none;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    border-radius: 12px;
}

.stat-card {
    background: linear-gradient(135deg, #4a5568 0%, #718096 100%);
    color: white;
}

.stat-card .card-body {
    padding: 1.5rem;
}

.stat-number {
    font-size: 2rem;
    font-weight: bold;
}

.affiliate-link {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 15px;
    margin: 10px 0;
}

.copy-btn {
    cursor: pointer;
    transition: color 0.3s;
}

.copy-btn:hover {
    color: #4a5568;
}

.welcome-banner {
    background: linear-gradient(135deg, #4a5568 0%, #718096 100%);
    color: white;
    padding: 1rem;
    border-radius: 10px;
    margin-bottom: 2rem;
}

/* Bootstrap Offcanvas Customization */
.offcanvas {
    background: linear-gradient(135deg, #4a5568 0%, #718096 100%);
    width: 280px !important;
}

.offcanvas .nav-link {
    color: rgba(255, 255, 255, 0.8);
    padding: 12px 20px;
    margin: 5px 0;
    border-radius: 8px;
    transition: all 0.3s;
}

.offcanvas .nav-link:hover,
.offcanvas .nav-link.active {
    color: white;
    background: rgba(255, 255, 255, 0.1);
}

/* Ensure offcanvas backdrop is visible */
.offcanvas-backdrop {
    background-color: rgba(0, 0, 0, 0.5);
}

/* Fix for offcanvas positioning */
.offcanvas-start {
    transform: translateX(-100%);
}

.offcanvas-start.show {
    transform: translateX(0);
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .main-content {
        margin-left: 0 !important;
        padding-top: 0.5rem; /* Small padding for mobile */
        padding-bottom: 3rem; /* Extra padding on mobile */
    }

    .container-fluid {
        padding-left: 15px;
        padding-right: 15px;
        padding-top: 0.5rem; /* Small padding for mobile */
        padding-bottom: 0.5rem;
    }

    .welcome-banner {
        margin-top: 0.5rem;
    }

    .stat-card .stat-number {
        font-size: 1.5rem;
    }

    .table-responsive {
        font-size: 0.9rem;
    }
    
    .navbar-nav .nav-link {
        padding: 0.25rem 0.5rem;
        font-size: 0.9rem;
    }
    
    .navbar-brand {
        font-size: 1.1rem;
    }
    
    /* Mobile User Profile */
    .navbar-profile-image {
        width: 32px;
        height: 32px;
    }
    
    .navbar-profile-placeholder {
        width: 32px;
        height: 32px;
        font-size: 14px;
    }
    
    .user-dropdown-menu {
        min-width: 260px;
    }
    
    .user-dropdown-menu .dropdown-header {
        padding: 0.75rem 0.75rem 0.5rem 0.75rem;
    }
    
    .dropdown-profile-image {
        width: 40px;
        height: 40px;
    }
    
    .dropdown-profile-placeholder {
        width: 40px;
        height: 40px;
        font-size: 18px;
    }
}

@media (max-width: 576px) {
    .stat-card .stat-number {
        font-size: 1.2rem;
    }

    .card-body {
        padding: 1rem;
    }

    .btn-group .btn {
        font-size: 0.8rem;
        padding: 0.25rem 0.5rem;
    }
    
    /* Extra small screen adjustments */
    .main-content {
        padding-top: 0.25rem; /* Minimal padding for very small screens */
        padding-bottom: 4rem; /* More padding for very small screens */
        min-height: calc(100vh - 120px);
    }
    
    .container-fluid {
        padding-top: 0.25rem; /* Minimal padding */
        padding-bottom: 0.5rem;
    }
}

/* Footer positioning and z-index */
.footer {
    position: relative;
    z-index: 1020; /* Below navbar but above content */
    margin-top: auto; /* Push footer to bottom */
    flex-shrink: 0; /* Don't shrink footer */
    padding-bottom: 2rem; /* Add extra padding at bottom */
}

/* Ensure main content has proper spacing */
.main-content {
    margin-top: 0;
    padding-top: 0; /* Remove top padding for large screens */
    padding-bottom: 2rem; /* Keep bottom padding to prevent content overlap */
    min-height: calc(100vh - 200px); /* Ensure minimum height */
}

/* Large screen optimizations */
@media (min-width: 992px) {
    .main-content {
        padding-top: 0; /* No top padding on large screens */
    }
    
    .navbar {
        padding: 0.25rem 0; /* Minimal padding */
    }
    
    .navbar-brand {
        padding: 0.25rem 0;
    }
    
    .navbar-nav .nav-link {
        padding: 0.375rem 0.75rem;
    }
    
    .navbar-text {
        padding: 0.25rem 0;
    }
}

/* Body layout for sticky footer */
body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Container adjustments for navbar spacing */
.container-fluid {
    padding-top: 0; /* Remove top padding for large screens */
    padding-bottom: 0;
}

/* Large screen container optimizations */
@media (min-width: 992px) {
    .container-fluid {
        padding-top: 0; /* No top padding on large screens */
        padding-bottom: 0;
    }
}

/* Footer responsive design */
.footer .container {
    padding-left: 15px;
    padding-right: 15px;
}

.footer h6 {
    font-size: 0.95rem;
    margin-bottom: 0.75rem;
}

.footer ul li {
    margin-bottom: 0.5rem;
}

.footer ul li a {
    font-size: 0.9rem;
    transition: color 0.3s ease;
}

.footer ul li a:hover {
    color: #4a5568 !important;
}

.footer .fab {
    font-size: 1.2rem;
    transition: color 0.3s ease;
}

.footer .fab:hover {
    color: #4a5568 !important;
}

/* Footer mobile responsive */
@media (max-width: 768px) {
    .footer .col-lg-3 {
        margin-bottom: 1.5rem;
    }
    
    .footer h6 {
        font-size: 0.9rem;
        margin-bottom: 0.5rem;
    }
    
    .footer ul li a {
        font-size: 0.85rem;
    }
    
    .footer .d-flex.flex-wrap {
        flex-direction: column;
        align-items: flex-start !important;
    }
    
    .footer .d-flex.flex-wrap h6 {
        margin-bottom: 0.5rem;
    }
    
    .footer .text-md-end {
        text-align: center !important;
        margin-top: 1rem;
    }
    
    /* Mobile footer spacing */
    .footer {
        padding-bottom: 3rem; /* Extra padding on mobile */
        margin-top: 2rem; /* More space from content */
    }
    
    .main-content {
        padding-bottom: 3rem; /* Extra padding on mobile */
        min-height: calc(100vh - 150px); /* Adjust for mobile navbar */
    }
    
    /* Ensure navbar doesn't overlap content */
    .navbar {
        z-index: 1040; /* Higher than footer */
    }
}

@media (max-width: 576px) {
    .footer {
        padding: 1.5rem 0 4rem 0; /* Extra bottom padding for very small screens */
    }
    
    .footer .container {
        padding-left: 10px;
        padding-right: 10px;
    }
    
    .footer h6 {
        font-size: 0.85rem;
    }
    
    .footer ul li a {
        font-size: 0.8rem;
    }
    
    .footer .fab {
        font-size: 1rem;
    }
    
    .footer .border-top {
        margin-top: 1rem !important;
        padding-top: 1rem !important;
    }
    
    /* Extra small screen adjustments */
    .main-content {
        padding-bottom: 4rem; /* More padding for very small screens */
        min-height: calc(100vh - 120px);
    }
    
    .container-fluid {
        padding-top: 0.5rem;
        padding-bottom: 0.5rem;
    }
}