/* ===================================================================
   Sistem MLM Biner - Stylesheet
   =================================================================== */

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #f0f2f5;
    color: #333;
    font-size: 14px;
    line-height: 1.6;
}

a { color: #2563eb; text-decoration: none; }
a:hover { text-decoration: underline; }

/* === LOGIN PAGE === */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1e3a8a 0%, #2563eb 100%);
    padding: 20px;
}
.login-card {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    width: 100%;
    max-width: 400px;
    padding: 40px;
}
.login-card h1 {
    text-align: center;
    color: #1e3a8a;
    font-size: 24px;
    margin-bottom: 5px;
}
.login-card .subtitle {
    text-align: center;
    color: #888;
    margin-bottom: 30px;
    font-size: 13px;
}
.login-card .logo {
    text-align: center;
    margin-bottom: 20px;
    font-size: 48px;
}

/* === FORMS === */
.form-group { margin-bottom: 18px; }
.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    color: #444;
    font-size: 13px;
}
.form-control {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.form-control:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37,99,235,0.15);
}
textarea.form-control { min-height: 80px; resize: vertical; }
select.form-control { cursor: pointer; }

.btn {
    display: inline-block;
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.2s;
    text-decoration: none;
}
.btn:hover { opacity: 0.9; text-decoration: none; }
.btn-block { display: block; width: 100%; text-align: center; }
.btn-primary { background: #2563eb; color: #fff; }
.btn-success { background: #16a34a; color: #fff; }
.btn-danger { background: #dc2626; color: #fff; }
.btn-warning { background: #d97706; color: #fff; }
.btn-info { background: #0891b2; color: #fff; }
.btn-secondary { background: #6b7280; color: #fff; }
.btn-sm { padding: 5px 12px; font-size: 12px; }

/* === LAYOUT === */
.layout {
    display: flex;
    min-height: 100vh;
}
.sidebar {
    width: 250px;
    background: #1e293b;
    color: #cbd5e1;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    overflow-y: auto;
    z-index: 100;
    transition: transform 0.3s;
}
.sidebar-header {
    padding: 20px;
    text-align: center;
    border-bottom: 1px solid #334155;
}
.sidebar-header h2 {
    color: #fff;
    font-size: 18px;
    margin-bottom: 2px;
}
.sidebar-header .role-badge {
    display: inline-block;
    margin-top: 8px;
    padding: 3px 10px;
    background: #2563eb;
    color: #fff;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
}
.sidebar-header .role-badge.member { background: #16a34a; }

.sidebar-user {
    padding: 15px 20px;
    border-bottom: 1px solid #334155;
    font-size: 13px;
}
.sidebar-user .user-name {
    color: #fff;
    font-weight: 600;
    margin-bottom: 2px;
}

.sidebar-menu {
    list-style: none;
    padding: 10px 0;
}
.sidebar-menu li a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 20px;
    color: #cbd5e1;
    font-size: 14px;
    transition: all 0.2s;
    border-left: 3px solid transparent;
}
.sidebar-menu li a:hover {
    background: #334155;
    color: #fff;
    text-decoration: none;
    border-left-color: #2563eb;
}
.sidebar-menu li a.active {
    background: #334155;
    color: #fff;
    border-left-color: #2563eb;
}
.sidebar-menu .menu-icon {
    font-size: 18px;
    width: 24px;
    text-align: center;
}
.sidebar-menu .menu-section {
    padding: 15px 20px 5px;
    font-size: 11px;
    text-transform: uppercase;
    color: #64748b;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.main-content {
    margin-left: 250px;
    flex: 1;
    min-width: 0;
}
.topbar {
    background: #fff;
    padding: 15px 25px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 50;
}
.topbar h3 {
    color: #1e293b;
    font-size: 18px;
}
.topbar .topbar-right {
    display: flex;
    align-items: center;
    gap: 15px;
}
.topbar .user-info {
    font-size: 13px;
    color: #666;
}
.topbar .user-info strong { color: #1e293b; }

.content-area {
    padding: 25px;
}

/* === CARDS === */
.card {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    margin-bottom: 20px;
    overflow: hidden;
}
.card-header {
    padding: 15px 20px;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.card-header h4 {
    color: #1e293b;
    font-size: 16px;
    margin: 0;
}
.card-body { padding: 20px; }
.card-footer {
    padding: 15px 20px;
    border-top: 1px solid #e5e7eb;
    background: #f9fafb;
}

/* === STAT CARDS / DASHBOARD === */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 20px;
    margin-bottom: 25px;
}
.stat-card {
    background: #fff;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    display: flex;
    align-items: center;
    gap: 15px;
}
.stat-card .stat-icon {
    width: 55px;
    height: 55px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: #fff;
    flex-shrink: 0;
}
.stat-card .stat-icon.blue { background: #2563eb; }
.stat-card .stat-icon.green { background: #16a34a; }
.stat-card .stat-icon.orange { background: #d97706; }
.stat-card .stat-icon.red { background: #dc2626; }
.stat-card .stat-icon.purple { background: #7c3aed; }
.stat-card .stat-icon.cyan { background: #0891b2; }
.stat-card .stat-info h5 {
    font-size: 13px;
    color: #888;
    font-weight: 600;
    margin-bottom: 4px;
}
.stat-card .stat-info .stat-value {
    font-size: 22px;
    font-weight: 700;
    color: #1e293b;
}

/* === TABLES === */
.table-responsive { overflow-x: auto; }
table.data-table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
}
table.data-table thead th {
    background: #f8fafc;
    padding: 12px 15px;
    text-align: left;
    font-size: 13px;
    font-weight: 700;
    color: #475569;
    border-bottom: 2px solid #e2e8f0;
    white-space: nowrap;
}
table.data-table tbody td {
    padding: 11px 15px;
    border-bottom: 1px solid #f1f5f9;
    font-size: 13px;
    color: #334155;
}
table.data-table tbody tr:hover { background: #f8fafc; }
table.data-table .text-right { text-align: right; }
table.data-table .text-center { text-align: center; }

/* === BADGES === */
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
}
.badge-success { background: #dcfce7; color: #166534; }
.badge-danger { background: #fee2e2; color: #991b1b; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-info { background: #dbeafe; color: #1e40af; }
.badge-secondary { background: #e5e7eb; color: #374151; }
.badge-primary { background: #dbeafe; color: #1e40af; }

/* === ALERTS / FLASH === */
.alert {
    padding: 12px 18px;
    border-radius: 6px;
    margin-bottom: 18px;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.alert-success { background: #dcfce7; color: #166534; border: 1px solid #bbf7d0; }
.alert-danger { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }
.alert-warning { background: #fef3c7; color: #92400e; border: 1px solid #fde68a; }
.alert-info { background: #dbeafe; color: #1e40af; border: 1px solid #bfdbfe; }

/* === GENEALOGY TREE === */
.tree-container {
    overflow-x: auto;
    padding: 20px 0;
    min-width: 100%;
}
.tree {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: max-content;
}
.tree-node {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    padding: 0 5px;
}
.tree-card {
    background: #fff;
    border: 2px solid #2563eb;
    border-radius: 8px;
    padding: 10px 15px;
    min-width: 140px;
    text-align: center;
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
    position: relative;
}
.tree-card.empty {
    border: 2px dashed #cbd5e1;
    background: #f8fafc;
    color: #94a3b8;
}
.tree-card .tc-name {
    font-weight: 600;
    font-size: 13px;
    color: #1e293b;
}
.tree-card .tc-code {
    font-size: 11px;
    color: #2563eb;
    font-weight: 600;
}
.tree-card .tc-pos {
    font-size: 10px;
    color: #888;
}
.tree-card.left { border-color: #16a34a; }
.tree-card.right { border-color: #d97706; }
.tree-children {
    display: flex;
    gap: 30px;
    margin-top: 25px;
    position: relative;
}
.tree-children::before {
    content: '';
    position: absolute;
    top: -25px;
    left: 50%;
    width: 1px;
    height: 25px;
    background: #cbd5e1;
}
.tree-node:not(:last-child) .tree-children::after {
    content: '';
}
.tree-connector {
    width: 1px;
    height: 25px;
    background: #cbd5e1;
    margin: 0 auto;
}
.tree-branch {
    display: flex;
    position: relative;
}
.tree-leg-label {
    font-size: 11px;
    font-weight: 700;
    color: #666;
    margin-bottom: 3px;
}

/* === UTILITIES === */
.text-right { text-align: right; }
.text-center { text-align: center; }
.text-muted { color: #888; }
.text-success { color: #16a34a; }
.text-danger { color: #dc2626; }
.text-primary { color: #2563eb; }
.font-bold { font-weight: 700; }
.mt-2 { margin-top: 10px; }
.mt-3 { margin-top: 15px; }
.mb-2 { margin-bottom: 10px; }
.mb-3 { margin-bottom: 15px; }
.mb-4 { margin-bottom: 20px; }
.d-flex { display: flex; }
.justify-between { justify-content: space-between; }
.align-center { align-items: center; }
.gap-2 { gap: 10px; }
.flex-wrap { flex-wrap: wrap; }
.w-100 { width: 100%; }

.row { display: flex; gap: 20px; flex-wrap: wrap; }
.col { flex: 1; min-width: 250px; }
.col-2 { flex: 2; min-width: 250px; }
.col-3 { flex: 3; min-width: 250px; }

.pager {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 15px;
    font-size: 13px;
}
.pager a, .pager span {
    padding: 5px 12px;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    color: #333;
}
.pager a:hover { background: #f1f5f9; text-decoration: none; }
.pager .current { background: #2563eb; color: #fff; border-color: #2563eb; }

.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: #94a3b8;
}
.empty-state .es-icon { font-size: 48px; margin-bottom: 10px; }

/* Toggle switch */
.toggle {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background: #cbd5e1;
    border-radius: 24px;
    transition: 0.3s;
}
.toggle-slider:before {
    content: "";
    position: absolute;
    height: 18px; width: 18px;
    left: 3px; bottom: 3px;
    background: #fff;
    border-radius: 50%;
    transition: 0.3s;
}
.toggle input:checked + .toggle-slider { background: #16a34a; }
.toggle input:checked + .toggle-slider:before { transform: translateX(20px); }

/* Print */
@media print {
    .sidebar, .topbar, .no-print { display: none !important; }
    .main-content { margin-left: 0; }
    .content-area { padding: 0; }
    body { background: #fff; }
    .card { box-shadow: none; border: 1px solid #ddd; }
}

@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .main-content { margin-left: 0; }
    .topbar .menu-toggle { display: block !important; }
}
.menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 22px;
    cursor: pointer;
    color: #333;
}
