/**
 * Custom CSS for MLM Generation Application
 * Enhances AdminLTE with custom styles
 */

/* General Enhancements */
.content-wrapper {
    min-height: calc(100vh - 100px);
}

/* Dashboard Stats Cards */
.small-box {
    border-radius: 10px;
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease;
}

.small-box:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 25px rgba(0, 0, 0, 0.15);
}

/* Cards */
.card {
    border-radius: 10px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.05);
}

.card-header {
    border-radius: 10px 10px 0 0 !important;
}

/* Buttons */
.btn {
    border-radius: 5px;
}

/* Tables */
.table-responsive {
    border-radius: 5px;
}

/* MLM Tree Visualization */
.tree {
    margin: 0;
    padding: 0;
    list-style-type: none;
}

.tree ul {
    margin: 0 0 0 20px;
    padding: 0;
    position: relative;
    list-style-type: none;
}

.tree li {
    margin: 20px 0;
    padding: 0 0 0 20px;
    position: relative;
    list-style-type: none;
}

.tree li::before {
    content: "";
    position: absolute;
    top: -10px;
    left: -10px;
    border-left: 1px solid #ccc;
    border-bottom: 1px solid #ccc;
    width: 20px;
    height: 15px;
}

.tree li::after {
    content: "";
    position: absolute;
    top: 5px;
    left: -10px;
    border-left: 1px solid #ccc;
    height: 100%;
}

.tree li:last-child::after {
    display: none;
}

.tree-node {
    display: inline-block;
    padding: 10px 15px;
    background: #f8f9fa;
    border: 2px solid #007bff;
    border-radius: 5px;
    color: #333;
    text-decoration: none;
    transition: all 0.3s ease;
}

.tree-node:hover {
    background: #007bff;
    color: white;
    transform: scale(1.05);
}

.tree-node.active-user {
    border-color: #28a745;
    background: #d4edda;
}

.tree-node.inactive-user {
    border-color: #dc3545;
    background: #f8d7da;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .small-box h3 {
        font-size: 1.5rem;
    }

    .tree {
        font-size: 0.875rem;
    }
}

/* Custom badge colors */
.badge-level-1 {
    background-color: #007bff;
}

.badge-level-2 {
    background-color: #28a745;
}

.badge-level-3 {
    background-color: #ffc107;
    color: #212529;
}

.badge-level-4 {
    background-color: #dc3545;
}

.badge-level-5 {
    background-color: #6c757d;
}

/* Loading spinner */
.spinner-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.spinner-overlay.show {
    display: flex;
}

/* Wallet balance display */
.wallet-balance {
    font-size: 2rem;
    font-weight: bold;
    color: #28a745;
}

/* Transaction type indicators */
.transaction-credit {
    color: #28a745;
    font-weight: bold;
}

.transaction-debit {
    color: #dc3545;
    font-weight: bold;
}

/* Smooth animations */
.fade-in {
    animation: fadeIn 0.5s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Modern Stat Cards */
.stat-card {
    border-radius: 15px;
    position: relative;
    display: flex;
    flex-direction: column;
    min-width: 0;
    word-wrap: break-word;
    background-clip: border-box;
    border: 0 solid rgba(0, 0, 0, .125);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1) !important;
    height: 100%;
    /* Ensure equal height */
    overflow: hidden;
    transition: all 0.3s ease;
    color: #fff;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.2) !important;
}

.stat-card .inner {
    padding: 25px 20px;
    flex: 1;
    /* Push footer down */
}

.stat-card h3 {
    font-size: 2.2rem;
    font-weight: 700;
    margin: 0;
    line-height: 1;
    white-space: nowrap;
}

.stat-card p {
    font-size: 1rem;
    margin-top: 5px;
    margin-bottom: 0;
    opacity: 0.9;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-card .icon {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 60px;
    opacity: 0.2;
    transition: all 0.3s linear;
}

.stat-card:hover .icon {
    transform: scale(1.1) rotate(5deg);
    opacity: 0.3;
}

.stat-card-footer {
    background: rgba(0, 0, 0, 0.1);
    color: rgba(255, 255, 255, 0.9);
    padding: 10px 0;
    text-align: center;
    text-decoration: none;
    display: block;
    z-index: 10;
    font-weight: 500;
    transition: background 0.3s;
}

.stat-card-footer:hover {
    background: rgba(0, 0, 0, 0.2);
    color: #fff;
    text-decoration: none;
}

/* Custom Gradients */
.bg-gradient-gold {
    background: linear-gradient(45deg, #f9d423 0%, #ff4e50 100%);
    color: #fff !important;
}

.bg-gradient-royal {
    background: linear-gradient(to right, #141e30, #243b55);
    color: #fff !important;
}

.bg-gradient-lush {
    background: linear-gradient(120deg, #d4fc79 0%, #96e6a1 100%);
    color: #333 !important;
}

.bg-gradient-lush .stat-card-footer {
    color: #333 !important;
}

.bg-gradient-lush h3,
.bg-gradient-lush p {
    color: #333 !important;
}

.bg-gradient-cool-blue {
    background: linear-gradient(120deg, #89f7fe 0%, #66a6ff 100%);
    color: #fff !important;
}

.bg-gradient-deep-purple {
    background: linear-gradient(to right, #654ea3, #eaafc8);
    color: #fff !important;
}

.bg-gradient-orange-red {
    background: linear-gradient(to right, #fc4a1a, #f7b733);
    color: #fff !important;
}

/* Modern Profile Card */
.profile-card-modern {
    background: linear-gradient(to right, #141e30, #243b55);
    /* Royal Gradient */
    color: #fff;
    border: none;
    border-radius: 15px;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.15) !important;
}

.profile-card-modern .text-dark {
    color: #fff !important;
}

.profile-card-modern .text-muted {
    color: rgba(255, 255, 255, 0.7) !important;
}

.profile-card-modern .badge-level-1,
.profile-card-modern .badge-level-2,
.profile-card-modern .badge-level-3,
.profile-card-modern .badge-level-4,
.profile-card-modern .badge-level-5 {
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.profile-card-modern .info-box {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
}

/* Sidebar Responsiveness & Full Text Visibility Fix */
.main-sidebar {
    overflow-x: hidden !important;
}

.brand-link .brand-text {
    display: inline-block;
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
    vertical-align: middle;
    line-height: 1.2;
    padding-right: 10px;
    max-width: 160px;
}

.user-panel .info {
    overflow: visible;
    white-space: normal;
    text-overflow: clip;
    max-width: 180px;
}

.user-panel .info a {
    display: block !important;
    white-space: normal !important;
    line-height: 1.3;
}

.nav-sidebar .nav-link p {
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
    display: inline-block;
    vertical-align: middle;
    line-height: 1.3;
    max-width: 160px;
}

@media (max-width: 991.98px) {
    .main-sidebar {
        box-shadow: none !important;
    }
}

/* 6. Global DataTables & Tables Pill UI Upgrade */
.table, .dataTable {
    border-collapse: separate !important;
    border-spacing: 0 10px !important;
    background: transparent !important;
}
.table thead th {
    border: none !important;
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 0.5px;
    color: #6c757d;
    background: transparent !important;
    padding-bottom: 5px !important;
}
.table tbody tr {
    background: rgba(255,255,255,0.85) !important;
    backdrop-filter: blur(5px) !important;
    box-shadow: 0 2px 8px rgba(0,0,0,0.03) !important;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    border-radius: 12px;
}
.table tbody tr:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.08) !important;
}
.table tbody td {
    border: none !important;
    vertical-align: middle !important;
    padding: 12px 15px !important;
}
.table tbody td:first-child { border-top-left-radius: 12px; border-bottom-left-radius: 12px; }
.table tbody td:last-child { border-top-right-radius: 12px; border-bottom-right-radius: 12px; }

/* DataTables Pagination Override */
.dataTables_wrapper .dataTables_paginate .paginate_button {
    border-radius: 50% !important;
    margin: 0 4px;
    border: none !important;
    background: transparent !important;
}
.dataTables_wrapper .dataTables_paginate .paginate_button.current {
    background: #007bff !important;
    color: white !important;
    box-shadow: 0 3px 6px rgba(0,123,255,0.3) !important;
}
.dataTables_wrapper .dataTables_filter input {
    border-radius: 20px !important;
    padding: 5px 15px !important;
    border: 1px solid rgba(0,0,0,0.1) !important;
}

/* ==========================================================
   Next-Gen Glassmorphism & Light Theme Frontend Design System
   ========================================================== */
:root {
    --light-bg: #f8fafc;
    --light-card-bg: rgba(255, 255, 255, 0.82);
    --light-border: rgba(255, 255, 255, 0.9);
    --light-border-subtle: rgba(5, 150, 105, 0.12);
    --emerald-primary: #059669;
    --emerald-hover: #047857;
    --gold-primary: #f59e0b;
    --slate-heading: #0f172a;
    --slate-body: #334155;
    --slate-muted: #64748b;
}

/* Master Glassmorphism Classes */
.glass-panel {
    background: var(--light-card-bg) !important;
    backdrop-filter: blur(20px) saturate(180%) !important;
    -webkit-backdrop-filter: blur(20px) saturate(180%) !important;
    border: 1px solid var(--light-border) !important;
    box-shadow: 0 10px 30px -5px rgba(6, 78, 59, 0.05), 0 20px 40px -15px rgba(0, 0, 0, 0.04), inset 0 1px 1px 0 rgba(255, 255, 255, 0.95) !important;
    border-radius: 1.25rem;
}

.glass-panel-hover {
    transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1) !important;
}
.glass-panel-hover:hover {
    transform: translateY(-4px) !important;
    box-shadow: 0 20px 40px -10px rgba(6, 78, 59, 0.1), 0 30px 60px -15px rgba(0, 0, 0, 0.06), inset 0 1px 1px 0 rgba(255, 255, 255, 1) !important;
    border-color: rgba(5, 150, 105, 0.25) !important;
}

.glass-input-field {
    background: rgba(255, 255, 255, 0.9) !important;
    border: 1.5px solid rgba(203, 213, 225, 0.8) !important;
    border-radius: 0.75rem !important;
    padding: 0.75rem 1rem !important;
    color: #0f172a !important;
    transition: all 0.2s ease !important;
}
.glass-input-field:focus {
    border-color: #059669 !important;
    box-shadow: 0 0 0 4px rgba(5, 150, 105, 0.12) !important;
    background: #ffffff !important;
    outline: none !important;
}

/* ==========================================================
   Advanced Automatic Glowing Button Motion System
   (Continuous Automatic Ambient Aura, Shimmer & Pulse)
   ========================================================== */
.emerald-gradient-btn,
.btn-login,
.btn-register,
.btn-primary {
    position: relative;
    overflow: hidden;
    z-index: 1;
    transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1) !important;
    transform-origin: center center;
    /* Automatic Continuous Breathing Emerald Glow */
    animation: autoEmeraldGlow 3s ease-in-out infinite alternate !important;
}

.gold-gradient-btn {
    position: relative;
    overflow: hidden;
    z-index: 1;
    transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1) !important;
    transform-origin: center center;
    /* Automatic Continuous Breathing Gold Glow */
    animation: autoGoldGlow 3s ease-in-out infinite alternate !important;
}

.btn-ayurvedic-outline {
    position: relative;
    overflow: hidden;
    z-index: 1;
    transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1) !important;
    transform-origin: center center;
    animation: autoOutlineGlow 3.5s ease-in-out infinite alternate !important;
}

/* 1. Automatic Keyframes: Emerald Breathing Glow */
@keyframes autoEmeraldGlow {
    0% {
        box-shadow: 0 4px 15px rgba(5, 150, 105, 0.3), 0 0 0 0 rgba(16, 185, 129, 0.35);
    }
    50% {
        box-shadow: 0 8px 30px rgba(5, 150, 105, 0.65), 0 0 20px rgba(16, 185, 129, 0.55), 0 0 35px rgba(5, 150, 105, 0.25);
    }
    100% {
        box-shadow: 0 4px 15px rgba(5, 150, 105, 0.3), 0 0 0 0 rgba(16, 185, 129, 0.35);
    }
}

/* 2. Automatic Keyframes: Gold Breathing Glow */
@keyframes autoGoldGlow {
    0% {
        box-shadow: 0 4px 15px rgba(245, 158, 11, 0.3), 0 0 0 0 rgba(251, 191, 36, 0.35);
    }
    50% {
        box-shadow: 0 8px 30px rgba(245, 158, 11, 0.65), 0 0 20px rgba(251, 191, 36, 0.55), 0 0 35px rgba(245, 158, 11, 0.25);
    }
    100% {
        box-shadow: 0 4px 15px rgba(245, 158, 11, 0.3), 0 0 0 0 rgba(251, 191, 36, 0.35);
    }
}

/* 3. Automatic Keyframes: Outline Breathing Glow */
@keyframes autoOutlineGlow {
    0% {
        box-shadow: 0 2px 10px rgba(5, 150, 105, 0.15);
    }
    50% {
        box-shadow: 0 6px 22px rgba(5, 150, 105, 0.35), 0 0 15px rgba(16, 185, 129, 0.25);
    }
    100% {
        box-shadow: 0 2px 10px rgba(5, 150, 105, 0.15);
    }
}

/* Automatic Continuous Shimmer Light Sheen Sweep */
.emerald-gradient-btn::before,
.gold-gradient-btn::before,
.btn-login::before,
.btn-register::before,
.shimmer-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -120%;
    width: 65%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.45), transparent);
    transform: skewX(-25deg);
    pointer-events: none;
    z-index: 2;
    animation: autoShimmerSweep 3.2s cubic-bezier(0.4, 0, 0.2, 1) infinite !important;
}

@keyframes autoShimmerSweep {
    0% {
        left: -120%;
        opacity: 0;
    }
    10% {
        opacity: 1;
    }
    38% {
        left: 190%;
        opacity: 1;
    }
    39%, 100% {
        left: 190%;
        opacity: 0;
    }
}

/* Automatic Radial Ambient Light Aura Behind Buttons */
.emerald-gradient-btn::after,
.gold-gradient-btn::after,
.btn-login::after,
.btn-register::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.25) 0%, transparent 65%);
    pointer-events: none;
    z-index: -1;
    animation: autoAuraPulse 3s ease-in-out infinite alternate !important;
}

@keyframes autoAuraPulse {
    0% {
        transform: scale(0.92);
        opacity: 0.3;
    }
    50% {
        transform: scale(1.08);
        opacity: 0.75;
    }
    100% {
        transform: scale(0.92);
        opacity: 0.3;
    }
}

/* Hover Elevation & Spring Intensification */
.emerald-gradient-btn:hover,
.btn-primary:hover,
.btn-login:hover,
.btn-register:hover {
    transform: translateY(-3px) scale(1.03) !important;
    box-shadow: 0 12px 35px rgba(5, 150, 105, 0.8), 0 0 25px rgba(16, 185, 129, 0.7) !important;
}

.gold-gradient-btn:hover {
    transform: translateY(-3px) scale(1.03) !important;
    box-shadow: 0 12px 35px rgba(245, 158, 11, 0.8), 0 0 25px rgba(251, 191, 36, 0.7) !important;
}

.btn-ayurvedic-outline:hover {
    transform: translateY(-3px) scale(1.03) !important;
    box-shadow: 0 10px 28px rgba(5, 150, 105, 0.45) !important;
    background: #059669 !important;
    color: #ffffff !important;
}

/* Active Pressed Feedback */
.emerald-gradient-btn:active,
.gold-gradient-btn:active,
.btn-ayurvedic-outline:active,
.btn-primary:active,
.btn-login:active,
.btn-register:active {
    transform: translateY(0px) scale(0.97) !important;
}

/* Button Icon Spring Nudge */
.emerald-gradient-btn .material-symbols-outlined,
.gold-gradient-btn .material-symbols-outlined,
.btn-ayurvedic-outline .material-symbols-outlined,
.btn-login svg,
.btn-register svg,
.emerald-gradient-btn svg,
.btn-ayurvedic-outline svg {
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.emerald-gradient-btn:hover .material-symbols-outlined,
.gold-gradient-btn:hover .material-symbols-outlined,
.btn-ayurvedic-outline:hover .material-symbols-outlined,
.btn-login:hover svg,
.btn-register:hover svg,
.emerald-gradient-btn:hover svg,
.btn-ayurvedic-outline:hover svg {
    transform: translateX(4px);
}

/* Click Ripple Wave Animation */
.btn-ripple-wave {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.5);
    transform: scale(0);
    animation: rippleWave 0.65s linear;
    pointer-events: none;
    z-index: 10;
}

@keyframes rippleWave {
    to {
        transform: scale(4);
        opacity: 0;
    }
}

/* Floating Badges */
.floating-badge {
    animation: floatSlow 4s ease-in-out infinite;
}
@keyframes floatSlow {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-8px); }
}

/* Card Spotlight Shader Effect on Hover */
.glass-card-light {
    position: relative;
    overflow: hidden;
}
.glass-card-light::before {
    content: '';
    position: absolute;
    top: var(--mouse-y, -1000px);
    left: var(--mouse-x, -1000px);
    width: 250px;
    height: 250px;
    background: radial-gradient(circle, rgba(5, 150, 105, 0.08) 0%, transparent 70%);
    transform: translate(-50%, -50%);
    pointer-events: none;
    transition: opacity 0.3s ease;
    opacity: 0;
    z-index: 1;
}
.glass-card-light:hover::before {
    opacity: 1;
}

/* Floating Spore Particles */
.motion-spore {
    position: absolute;
    border-radius: 50%;
    pointer-events: none;
    animation: sporeFloat 8s infinite ease-in-out;
}
@keyframes sporeFloat {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    50% { transform: translateY(-25px) rotate(180deg); }
}

@keyframes floatOrganic {
    0% { transform: translateY(0px) rotate(0deg); }
    50% { transform: translateY(-10px) rotate(1.5deg); }
    100% { transform: translateY(0px) rotate(0deg); }
}