/* =====================================================
   KONEKTEZ MLM — Frontend Styles
   ===================================================== */

#kmlm-dashboard {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    max-width: 960px;
    margin: 0 auto;
    color: #1a1a2e;
}

/* HEADER */
.kmlm-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    color: #fff;
    padding: 1.5rem 2rem;
    border-radius: 12px;
    margin-bottom: 1.5rem;
}
.kmlm-header h2 { margin: 0 0 .25rem; font-size: 1.4rem; }
.kmlm-code { font-size: .85rem; opacity: .7; }
.kmlm-status {
    padding: .3rem .9rem;
    border-radius: 20px;
    font-size: .8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .05em;
}
.kmlm-status-active    { background: #00c896; color: #fff; }
.kmlm-status-inactive  { background: #aaa;    color: #fff; }
.kmlm-status-suspended { background: #e74c3c; color: #fff; }

/* STAT CARDS */
.kmlm-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}
.kmlm-card {
    background: #fff;
    border-radius: 10px;
    padding: 1.2rem 1.5rem;
    box-shadow: 0 2px 12px rgba(0,0,0,.07);
    display: flex;
    flex-direction: column;
    gap: .4rem;
}
.kmlm-card-balance { border-top: 4px solid #00c896; }
.kmlm-card-label { font-size: .8rem; color: #888; text-transform: uppercase; letter-spacing: .04em; }
.kmlm-card-value { font-size: 1.5rem; font-weight: 700; color: #1a1a2e; }

/* TABS */
.kmlm-tabs {
    display: flex;
    gap: .5rem;
    border-bottom: 2px solid #e8e8e8;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}
.kmlm-tab {
    background: none;
    border: none;
    padding: .75rem 1.25rem;
    font-size: .95rem;
    cursor: pointer;
    color: #666;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    transition: color .2s, border-color .2s;
}
.kmlm-tab:hover, .kmlm-tab.active {
    color: #1a1a2e;
    border-bottom-color: #00c896;
    font-weight: 600;
}
.kmlm-tab-content { display: none; }
.kmlm-tab-content.active { display: block; }

/* REFERRAL BOX */
.kmlm-ref-box {
    display: flex;
    gap: .5rem;
    margin-bottom: 1rem;
}
.kmlm-ref-box input {
    flex: 1;
    padding: .6rem 1rem;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: .9rem;
    background: #f9f9f9;
}
#kmlm-copy-btn {
    padding: .6rem 1.4rem;
    background: #1a1a2e;
    color: #fff;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: background .2s;
}
#kmlm-copy-btn:hover { background: #00c896; }
.kmlm-hint { font-size: .85rem; color: #888; }

/* SOCIAL SHARE */
.kmlm-share-btns { display: flex; gap: .5rem; flex-wrap: wrap; margin-top: .5rem; }
.kmlm-share-btns a {
    padding: .5rem 1.1rem;
    border-radius: 8px;
    color: #fff;
    text-decoration: none;
    font-size: .85rem;
    font-weight: 600;
}
.kmlm-share-fb { background: #1877f2; }
.kmlm-share-wa { background: #25d366; }
.kmlm-share-tw { background: #000; }

/* BINARY TREE VISUAL */
.kmlm-tree-visual { text-align: center; margin-bottom: 1.5rem; }
.kmlm-tree-root {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    background: linear-gradient(135deg, #1a1a2e, #16213e);
    color: #fff;
    border-radius: 12px;
    padding: 1rem 1.5rem;
    margin-bottom: .5rem;
}
.kmlm-tree-avatar { font-size: 1.8rem; }
.kmlm-tree-name { font-weight: 700; font-size: .95rem; }
.kmlm-tree-code { font-size: .75rem; opacity: .6; }

.kmlm-tree-legs {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin-top: .5rem;
    position: relative;
}
.kmlm-tree-legs::before {
    content: '';
    position: absolute;
    top: -20px;
    left: calc(50% - 1px);
    height: 20px;
    width: 2px;
    background: #ddd;
}
.kmlm-tree-leg { display: flex; flex-direction: column; align-items: center; gap: .5rem; }
.kmlm-leg-label { font-size: .75rem; font-weight: 600; color: #888; text-transform: uppercase; letter-spacing: .05em; }

.kmlm-tree-node {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: #f0fff8;
    border: 2px solid #00c896;
    border-radius: 12px;
    padding: .75rem 1.2rem;
    min-width: 120px;
}
.kmlm-tree-empty {
    background: #fafafa;
    border-style: dashed;
    border-color: #ccc;
}
.kmlm-tree-empty .kmlm-tree-avatar { opacity: .4; }

/* TABLES */
.kmlm-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .9rem;
    background: #fff;
    box-shadow: 0 2px 12px rgba(0,0,0,.06);
    border-radius: 10px;
    overflow: hidden;
}
.kmlm-table th {
    background: #1a1a2e;
    color: #fff;
    padding: .75rem 1rem;
    text-align: left;
    font-size: .8rem;
    text-transform: uppercase;
    letter-spacing: .04em;
}
.kmlm-table td { padding: .75rem 1rem; border-bottom: 1px solid #f0f0f0; }
.kmlm-table tr:last-child td { border-bottom: none; }
.kmlm-table tr:hover td { background: #f9fffe; }

/* BADGES */
.kmlm-badge {
    display: inline-block;
    padding: .2rem .6rem;
    border-radius: 20px;
    font-size: .75rem;
    font-weight: 700;
    text-transform: uppercase;
}
.kmlm-badge-pending    { background: #fff3cd; color: #856404; }
.kmlm-badge-approved   { background: #d1fae5; color: #065f46; }
.kmlm-badge-paid       { background: #cce5ff; color: #004085; }
.kmlm-badge-cancelled  { background: #f8d7da; color: #721c24; }
.kmlm-badge-processing { background: #e2d9f3; color: #4a0e8f; }
.kmlm-badge-completed  { background: #d1fae5; color: #065f46; }
.kmlm-badge-rejected   { background: #f8d7da; color: #721c24; }

/* PAYOUT FORM */
.kmlm-payout-form {
    background: #fff;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 2px 12px rgba(0,0,0,.07);
    max-width: 540px;
    margin-bottom: 2rem;
}
.kmlm-form-row { margin-bottom: 1rem; }
.kmlm-form-row label { display: block; font-weight: 600; margin-bottom: .35rem; font-size: .9rem; }
.kmlm-form-row input,
.kmlm-form-row select,
.kmlm-form-row textarea {
    width: 100%;
    padding: .6rem .9rem;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: .9rem;
    transition: border-color .2s;
    box-sizing: border-box;
}
.kmlm-form-row input:focus,
.kmlm-form-row select:focus,
.kmlm-form-row textarea:focus { border-color: #00c896; outline: none; }

.kmlm-btn {
    padding: .75rem 2rem;
    background: #1a1a2e;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: background .2s;
}
.kmlm-btn:hover { background: #00c896; }

.kmlm-msg { padding: .75rem 1rem; border-radius: 8px; font-size: .9rem; margin-bottom: 1rem; }
.kmlm-msg.success { background: #d1fae5; color: #065f46; }
.kmlm-msg.error   { background: #f8d7da; color: #721c24; }

/* MISC */
.kmlm-empty { color: #888; text-align: center; padding: 2rem; font-style: italic; }
.kmlm-notice { background: #fff3cd; border-left: 4px solid #ffc107; padding: 1rem 1.25rem; border-radius: 6px; }

@media (max-width: 600px) {
    .kmlm-header { flex-direction: column; gap: .75rem; text-align: center; }
    .kmlm-tree-legs { flex-direction: column; align-items: center; }
    .kmlm-cards { grid-template-columns: 1fr 1fr; }
}
