/* ============================================================
   Time Léo Vieira Filho v0.01 — Estilos principais
   ============================================================ */

:root {
    --sidebar-bg:      #0f172a;
    --sidebar-hover:   #1e293b;
    --sidebar-active:  #6366f1;
    --sidebar-text:    #94a3b8;
    --sidebar-text-light: #e2e8f0;
    --sidebar-width:   260px;
    --accent:          #6366f1;
    --accent-hover:    #4f46e5;
    --content-bg:      #f1f5f9;
    --card-bg:         #ffffff;
    --text-primary:    #0f172a;
    --text-muted:      #64748b;
    --border-color:    #e2e8f0;
    --topbar-height:   60px;
}

*, *::before, *::after { box-sizing: border-box; }

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--content-bg);
    color: var(--text-primary);
    margin: 0;
}

#wrapper {
    width: 100%;
    min-height: 100vh;
}

/* ---- SIDEBAR ---- */
#sidebar {
    width: var(--sidebar-width);
    min-height: 100vh;
    background: var(--sidebar-bg);
    position: fixed;
    top: 0; left: 0;
    display: flex;
    flex-direction: column;
    z-index: 200;
    transition: transform .3s ease;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 22px 20px 18px;
    border-bottom: 1px solid #1e293b;
}
.brand-icon {
    width: 36px; height: 36px;
    background: var(--accent);
    border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-size: 18px;
}
.brand-text {
    font-size: 16px;
    font-weight: 300;
    color: var(--sidebar-text-light);
    letter-spacing: 0;
    line-height: 1.2;
}
.brand-text strong { font-weight: 700; color: var(--accent); }
.brand-version {
    margin-left: auto;
    font-size: 10px;
    background: #1e293b;
    color: var(--sidebar-text);
    padding: 2px 6px;
    border-radius: 4px;
}

.sidebar-nav {
    list-style: none;
    padding: 16px 0;
    margin: 0;
    flex: 1;
    overflow-y: auto;
}
.sidebar-nav li a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 20px;
    color: var(--sidebar-text);
    text-decoration: none;
    font-size: 14px;
    border-radius: 0;
    transition: all .2s;
}
.sidebar-nav li a i { width: 18px; text-align: center; font-size: 15px; }
.sidebar-nav li a:hover {
    background: var(--sidebar-hover);
    color: var(--sidebar-text-light);
}
.sidebar-nav li.active a {
    background: var(--accent);
    color: #fff;
    border-left: 3px solid #a5b4fc;
}
.nav-label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: #475569;
    padding: 12px 20px 4px;
    font-weight: 600;
}

.sidebar-footer {
    padding: 14px 20px;
    border-top: 1px solid #1e293b;
    font-size: 12px;
    color: var(--sidebar-text);
}
.badge-role {
    display: inline-block;
    background: #1e293b;
    color: var(--accent);
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 4px;
    margin-left: 6px;
    text-transform: capitalize;
}

/* ---- CONTENT WRAPPER ---- */
#content-wrapper {
    margin-left: var(--sidebar-width);
    width: calc(100% - var(--sidebar-width));
    min-height: 100vh;
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    transition: margin-left .3s ease;
}

/* ---- TOP NAVBAR ---- */
.top-navbar {
    height: var(--topbar-height);
    background: var(--card-bg);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    padding: 0 24px;
    gap: 16px;
    position: sticky;
    top: 0;
    z-index: 100;
}
.btn-sidebar-toggle {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 18px;
    cursor: pointer;
    padding: 6px 8px;
    border-radius: 6px;
    transition: background .2s;
}
.btn-sidebar-toggle:hover { background: var(--content-bg); }
.top-navbar-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}
.top-navbar-right {
    margin-left: auto;
    font-size: 13px;
    color: var(--text-muted);
}
.user-greeting { display: flex; align-items: center; gap: 6px; }

/* ---- MAIN CONTENT ---- */
.main-content {
    flex: 1;
    padding: 28px 28px 0;
}

.alert-flash { border-radius: 10px; }

.main-footer {
    padding: 16px 28px;
    font-size: 12px;
    color: var(--text-muted);
    border-top: 1px solid var(--border-color);
    margin-top: 28px;
}

/* ---- CARDS ---- */
.card {
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,.04);
}
.card-header {
    background: var(--card-bg);
    border-bottom: 1px solid var(--border-color);
    font-weight: 600;
    border-radius: 12px 12px 0 0 !important;
    padding: 16px 20px;
}

/* Stat cards */
.stat-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 20px 22px;
    display: flex;
    align-items: center;
    gap: 18px;
    transition: box-shadow .2s;
}
.stat-card:hover { box-shadow: 0 4px 16px rgba(99,102,241,.08); }
.stat-icon {
    width: 52px; height: 52px;
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 22px;
    flex-shrink: 0;
}
.stat-icon.purple { background: #ede9fe; color: var(--accent); }
.stat-icon.green  { background: #dcfce7; color: #16a34a; }
.stat-icon.blue   { background: #dbeafe; color: #2563eb; }
.stat-icon.orange { background: #ffedd5; color: #ea580c; }
.stat-value { font-size: 28px; font-weight: 700; line-height: 1; }
.stat-label { font-size: 13px; color: var(--text-muted); margin-top: 3px; }

/* ---- TABLES ---- */
.table { font-size: 14px; }
.table th {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .5px;
    color: var(--text-muted);
    font-weight: 600;
    border-bottom-width: 1px;
}
.table td { vertical-align: middle; }
.table-hover tbody tr:hover { background: #f8fafc; }

/* ---- BADGES ---- */
.badge-active   { background: #dcfce7; color: #15803d; }
.badge-inactive { background: #fee2e2; color: #b91c1c; }
.badge-expired  { background: #fef9c3; color: #854d0e; }
.badge-used     { background: #dbeafe; color: #1d4ed8; }
.status-badge {
    display: inline-block;
    font-size: 11px;
    font-weight: 600;
    padding: 3px 9px;
    border-radius: 20px;
    text-transform: capitalize;
}

/* ---- BUTTONS ---- */
.btn-primary   { background: var(--accent); border-color: var(--accent); }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-sm { font-size: 12px; }

/* ---- FORMS ---- */
.form-label { font-size: 13px; font-weight: 500; color: var(--text-primary); }
.form-control, .form-select {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 14px;
}
.form-control:focus, .form-select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(99,102,241,.15);
}

/* ---- LINK COPY BOX ---- */
.link-box {
    background: #f8fafc;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 14px 16px;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    word-break: break-all;
    color: var(--accent);
}
.copy-btn { cursor: pointer; }

/* ---- SIDEBAR COLLAPSED ---- */
body.sidebar-collapsed #sidebar { transform: translateX(-100%); }
body.sidebar-collapsed #content-wrapper {
    margin-left: 0;
    width: 100%;
}

/* ---- AUTOCOMPLETE ---- */
.autocomplete-wrapper { position: relative; }
.autocomplete-dropdown {
    position: absolute;
    top: calc(100% + 2px);
    left: 0; right: 0;
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: 0 0 10px 10px;
    max-height: 220px;
    overflow-y: auto;
    z-index: 9999;
    box-shadow: 0 6px 20px rgba(0,0,0,.1);
}
.ac-item {
    padding: 9px 14px;
    cursor: pointer;
    font-size: 14px;
    border-bottom: 1px solid #f1f5f9;
    transition: background .15s;
}
.ac-item:last-child { border-bottom: none; }
.ac-item:hover { background: #f1f5f9; }

/* ---- WA & CEP STATUS ---- */
.wa-status, .cep-status { font-size: 12px; min-height: 18px; }

/* ---- INSTAGRAM PREFIX ---- */
.instagram-prefix {
    background: linear-gradient(135deg, #833ab4, #fd1d1d, #fcb045);
    color: #fff;
    border: none;
    font-weight: 600;
}

/* ---- SIDEBAR SUBMENU ---- */
.sidebar-nav li[style*="padding-left"] a {
    opacity: .75;
    border-left: 2px solid transparent;
}
.sidebar-nav li[style*="padding-left"] a:hover {
    opacity: 1;
    border-left-color: #a5b4fc;
}
.sidebar-nav li[style*="padding-left"].active a {
    opacity: 1;
    background: rgba(99,102,241,.3);
    border-left-color: #a5b4fc;
}

/* ---- RESPONSIVE ---- */
@media (max-width: 768px) {
    #sidebar { transform: translateX(-100%); }
    #content-wrapper { margin-left: 0; width: 100%; }
    body.sidebar-open #sidebar { transform: translateX(0); }
    .main-content { padding: 16px 16px 0; }
}
