/**
 * Genealogy MLM System Styles
 * https://myteam.chenabpk.com/
 */

/* ==================== 
   CSS VARIABLES 
   ==================== */
:root {
    --primary-color: #4e73df;
    --secondary-color: #858796;
    --success-color: #1cc88a;
    --info-color: #36b9cc;
    --warning-color: #f6c23e;
    --danger-color: #e74a3b;
    --light-color: #f8f9fc;
    --dark-color: #5a5c69;
    --gold-color: #ffd700;
    --silver-color: #c0c0c0;
    --bronze-color: #cd7f32;
    
    --sidebar-width: 250px;
    --sidebar-collapsed: 80px;
    --header-height: 70px;
    --footer-height: 60px;
}

/* ==================== 
   GENERAL STYLES 
   ==================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Nunito', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: #f8f9fc;
    color: #5a5c69;
    line-height: 1.6;
}

a {
    text-decoration: none;
    color: var(--primary-color);
    transition: all 0.3s ease;
}

a:hover {
    color: #224abe;
}

/* ==================== 
   LAYOUT STYLES 
   ==================== */
.wrapper {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: linear-gradient(180deg, #4e73df 0%, #224abe 100%);
    color: white;
    position: fixed;
    height: 100vh;
    z-index: 1000;
    transition: all 0.3s ease;
    overflow-y: auto;
}

.sidebar-brand {
    padding: 1.5rem;
    text-align: center;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-brand h2 {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0;
}

.sidebar-brand i {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    display: block;
}

.sidebar-menu {
    padding: 1rem 0;
}

.sidebar-menu .nav-item {
    margin: 0.25rem 0;
}

.sidebar-menu .nav-link {
    color: rgba(255,255,255,0.8);
    padding: 0.75rem 1.5rem;
    display: flex;
    align-items: center;
    transition: all 0.3s ease;
}

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

.sidebar-menu .nav-link i {
    width: 25px;
    margin-right: 0.75rem;
    font-size: 1rem;
}

.sidebar-divider {
    border-top: 1px solid rgba(255,255,255,0.1);
    margin: 1rem 0;
}

.sidebar-heading {
    padding: 0 1.5rem;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: rgba(255,255,255,0.5);
    margin-bottom: 0.5rem;
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
.header {
    background: white;
    height: var(--header-height);
    padding: 0 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 0.15rem 1.75rem 0 rgba(58, 59, 69, 0.15);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-left {
    display: flex;
    align-items: center;
}

.sidebar-toggle {
    background: none;
    border: none;
    font-size: 1.25rem;
    color: var(--secondary-color);
    cursor: pointer;
    margin-right: 1rem;
    padding: 0.5rem;
}

.header-search {
    position: relative;
}

.header-search input {
    border: 1px solid #d1d3e2;
    border-radius: 0.35rem;
    padding: 0.5rem 1rem 0.5rem 2.5rem;
    width: 300px;
    font-size: 0.875rem;
}

.header-search i {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--secondary-color);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-dropdown {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--dark-color);
    font-weight: 600;
}

.user-dropdown img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
}

/* Content Area */
.content {
    flex: 1;
    padding: 1.5rem;
}

/* Footer */
.footer {
    background: white;
    padding: 1rem 1.5rem;
    text-align: center;
    border-top: 1px solid #e3e6f0;
    color: var(--secondary-color);
    font-size: 0.875rem;
}

/* ==================== 
   CARD STYLES 
   ==================== */
.card {
    background: white;
    border-radius: 0.5rem;
    box-shadow: 0 0.15rem 1.75rem 0 rgba(58, 59, 69, 0.1);
    border: none;
    margin-bottom: 1.5rem;
}

.card-header {
    background: transparent;
    border-bottom: 1px solid #e3e6f0;
    padding: 1rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-header h5 {
    margin: 0;
    font-weight: 700;
    color: var(--dark-color);
}

.card-body {
    padding: 1.5rem;
}

/* Stat Cards */
.stat-card {
    border-left: 4px solid;
    padding: 1.5rem;
}

.stat-card.primary { border-left-color: var(--primary-color); }
.stat-card.success { border-left-color: var(--success-color); }
.stat-card.info { border-left-color: var(--info-color); }
.stat-card.warning { border-left-color: var(--warning-color); }
.stat-card.danger { border-left-color: var(--danger-color); }

.stat-card .stat-label {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.stat-card .stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--dark-color);
    margin-bottom: 0.5rem;
}

.stat-card .stat-icon {
    font-size: 2rem;
    color: #dddfeb;
}

/* ==================== 
   FORM STYLES 
   ==================== */
.form-label {
    font-weight: 600;
    color: var(--dark-color);
    margin-bottom: 0.5rem;
}

.form-control {
    border: 1px solid #d1d3e2;
    border-radius: 0.35rem;
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
    transition: all 0.3s ease;
}

.form-control:focus {
    border-color: #bac8f3;
    box-shadow: 0 0 0 0.2rem rgba(78, 115, 223, 0.25);
}

.form-select {
    border: 1px solid #d1d3e2;
    border-radius: 0.35rem;
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
}

.input-group-text {
    background: #eaecf4;
    border: 1px solid #d1d3e2;
    color: var(--secondary-color);
}

.btn {
    padding: 0.75rem 1.5rem;
    font-size: 0.875rem;
    font-weight: 600;
    border-radius: 0.35rem;
    transition: all 0.3s ease;
}

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

.btn-primary:hover {
    background: #224abe;
    border-color: #224abe;
}

.btn-success {
    background: var(--success-color);
    border-color: var(--success-color);
}

.btn-info {
    background: var(--info-color);
    border-color: var(--info-color);
}

/* ==================== 
   TABLE STYLES 
   ==================== */
.table {
    width: 100%;
    margin-bottom: 0;
}

.table th {
    background: #eaecf4;
    color: var(--dark-color);
    font-weight: 700;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 1rem;
    border: none;
}

.table td {
    padding: 1rem;
    vertical-align: middle;
    border-bottom: 1px solid #e3e6f0;
}

.table tbody tr:hover {
    background: #f8f9fc;
}

/* ==================== 
   BADGE STYLES 
   ==================== */
.badge {
    padding: 0.5em 0.75em;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 0.35rem;
}

.bg-bronze {
    background-color: #cd7f32 !important;
    color: white;
}

.bg-purple {
    background-color: #6f42c1 !important;
    color: white;
}

.bg-orange {
    background-color: #fd7e14 !important;
    color: white;
}

.bg-teal {
    background-color: #20c997 !important;
    color: white;
}

.bg-pink {
    background-color: #e83e8c !important;
    color: white;
}

.bg-indigo {
    background-color: #6610f2 !important;
    color: white;
}

.bg-gold {
    background: linear-gradient(135deg, #ffd700, #ffed4e);
    color: #333;
}

/* ==================== 
   INVESTMENT COLORS 
   ==================== */
.investment-gold {
    border: 2px solid var(--gold-color) !important;
    background: linear-gradient(135deg, #fff9e6, #fff) !important;
}

.investment-silver {
    border: 2px solid var(--silver-color) !important;
    background: linear-gradient(135deg, #f5f5f5, #fff) !important;
}

.investment-bronze {
    border: 2px solid var(--bronze-color) !important;
    background: linear-gradient(135deg, #faf0e6, #fff) !important;
}

.investment-inactive {
    border: 2px solid var(--danger-color) !important;
    background: #fff5f5 !important;
    opacity: 0.7;
}

/* ==================== 
   GENEALOGY TREE STYLES 
   ==================== */
.genealogy-tree {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 2rem;
    overflow-x: auto;
}

.tree-node {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    margin: 0.5rem;
}

.member-card {
    background: white;
    border-radius: 0.5rem;
    padding: 1rem;
    min-width: 220px;
    max-width: 260px;
    box-shadow: 0 0.15rem 1.75rem 0 rgba(58, 59, 69, 0.15);
    text-align: center;
    position: relative;
    z-index: 2;
    transition: all 0.3s ease;
}

.member-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 0.5rem 2rem 0 rgba(58, 59, 69, 0.25);
}

.member-header {
    margin-bottom: 0.75rem;
}

.member-name {
    font-size: 1rem;
    font-weight: 700;
    color: var(--dark-color);
    margin-bottom: 0.25rem;
}

.member-id {
    font-size: 0.75rem;
    color: var(--secondary-color);
    background: #eaecf4;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
}

.member-body {
    margin-bottom: 0.75rem;
}

.member-body p {
    margin-bottom: 0.25rem;
    font-size: 0.875rem;
    color: var(--secondary-color);
}

.member-body i {
    width: 20px;
    color: var(--primary-color);
}

.member-footer {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 0.75rem;
}

.member-actions {
    margin-top: 0.5rem;
}

.member-actions .btn {
    font-size: 0.75rem;
    padding: 0.4rem 0.75rem;
}

.tree-children {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1rem;
    margin-top: 2rem;
    position: relative;
}

/* Tree Connector Lines */
.tree-node::before {
    content: '';
    position: absolute;
    top: -2rem;
    left: 50%;
    width: 2px;
    height: 2rem;
    background: #d1d3e2;
    transform: translateX(-50%);
}

.tree-node:first-child::before {
    display: none;
}

.tree-children::before {
    content: '';
    position: absolute;
    top: -2rem;
    left: 50%;
    width: 2px;
    height: 2rem;
    background: #d1d3e2;
    transform: translateX(-50%);
}

/* ==================== 
   LEVEL INDICATOR 
   ==================== */
.level-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin: 1rem 0;
    flex-wrap: wrap;
}

.level-item {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.5rem 0.75rem;
    background: white;
    border-radius: 0.35rem;
    font-size: 0.875rem;
    box-shadow: 0 0.125rem 0.25rem rgba(0,0,0,0.075);
}

.level-item.active {
    background: var(--primary-color);
    color: white;
}

.level-item i {
    font-size: 0.75rem;
}

/* ==================== 
   ALERT STYLES 
   ==================== */
.alert {
    border: none;
    border-radius: 0.35rem;
    padding: 1rem 1.5rem;
}

.alert-success {
    background: #d4edda;
    color: #155724;
}

.alert-danger {
    background: #f8d7da;
    color: #721c24;
}

.alert-warning {
    background: #fff3cd;
    color: #856404;
}

.alert-info {
    background: #d1ecf1;
    color: #0c5460;
}

/* ==================== 
   LOGIN PAGE STYLES 
   ==================== */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #4e73df 0%, #224abe 100%);
    padding: 2rem;
}

.login-card {
    background: white;
    border-radius: 1rem;
    box-shadow: 0 1rem 3rem rgba(0,0,0,0.2);
    width: 100%;
    max-width: 450px;
    overflow: hidden;
}

.login-header {
    background: linear-gradient(135deg, #4e73df 0%, #224abe 100%);
    color: white;
    padding: 2rem;
    text-align: center;
}

.login-header h2 {
    margin: 0;
    font-weight: 700;
}

.login-header i {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.login-body {
    padding: 2rem;
}

/* ==================== 
   RESPONSIVE STYLES 
   ==================== */
@media (max-width: 991.98px) {
    .sidebar {
        transform: translateX(-100%);
    }
    
    .sidebar.show {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .header-search input {
        width: 200px;
    }
    
    .genealogy-tree {
        padding: 1rem;
    }
    
    .tree-children {
        flex-direction: column;
        align-items: center;
    }
    
    .member-card {
        min-width: 200px;
    }
}

@media (max-width: 767.98px) {
    .header-search {
        display: none;
    }
    
    .stat-card .stat-value {
        font-size: 1.5rem;
    }
    
    .content {
        padding: 1rem;
    }
    
    .card-body {
        padding: 1rem;
    }
}

/* ==================== 
   ANIMATIONS 
   ==================== */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.5s ease forwards;
}

/* ==================== 
   LOADING SPINNER 
   ==================== */
.spinner-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255,255,255,0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #eaecf4;
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ==================== 
   UTILITY CLASSES 
   ==================== */
.text-primary { color: var(--primary-color) !important; }
.text-success { color: var(--success-color) !important; }
.text-info { color: var(--info-color) !important; }
.text-warning { color: var(--warning-color) !important; }
.text-danger { color: var(--danger-color) !important; }

.bg-light { background-color: var(--light-color) !important; }

.border-left-primary { border-left: 4px solid var(--primary-color) !important; }
.border-left-success { border-left: 4px solid var(--success-color) !important; }
.border-left-info { border-left: 4px solid var(--info-color) !important; }
.border-left-warning { border-left: 4px solid var(--warning-color) !important; }

.shadow-sm { box-shadow: 0 0.125rem 0.25rem rgba(0,0,0,0.075) !important; }
.shadow { box-shadow: 0 0.15rem 1.75rem 0 rgba(58, 59, 69, 0.15) !important; }
.shadow-lg { box-shadow: 0 1rem 3rem rgba(0,0,0,0.175) !important; }

.rounded { border-radius: 0.5rem !important; }
.rounded-lg { border-radius: 1rem !important; }
