/* ============================================
   LACTALIS - COMPLETE RESPONSIVE STYLES
   ============================================ */

:root {
    /* Primary Colors */
    --primary: #1f85d6;
    --primary-dark: #0d6fbf;
    --primary-light: #4cb3ff;
    
    /* Status Colors */
    --success: #16a34a;
    --warning: #d97706;
    --danger: #dc2626;
    --info: #0ea5e9;
    
    /* Background Colors */
    --bg: #f3f6fb;
    --card: #ffffff;
    
    /* Text Colors */
    --text: #1b1f2a;
    --text-light: #4a5568;
    --text-muted: #6b7280;
    
    /* Border & Shadows */
    --border: #e6eef8;
    --shadow: 0 10px 25px rgba(0,0,0,0.1);
    --shadow-lg: 0 20px 60px rgba(0,0,0,0.15);
    
    /* Radius */
    --radius-sm: 8px;
    --radius: 16px;
    --radius-lg: 24px;
    
    /* Spacing */
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 16px;
    --space-lg: 24px;
    --space-xl: 32px;
    
    /* Font Sizes */
    --text-xs: 12px;
    --text-sm: 14px;
    --text-base: 16px;
    --text-lg: 18px;
    --text-xl: 20px;
    --text-2xl: 24px;
}

/* ========== RESET & BASE ========== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: var(--text);
    line-height: 1.5;
    min-height: 100vh;
    overflow-x: hidden;
    padding: 20px;
}

/* ========== LAYOUT ========== */
.wrap {
    width: 100%;
    max-width: 500px;
    margin: 0 auto;
}

/* ========== HEADER & LOGO ========== */
.top-logo {
    text-align: center;
    margin-bottom: 20px;
}

.top-logo img {
    width: 100px;
    height: 100px;
    border-radius: 20px;
    object-fit: cover;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    border: 3px solid white;
}

/* ========== CARDS ========== */
.card {
    background: var(--card);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    margin-bottom: var(--space-lg);
    box-shadow: var(--shadow-lg);
    width: 100%;
}

/* ========== TOPBAR ========== */
.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: var(--space-md);
    margin-bottom: var(--space-lg);
    border-bottom: 2px solid var(--border);
}

.topbar .title {
    font-size: var(--text-xl);
    font-weight: 800;
    color: var(--text);
}

.topbar a {
    background: var(--primary);
    color: white;
    padding: 10px 20px;
    border-radius: var(--radius);
    text-decoration: none;
    font-weight: 600;
    font-size: var(--text-sm);
    transition: all 0.3s;
}

.topbar a:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
}

/* ========== TABS ========== */
.tabs {
    display: flex;
    gap: 10px;
    margin-bottom: var(--space-lg);
}

.tab {
    flex: 1;
    text-align: center;
    padding: 12px;
    border-radius: var(--radius);
    background: var(--bg);
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 600;
    border: 2px solid transparent;
    transition: all 0.3s;
}

.tab.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.tab:hover:not(.active) {
    border-color: var(--border);
    background: white;
}

/* ========== FORMS ========== */
label {
    display: block;
    font-size: var(--text-sm);
    color: var(--text-muted);
    margin-bottom: var(--space-sm);
    font-weight: 500;
}

.in {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg);
    font-size: var(--text-base);
    transition: all 0.3s;
    margin-bottom: var(--space-md);
}

.in:focus {
    outline: none;
    border-color: var(--primary);
    background: white;
    box-shadow: 0 0 0 3px rgba(31, 133, 214, 0.1);
}

/* ========== BUTTONS ========== */
.btn {
    width: 100%;
    padding: 16px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    border: none;
    border-radius: var(--radius);
    font-size: var(--text-base);
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s;
    margin-top: var(--space-md);
    display: block;
    text-align: center;
    text-decoration: none;
}

.btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 20px rgba(31, 133, 214, 0.3);
}

.btn-secondary {
    background: linear-gradient(135deg, var(--success), #15803d);
}

.btn-warning {
    background: linear-gradient(135deg, var(--warning), #b45309);
}

.btn-danger {
    background: linear-gradient(135deg, var(--danger), #b91c1c);
}

/* ========== NAVIGATION GRID ========== */
.navgrid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-sm);
    margin: var(--space-lg) 0;
}

.navitem {
    background: var(--bg);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    padding: var(--space-md) var(--space-sm);
    text-align: center;
    text-decoration: none;
    color: var(--text);
    transition: all 0.3s;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 90px;
}

.navitem:hover {
    background: var(--primary);
    color: white;
    transform: translateY(-5px);
    border-color: var(--primary);
    box-shadow: 0 10px 20px rgba(0,0,0,0.1);
}

.navitem b {
    display: block;
    margin-top: var(--space-sm);
    font-size: var(--text-xs);
    font-weight: 700;
}

/* ========== STATS & BOXES ========== */
.stat {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: var(--space-md);
    margin: var(--space-lg) 0;
}

.box {
    background: var(--bg);
    border-radius: var(--radius);
    padding: var(--space-lg);
    text-align: center;
    border: 2px solid var(--border);
}

.box .k {
    font-size: var(--text-sm);
    color: var(--text-muted);
    margin-bottom: var(--space-sm);
    font-weight: 600;
}

.box .v {
    font-size: var(--text-2xl);
    font-weight: 900;
    color: var(--text);
}

/* ========== TABLES ========== */
.table {
    width: 100%;
    border-collapse: collapse;
    margin-top: var(--space-md);
    font-size: var(--text-sm);
}

.table th {
    background: var(--bg);
    padding: 12px;
    text-align: left;
    font-weight: 700;
    color: var(--text);
    border-bottom: 2px solid var(--border);
}

.table td {
    padding: 12px;
    border-bottom: 1px solid var(--border);
    vertical-align: top;
}

.table tr:hover {
    background: var(--bg);
}

/* ========== BADGES ========== */
.badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: var(--text-xs);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.b-approved, .b-paid, .b-active {
    background: linear-gradient(135deg, var(--success), #15803d);
    color: white;
}

.b-pending {
    background: linear-gradient(135deg, var(--warning), #b45309);
    color: white;
}

.b-rejected, .b-blocked, .b-expired {
    background: linear-gradient(135deg, var(--danger), #b91c1c);
    color: white;
}

/* ========== NOTICES ========== */
.notice {
    padding: var(--space-md);
    border-radius: var(--radius);
    margin-bottom: var(--space-lg);
    font-weight: 500;
    border-left: 4px solid;
}

.notice.ok {
    background: linear-gradient(135deg, #d1fae5, #86efac);
    color: #065f46;
    border-left-color: var(--success);
}

.notice.err {
    background: linear-gradient(135deg, #fee2e2, #fca5a5);
    color: #7f1d1d;
    border-left-color: var(--danger);
}

.notice.warn {
    background: linear-gradient(135deg, #fef3c7, #fbbf24);
    color: #92400e;
    border-left-color: var(--warning);
}

/* ========== TEXT ========== */
.small {
    font-size: var(--text-sm);
    color: var(--text-muted);
}

.link {
    text-align: center;
    margin-top: var(--space-md);
    color: var(--text-muted);
}

.link a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
}

.link a:hover {
    text-decoration: underline;
}

/* ========== UTILITY CLASSES ========== */
.text-center { text-align: center; }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }

.mt-1 { margin-top: var(--space-xs); }
.mt-2 { margin-top: var(--space-sm); }
.mt-3 { margin-top: var(--space-md); }
.mt-4 { margin-top: var(--space-lg); }

.mb-1 { margin-bottom: var(--space-xs); }
.mb-2 { margin-bottom: var(--space-sm); }
.mb-3 { margin-bottom: var(--space-md); }
.mb-4 { margin-bottom: var(--space-lg); }

.p-1 { padding: var(--space-xs); }
.p-2 { padding: var(--space-sm); }
.p-3 { padding: var(--space-md); }
.p-4 { padding: var(--space-lg); }

.w-100 { width: 100%; }
.rounded { border-radius: var(--radius); }

/* ========== MOBILE RESPONSIVE ========== */
@media (max-width: 768px) {
    body {
        padding: 15px;
        background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    }
    
    html {
        font-size: 14px;
    }
    
    .wrap {
        max-width: 100%;
        padding: 0;
    }
    
    .card {
        padding: var(--space-md);
        border-radius: var(--radius);
        margin-bottom: var(--space-md);
    }
    
    .navgrid {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--space-sm);
        margin: var(--space-md) 0;
    }
    
    .navitem {
        min-height: 80px;
        padding: var(--space-sm);
    }
    
    .navitem b {
        font-size: 10px;
    }
    
    .stat {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--space-sm);
        margin: var(--space-md) 0;
    }
    
    .table {
        font-size: var(--text-xs);
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .table th,
    .table td {
        padding: 8px;
        white-space: nowrap;
    }
    
    .topbar {
        flex-direction: column;
        gap: var(--space-sm);
        text-align: center;
        padding-bottom: var(--space-sm);
        margin-bottom: var(--space-md);
    }
    
    .topbar .title {
        font-size: var(--text-lg);
        order: 1;
    }
    
    .topbar a {
        order: 2;
        width: 100%;
        margin-top: var(--space-sm);
    }
    
    .btn {
        padding: 14px;
        font-size: var(--text-sm);
    }
    
    .box {
        padding: var(--space-md);
    }
    
    .box .v {
        font-size: var(--text-xl);
    }
    
    .tabs {
        flex-direction: column;
    }
    
    .in {
        padding: 12px;
        font-size: var(--text-sm);
    }
    
    .badge {
        font-size: 10px;
        padding: 3px 8px;
    }
    
    .top-logo img {
        width: 80px;
        height: 80px;
    }
    
    /* Mobile specific */
    .mobile-btn {
        padding: 14px !important;
        font-size: 14px !important;
    }
    
    .profit-banner {
        font-size: 12px !important;
        padding: 10px !important;
    }
    
    .referral-link-box {
        padding: 15px !important;
    }
    
    .referral-link-box input {
        font-size: 12px !important;
        padding: 10px !important;
    }
    
    .team-member {
        padding: 12px !important;
        margin: 8px 0 !important;
    }
    
    .team-member.level-2 {
        margin-left: 15px !important;
    }
    
    .team-member.level-3 {
        margin-left: 30px !important;
    }
    
    .plan-card {
        padding: 15px !important;
        margin: 12px 0 !important;
    }
    
    .plan-title {
        font-size: 16px !important;
    }
    
    .plan-price {
        font-size: 20px !important;
    }
}

@media (max-width: 480px) {
    .navgrid {
        grid-template-columns: 1fr;
    }
    
    .stat {
        grid-template-columns: 1fr;
    }
    
    .table {
        font-size: 11px;
    }
    
    .topbar .title {
        font-size: var(--text-base);
    }
    
    body {
        padding: 10px;
    }
    
    .card {
        padding: 12px;
    }
}

/* ========== ANIMATIONS ========== */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes pulse {
    0%, 100% { opacity: 0.9; }
    50% { opacity: 1; }
}

.animate-fade { animation: fadeIn 0.3s ease; }
.animate-pulse { animation: pulse 2s infinite; }

/* ========== SCROLLBAR ========== */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg);
}

::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary-dark);
}