/* ============================================================
   assets/style.css — InstaReply Global Styles
   ============================================================ */

:root {
    --ig-gradient: linear-gradient(135deg, #833ab4 0%, #fd1d1d 50%, #fcb045 100%);
    --sidebar-w:   240px;
    --sidebar-bg:  linear-gradient(180deg, #833ab4 0%, #fd1d1d 100%);
    --sidebar-admin-bg: linear-gradient(180deg, #1a1a2e 0%, #16213e 100%);
    --topbar-h:    56px;
}

/* ---- Reset & Base ---- */
*, *::before, *::after { box-sizing: border-box; }
body {
    background: #f4f6fb;
    font-family: 'Segoe UI', system-ui, sans-serif;
    min-height: 100vh;
    margin: 0;
}

/* ============================================================
   SIDEBAR
   ============================================================ */
.sidebar {
    position: fixed;
    top: 0; left: 0;
    width: var(--sidebar-w);
    height: 100vh;
    display: flex;
    flex-direction: column;
    z-index: 1040;
    transition: transform .3s ease;
    overflow: hidden;
}
.sidebar-user  { background: var(--sidebar-bg); }
.sidebar-admin { background: var(--sidebar-admin-bg); }

/* Brand (desktop only) */
.sidebar-brand {
    padding: 22px 20px 16px;
    color: #fff;
    font-size: 1.15rem;
    font-weight: 800;
    align-items: center;
    gap: 8px;
    border-bottom: 1px solid rgba(255,255,255,.15);
    flex-shrink: 0;
}

/* User strip */
.sidebar-user-strip {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 18px;
    border-bottom: 1px solid rgba(255,255,255,.12);
    flex-shrink: 0;
}
.sidebar-avatar {
    font-size: 2rem;
    color: rgba(255,255,255,.85);
    line-height: 1;
}
.sidebar-user-name {
    color: #fff;
    font-weight: 700;
    font-size: .9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 140px;
}
.sidebar-user-role {
    color: rgba(255,255,255,.6);
    font-size: .72rem;
}

/* Nav links */
.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 12px 10px;
}
.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,.2); border-radius: 4px; }

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 14px;
    border-radius: 10px;
    color: rgba(255,255,255,.82);
    text-decoration: none;
    font-size: .9rem;
    font-weight: 500;
    margin-bottom: 3px;
    transition: background .18s, color .18s, transform .15s;
}
.sidebar-link i { font-size: 1.05rem; flex-shrink: 0; }
.sidebar-link:hover {
    background: rgba(255,255,255,.18);
    color: #fff;
    transform: translateX(3px);
}
.sidebar-link.active {
    background: rgba(255,255,255,.25);
    color: #fff;
    font-weight: 700;
    box-shadow: 0 2px 8px rgba(0,0,0,.15);
}

/* Logout */
.sidebar-bottom {
    padding: 10px 10px 14px;
    border-top: 1px solid rgba(255,255,255,.12);
    flex-shrink: 0;
}
.sidebar-logout { color: rgba(255,255,255,.7); }
.sidebar-logout:hover { background: rgba(255,0,0,.2); color: #fca5a5; }

/* ============================================================
   MOBILE TOP BAR
   ============================================================ */
.mobile-topbar {
    position: fixed;
    top: 0; left: 0; right: 0;
    height: var(--topbar-h);
    background: var(--ig-gradient);
    z-index: 1030;
    box-shadow: 0 2px 10px rgba(0,0,0,.2);
}
.admin-body .mobile-topbar { background: linear-gradient(135deg,#1a1a2e,#16213e); }

.topbar-brand {
    color: #fff;
    font-weight: 800;
    font-size: 1.05rem;
    text-decoration: none;
}
.topbar-username {
    color: rgba(255,255,255,.85);
    font-size: .82rem;
    max-width: 100px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Three-dot button */
.three-dot-btn {
    background: rgba(255,255,255,.2);
    border: none;
    border-radius: 8px;
    width: 38px; height: 38px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    cursor: pointer;
    padding: 0;
    transition: background .2s;
}
.three-dot-btn:hover { background: rgba(255,255,255,.35); }
.three-dot-btn span {
    display: block;
    width: 5px; height: 5px;
    background: #fff;
    border-radius: 50%;
}

/* Mobile sidebar slide-in */
@media (max-width: 991.98px) {
    .sidebar {
        transform: translateX(-100%);
        width: 260px;
        box-shadow: 4px 0 24px rgba(0,0,0,.3);
    }
    .sidebar.open { transform: translateX(0); }
    .sidebar-brand { display: flex !important; }
}

/* Overlay */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.45);
    z-index: 1035;
    backdrop-filter: blur(2px);
}
.sidebar-overlay.show { display: block; }

/* ============================================================
   MAIN LAYOUT
   ============================================================ */
.main-layout {
    margin-left: var(--sidebar-w);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}
.main-content-area {
    flex: 1;
    padding: 28px 24px 16px;
}

@media (max-width: 991.98px) {
    .main-layout {
        margin-left: 0;
        padding-top: var(--topbar-h);
    }
    .main-content-area { padding: 20px 14px 12px; }
}

/* ============================================================
   CARDS
   ============================================================ */
.card {
    border: none;
    border-radius: 14px;
    box-shadow: 0 2px 12px rgba(0,0,0,.07);
}
.card-header {
    background: #fff;
    border-bottom: 1px solid #eee;
    border-radius: 14px 14px 0 0 !important;
    font-weight: 600;
}

/* ============================================================
   STAT CARDS
   ============================================================ */
.stat-card {
    border-radius: 14px;
    color: #fff;
    padding: 1.4rem;
    position: relative;
    overflow: hidden;
}
.stat-card .stat-icon {
    font-size: 2.8rem;
    opacity: 0.22;
    position: absolute;
    right: 16px; bottom: 10px;
}
.stat-card .stat-num   { font-size: 2rem; font-weight: 700; }
.stat-card .stat-label { font-size: .85rem; opacity: .88; }

.stat-purple { background: linear-gradient(135deg, #6C63FF, #a78bfa); }
.stat-pink   { background: linear-gradient(135deg, #f64f59, #c471ed); }
.stat-teal   { background: linear-gradient(135deg, #0abde3, #48dbfb); }
.stat-orange { background: linear-gradient(135deg, #f7971e, #ffd200); }

/* ============================================================
   INSTAGRAM BUTTON
   ============================================================ */
.btn-instagram {
    background: var(--ig-gradient);
    color: #fff;
    border: none;
    border-radius: 8px;
}
.btn-instagram:hover { opacity: .88; color: #fff; }

/* ============================================================
   TABLES
   ============================================================ */
.table thead { background: #f8f9fa; }
.table th { font-weight: 600; color: #555; font-size: .88rem; }
.table td { vertical-align: middle; font-size: .9rem; }
.badge-match { font-size: .75rem; }

/* ============================================================
   AUTH PAGES
   ============================================================ */
.auth-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}
.auth-card {
    width: 100%;
    max-width: 430px;
    border-radius: 20px;
    padding: 2.5rem;
    box-shadow: 0 20px 60px rgba(0,0,0,.25);
}
.auth-logo {
    font-size: 2.5rem;
    background: var(--ig-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}
.auth-title { font-weight: 700; margin-top: .5rem; }

/* ============================================================
   FOOTER
   ============================================================ */
.footer-bar {
    background: #fff;
    border-top: 1px solid #eee;
}

/* ============================================================
   KEYWORD & STATUS BADGES
   ============================================================ */
.kw-pill {
    background: #ede9fe;
    color: #5b21b6;
    border-radius: 50px;
    padding: 3px 12px;
    font-size: .82rem;
    font-weight: 600;
}
.status-replied  { background:#d1fae5; color:#065f46; }
.status-no_match { background:#fee2e2; color:#991b1b; }
.status-error    { background:#fef3c7; color:#92400e; }
.status-ignored  { background:#e5e7eb; color:#374151; }

/* ---- Log Message Preview ---- */
.msg-preview {
    max-width: 220px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: inline-block;
}