/* Distributor Panel - Modern Design */
:root {
    --dist-primary: #10b981;
    --dist-primary-dark: #059669;
    --dist-secondary: #3b82f6;
    --dist-accent: #06b6d4;
    --dist-bg: #f0fdf4;
    --dist-sidebar-bg: linear-gradient(180deg, #10b981 0%, #059669 100%);
    --dist-sidebar-width: 260px;
    --dist-card-shadow: 0 2px 8px rgba(16, 185, 129, 0.1);
    --dist-card-hover: 0 4px 16px rgba(16, 185, 129, 0.15);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--dist-bg);
    color: #1f2937;
    line-height: 1.6;
}

/* Sidebar */
#distributor-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--dist-sidebar-width);
    height: 100vh;
    background: linear-gradient(180deg, #10b981 0%, #059669 50%, #047857 100%);
    color: white;
    z-index: 1000;
    overflow: hidden;
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    backdrop-filter: blur(10px);
}

#distributor-sidebar.collapsed {
    transform: translateX(-100%);
}

.sidebar-header {
    padding: 1.75rem 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.15);
    text-align: center;
    flex-shrink: 0;
    background: rgba(0, 0, 0, 0.1);
    animation: fadeInDown 0.5s ease-out;
}

.sidebar-header .logo-text {
    font-size: 1.5rem;
    font-weight: 700;
    color: white;
    text-decoration: none;
    display: block;
    transition: transform 0.3s ease;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.sidebar-header .logo-text:hover {
    transform: scale(1.05);
}

.sidebar-header .subtitle {
    font-size: 0.75rem;
    opacity: 0.95;
    margin-top: 0.5rem;
    letter-spacing: 0.5px;
    font-weight: 500;
}

.sidebar-menu {
    padding: 1.5rem 0;
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.3) transparent;
}

.sidebar-menu::-webkit-scrollbar {
    width: 6px;
}

.sidebar-menu::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar-menu::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 3px;
}

.sidebar-menu::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
}

.sidebar-menu .nav-link {
    display: flex;
    align-items: center;
    padding: 0.875rem 1.25rem;
    color: rgba(255, 255, 255, 0.9);
    text-decoration: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border-left: 3px solid transparent;
    border-radius: 8px;
    margin: 0.25rem 0.75rem;
    position: relative;
    overflow: hidden;
    animation: slideInLeft 0.5s ease-out backwards;
}

.sidebar-menu .nav-link:nth-child(1) { animation-delay: 0.1s; }
.sidebar-menu .nav-link:nth-child(2) { animation-delay: 0.15s; }
.sidebar-menu .nav-link:nth-child(3) { animation-delay: 0.2s; }
.sidebar-menu .nav-link:nth-child(4) { animation-delay: 0.25s; }
.sidebar-menu .nav-link:nth-child(5) { animation-delay: 0.3s; }
.sidebar-menu .nav-link:nth-child(6) { animation-delay: 0.35s; }
.sidebar-menu .nav-link:nth-child(7) { animation-delay: 0.4s; }
.sidebar-menu .nav-link:nth-child(8) { animation-delay: 0.45s; }
.sidebar-menu .nav-link:nth-child(9) { animation-delay: 0.5s; }

.sidebar-menu .nav-link::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    transition: left 0.5s ease;
}

.sidebar-menu .nav-link:hover::before {
    left: 100%;
}

.sidebar-menu .nav-link:hover {
    background: rgba(255, 255, 255, 0.15);
    color: white;
    border-left-color: white;
    transform: translateX(5px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.sidebar-menu .nav-link.active {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border-left-color: white;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    transform: translateX(3px);
}

.sidebar-menu .nav-link.active::after {
    content: '';
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 60%;
    background: white;
    border-radius: 4px 0 0 4px;
    animation: slideInRight 0.3s ease-out;
}

.sidebar-menu .nav-link i {
    width: 24px;
    margin-right: 0.875rem;
    font-size: 1.1rem;
    flex-shrink: 0;
    transition: transform 0.3s ease;
}

.sidebar-menu .nav-link:hover i {
    transform: scale(1.1);
}

.sidebar-menu .nav-link.active i {
    transform: scale(1.15);
}

.sidebar-menu .nav-link span {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: font-weight 0.3s ease;
}

.sidebar-footer {
    padding: 1.25rem 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.15);
    background: rgba(0, 0, 0, 0.2);
    flex-shrink: 0;
    margin-top: auto;
    animation: fadeInUp 0.5s ease-out;
    backdrop-filter: blur(10px);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    margin-bottom: 1rem;
    width: 100%;
    padding: 0.75rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    transition: all 0.3s ease;
}

.user-info:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-2px);
}

.user-avatar {
    width: 45px;
    height: 45px;
    min-width: 45px;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.3), rgba(255, 255, 255, 0.1));
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.2rem;
    flex-shrink: 0;
    border: 2px solid rgba(255, 255, 255, 0.3);
    transition: all 0.3s ease;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.user-info:hover .user-avatar {
    transform: scale(1.1) rotate(5deg);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.3);
}

.user-details {
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.user-name {
    font-weight: 600;
    font-size: 0.95rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
    width: 100%;
    margin-bottom: 0.25rem;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.user-code {
    font-size: 0.75rem;
    opacity: 0.85;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
    width: 100%;
    font-weight: 500;
    letter-spacing: 0.5px;
}

.logout-btn {
    width: 100%;
    padding: 0.75rem;
    background: rgba(239, 68, 68, 0.2);
    border: 1px solid rgba(239, 68, 68, 0.4);
    color: white;
    border-radius: 8px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-weight: 500;
    position: relative;
    overflow: hidden;
}

.logout-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    transform: translate(-50%, -50%);
    transition: width 0.6s ease, height 0.6s ease;
}

.logout-btn:hover::before {
    width: 300px;
    height: 300px;
}

.logout-btn:hover {
    background: rgba(239, 68, 68, 0.3);
    border-color: rgba(239, 68, 68, 0.6);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

.logout-btn:active {
    transform: translateY(0);
}

.logout-btn i {
    position: relative;
    z-index: 1;
    transition: transform 0.3s ease;
}

.logout-btn:hover i {
    transform: translateX(3px);
}

.logout-btn span {
    position: relative;
    z-index: 1;
}

/* Animations */
@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(-10px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Main Content */
#main-content {
    margin-left: var(--dist-sidebar-width);
    min-height: 100vh;
    transition: margin-left 0.3s ease;
}

#main-content.sidebar-collapsed {
    margin-left: 0;
}

.top-navbar {
    background: white;
    padding: 1rem 2rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
}

.navbar-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.sidebar-toggle {
    background: none;
    border: none;
    font-size: 1.25rem;
    color: var(--dist-primary);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 6px;
    transition: background 0.3s ease;
}

.sidebar-toggle:hover {
    background: var(--dist-bg);
}

.page-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: #1f2937;
    margin: 0;
}

.content-wrapper {
    padding: 2rem;
}

/* Stats Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: var(--dist-card-shadow);
    transition: all 0.3s ease;
    border-left: 4px solid var(--dist-primary);
}

.stat-card:hover {
    box-shadow: var(--dist-card-hover);
    transform: translateY(-2px);
}

.stat-card.sales {
    border-left-color: var(--dist-primary);
}

.stat-card.wallet {
    border-left-color: var(--dist-secondary);
}

.stat-card.downline {
    border-left-color: var(--dist-accent);
}

.stat-label {
    font-size: 0.875rem;
    color: #6b7280;
    font-weight: 500;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: #1f2937;
    margin: 0;
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    margin-bottom: 1rem;
}

.stat-card.sales .stat-icon {
    background: rgba(16, 185, 129, 0.1);
    color: var(--dist-primary);
}

.stat-card.wallet .stat-icon {
    background: rgba(59, 130, 246, 0.1);
    color: var(--dist-secondary);
}

.stat-card.downline .stat-icon {
    background: rgba(6, 182, 212, 0.1);
    color: var(--dist-accent);
}

/* Cards */
.card {
    border: none;
    border-radius: 12px;
    box-shadow: var(--dist-card-shadow);
    margin-bottom: 1.5rem;
}

.card-header {
    background: white;
    border-bottom: 1px solid #e5e7eb;
    padding: 1.25rem 1.5rem;
    border-radius: 12px 12px 0 0;
    font-weight: 600;
}

.card-body {
    padding: 1.5rem;
}

/* Buttons */
.btn {
    border-radius: 8px;
    padding: 0.625rem 1.25rem;
    font-weight: 500;
    transition: all 0.3s ease;
    border: none;
}

.btn-primary {
    background: var(--dist-primary);
    color: white;
}

.btn-primary:hover {
    background: var(--dist-primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.btn-outline-primary {
    border: 2px solid var(--dist-primary);
    color: var(--dist-primary);
    background: white;
}

.btn-outline-primary:hover {
    background: var(--dist-primary);
    color: white;
}

/* Forms */
.form-label {
    font-weight: 500;
    color: #374151;
    margin-bottom: 0.5rem;
}

.form-control,
.form-select {
    border: 1px solid #d1d5db;
    border-radius: 8px;
    padding: 0.625rem 0.875rem;
    transition: all 0.3s ease;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--dist-primary);
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
    outline: none;
}

/* Tables */
.table {
    background: white;
}

.table thead {
    background: var(--dist-bg);
}

.table thead th {
    border-bottom: 2px solid var(--dist-primary);
    font-weight: 600;
    color: #374151;
    padding: 1rem;
}

.table tbody td {
    padding: 1rem;
    vertical-align: middle;
}

.table tbody tr:hover {
    background: var(--dist-bg);
}

/* Badges */
.badge {
    padding: 0.375rem 0.75rem;
    border-radius: 6px;
    font-weight: 500;
}

.badge-success {
    background: rgba(16, 185, 129, 0.1);
    color: var(--dist-primary);
}

/* Loading Spinner (for inline use) */
.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(16, 185, 129, 0.1);
    border-top-color: var(--dist-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Responsive */
@media (max-width: 768px) {
    #distributor-sidebar {
        transform: translateX(-100%);
    }
    
    #distributor-sidebar.open {
        transform: translateX(0);
    }
    
    #main-content {
        margin-left: 0;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .content-wrapper {
        padding: 1rem;
    }
}

/* Login Page Specific */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #10b981 0%, #3b82f6 100%);
    padding: 2rem;
}

.login-card {
    background: white;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    padding: 2.5rem;
    width: 100%;
    max-width: 420px;
}

.login-header {
    text-align: center;
    margin-bottom: 2rem;
}

.login-header .logo-icon {
    width: 64px;
    height: 64px;
    background: linear-gradient(135deg, #10b981 0%, #3b82f6 100%);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1rem;
    color: white;
    font-size: 2rem;
}

.login-header h2 {
    color: #1f2937;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.login-header p {
    color: #6b7280;
    font-size: 0.9rem;
}

