/* OneLauncher Admin — Premium Design System */
@import url('https://fonts.googleapis.com/css2?family=Fira+Sans:wght@300;400;500;600;700&family=Poppins:wght@400;600;700&display=swap');

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

:root {
    --bg-dark: #0B0F19;
    --bg-card: rgba(16, 25, 53, 0.7);
    --bg-active: rgba(59, 130, 246, 0.15);
    --bg-input: rgba(8, 15, 37, 0.8);
    --text-primary: #F8FAFC;
    --text-muted: #94A3B8;
    --accent-blue: #3B82F6;
    --accent-cyan: #06B6D4;
    --accent-green: #10B981;
    --accent-yellow: #F59E0B;
    --accent-red: #EF4444;
    --accent-info: #06B6D4;
    --border: rgba(255, 255, 255, 0.08);
    --border-hover: rgba(59, 130, 246, 0.4);
    --radius: 16px;
    --glass: blur(12px);
}

body {
    background: var(--bg-dark);
    color: var(--text-primary);
    font-family: 'Fira Sans', sans-serif;
    font-size: 15px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6, .sidebar-logo-text {
    font-family: 'Poppins', sans-serif;
}

/* ── KPI Cards (OneCloud Style) ── */
.content-kpi-card { 
    position: relative; 
    overflow: hidden; 
    border: 1px solid var(--border); 
    border-radius: var(--radius);
    color: #fff; 
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1); 
    background: var(--bg-card);
    backdrop-filter: var(--glass);
    height: 100%;
}
.content-kpi-card:hover { 
    transform: translateY(-5px); 
    border-color: var(--border-hover);
    box-shadow: 0 12px 24px rgba(0,0,0,0.4); 
}
.content-kpi-card.bg-accent-blue { background: linear-gradient(135deg, #3B82F6, #1D4ED8); }
.content-kpi-card.bg-accent-green { background: linear-gradient(135deg, #10B981, #059669); }
.content-kpi-card.bg-accent-yellow { background: linear-gradient(135deg, #F59E0B, #D97706); }
.content-kpi-card.bg-accent-info { background: linear-gradient(135deg, #06B6D4, #0891B2); }
.content-kpi-card.bg-accent-red { background: linear-gradient(135deg, #EF4444, #B91C1C); }

.content-kpi-card::before { 
    font-family: 'bootstrap-icons'; 
    content: var(--icon-char); 
    position: absolute; 
    top: 50%; 
    right: -15px; 
    font-size: 90px; 
    line-height: 1; 
    color: #fff; 
    opacity: 0.15; 
    transform: translateY(-50%) rotate(-15deg); 
    transition: all 0.4s ease-in-out; 
    z-index: 1; 
}
.content-kpi-card:hover::before { 
    transform: translateY(-55%) rotate(-5deg) scale(1.1); 
    opacity: 0.25; 
}
.content-kpi-card .card-body { position: relative; z-index: 2; padding: 1.5rem; }
.content-kpi-card .main-icon { font-size: 1.8rem; opacity: 0.7; margin-bottom: 0.75rem; }
.content-kpi-card .card-title { font-size: 0.9rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; opacity: 0.9; }
.content-kpi-card .card-text { font-size: 2rem; font-weight: 700; }


html { height: 100%; overflow-x: hidden; }

body {
    background: var(--bg-dark);
    color: var(--text-primary);
    font-size: 15px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

body.app-body {
    min-height: 100vh;
    background-image:
        radial-gradient(ellipse 80% 70% at 0% 0%, rgba(59, 130, 246, 0.12), transparent 50%),
        radial-gradient(ellipse 60% 50% at 100% 0%, rgba(59, 130, 246, 0.08), transparent 50%),
        radial-gradient(ellipse 50% 40% at 80% 100%, rgba(59, 130, 246, 0.05), transparent 45%);
}

/* ── Custom Scrollbar ── */
body::-webkit-scrollbar { width: 8px; }
body::-webkit-scrollbar-track { background: var(--bg-dark); }
body::-webkit-scrollbar-thumb {
    background: var(--accent-blue);
    border-radius: 10px;
    border: 2px solid var(--bg-dark);
}

/* ── SimpleBar ── */
.simplebar-scrollbar::before { background: var(--accent-blue); opacity: 0.5; }
.simplebar-scrollbar.simplebar-visible::before { opacity: 0.8; }
.simplebar-track.simplebar-vertical { width: 7px; background: rgba(255,255,255,0.02); }

/* ══════════════════════════════════════
   TOPBAR (mobile-topbar)
══════════════════════════════════════ */
.mobile-topbar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 65px;
    background: rgba(8, 15, 37, 0.95);
    backdrop-filter: blur(10px);
    z-index: 1030;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    color: var(--text-primary);
    box-shadow: 0 2px 10px rgba(0,0,0,0.4);
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

.mobile-topbar__left {
    display: flex;
    align-items: center;
    gap: 14px;
}

.topbar-page-title {
    font-size: 1rem;
    font-weight: 600;
    color: #fff;
    margin: 0;
}

.welcome-text {
    font-size: 1rem;
    font-weight: 600;
    margin-left: 0;
}

@media (min-width: 769px) {
    .welcome-text { margin-left: 260px; }
}

.sidebar-toggle {
    font-size: 20px;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-primary);
    line-height: 1;
    padding: 0;
}
.sidebar-toggle:hover { color: var(--accent-blue); }

/* Header right side */
.header {
    display: flex;
    align-items: center;
    gap: 10px;
}

.profile-menu button {
    background: none;
    border: none;
    cursor: pointer;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    padding: 0;
}
.profile-menu button .user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-blue), var(--accent-cyan));
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.85rem;
    color: #fff;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.4);
}

.profile-dropdown {
    position: absolute;
    top: 55px;
    right: 10px;
    background: var(--bg-card);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    display: none;
    flex-direction: column;
    width: 160px;
    z-index: 2500;
    overflow: hidden;
}
.profile-dropdown.open { display: flex; }
.profile-dropdown a {
    color: rgba(255, 255, 255, 0.85);
    padding: 10px 14px;
    text-decoration: none;
    font-size: 0.88rem;
    transition: background 0.2s;
}
.profile-dropdown a:hover {
    background: rgba(59, 130, 246, 0.18);
    color: #fff;
}

/* SIDEBAR */
.sidebar {
    width: 250px;
    height: 100vh;
    background: rgba(16, 25, 53, 0.98);
    backdrop-filter: blur(15px);
    position: fixed;
    top: 0;
    left: 0;
    transform: translateX(-100%);
    padding-top: 20px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 2000;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: none;
    -ms-overflow-style: none;
    box-shadow: 10px 0 30px rgba(0, 0, 0, 0.5);
    border-right: 1px solid rgba(255, 255, 255, 0.05);
}
.sidebar::-webkit-scrollbar { display: none; }
.sidebar.open { transform: translateX(0); z-index: 2200; }
.sidebar.open ~ .sidebar-overlay { 
    display: block;
    opacity: 1;
}

.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 1999;
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}


.sidebar .logo {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 8px;
    padding: 12px 16px 4px;
    border-bottom: none !important;
    overflow: hidden;
}
.sidebar .logo img {
    max-height: 42px !important;
    max-width: 170px !important;
    width: auto !important;
    height: auto !important;
    object-fit: contain !important;
    filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.3));
    transition: all 0.3s ease;
}
.sidebar-logo-mark {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--accent-blue), var(--accent-cyan));
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 1.2rem;
    color: #fff;
    box-shadow: 0 4px 18px rgba(59, 130, 246, 0.45);
    margin-bottom: 10px;
}
.sidebar-logo-text strong {
    font-size: 1.05rem;
    font-weight: 700;
    color: #fff;
    display: block;
    text-align: center;
}

.menu-title {
    padding: 0.75rem 1rem 0.4rem;
    font-weight: 600;
    font-size: 11px;
    color: rgba(255, 255, 255, 0.4);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.menu-link {
    display: flex;
    align-items: center;
    padding: 0.75rem 1.25rem;
    color: var(--text-muted);
    text-decoration: none;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    border-left: 3px solid transparent;
    margin: 3px 10px;
    border-radius: 8px;
    font-size: 0.92rem;
    font-weight: 500;
}
.menu-link:hover,
.menu-link:focus {
    background-color: rgba(59, 130, 246, 0.1);
    color: #fff;
    padding-left: 1.5rem;
}
.menu-link.active {
    background: linear-gradient(90deg, rgba(59, 130, 246, 0.18) 0%, transparent 100%);
    color: #fff;
    font-weight: 600;
    border-left: 3px solid var(--accent-blue);
}
.menu-link i,
.menu-link .bi {
    margin-right: 11px;
    font-size: 1.05rem;
    width: 20px;
    text-align: center;
    opacity: 0.85;
}

/* MAIN CONTENT */
.main-content {
    margin-left: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    min-height: 100vh;
    padding-top: 65px;
    background: var(--bg-dark);
}

@media (min-width: 769px) {
    .sidebar { transform: translateX(0); }
    .sidebar-toggle { display: none; }
    .main-content { 
        margin-left: 250px; 
        padding: 95px 30px 40px; 
    }
    .mobile-topbar {
        padding-left: 270px;
    }
}

@media (max-width: 768px) {
    .main-content { padding: 95px 15px 30px; }
    .welcome-text { display: none; }
}

.stat-card__icon {
    width: 54px;
    height: 54px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-active);
    color: var(--accent-blue);
    font-size: 1.5rem;
}

.table-responsive {
    border-radius: var(--radius);
    overflow: hidden;
}

.table.table-dark {
    --bs-table-bg: transparent;
    border-color: var(--border);
}

.table-dark thead th {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 600;
    color: var(--text-muted);
}

.app-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    backdrop-filter: var(--glass);
}
.app-card__title { font-size: 1.1rem; font-weight: 700; color: #fff; margin-bottom: 1rem; }

.form-label { font-size: 0.85rem; font-weight: 600; color: rgba(255, 255, 255, 0.8); }
.form-control {
    background: rgba(8, 15, 37, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #fff;
}
.form-control:focus {
    background: rgba(16, 25, 53, 1);
    border-color: var(--accent-blue);
    color: #fff;
    box-shadow: none;
}

.btn-app-primary {
    background: linear-gradient(135deg, var(--accent-blue), var(--accent-cyan));
    border: none;
    color: #fff;
    font-weight: 700;
    padding: 0.6rem 1.5rem;
    border-radius: 10px;
}


/* ── Responsividade Mobile (Tabelas e Layout) ── */
@media (max-width: 768px) {
    .app-card {
        padding: 1rem;
        margin-bottom: 1rem;
    }

    /* Transformar tabela em Cards */
    .table-responsive {
        border: none;
    }
    
    .table-dark-custom,
    .table-dark,
    #appsTable,
    #devicesTable,
    #plansTable {
        display: block;
        width: 100% !important;
    }

    .table-dark-custom thead,
    .table-dark thead {
        display: none; /* Esconde o cabeçalho original */
    }

    .table-dark-custom tbody,
    .table-dark tbody,
    .table-dark-custom tr,
    .table-dark tr {
        display: block;
        width: 100%;
    }

    .table-dark-custom tr,
    .table-dark tr {
        margin-bottom: 1.5rem;
        background: rgba(255, 255, 255, 0.03) !important;
        border: 1px solid rgba(255, 255, 255, 0.08) !important;
        border-radius: 12px;
        padding: 10px;
        position: relative;
    }

    .table-dark-custom td,
    .table-dark td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        text-align: right;
        padding: 12px 10px !important;
        border-bottom: 1px solid rgba(255, 255, 255, 0.05) !important;
    }

    .table-dark-custom td:last-child,
    .table-dark td:last-child {
        border-bottom: none !important;
        justify-content: center;
        background: rgba(59, 130, 246, 0.05);
        border-radius: 0 0 10px 10px;
        margin-top: 5px;
    }

    /* Inserir rótulos usando data-label */
    .table-dark-custom td::before,
    .table-dark td::before {
        content: attr(data-label);
        float: left;
        font-weight: 600;
        text-transform: uppercase;
        font-size: 0.7rem;
        color: var(--text-muted);
        text-align: left;
    }

    /* Ajustes específicos para células com ícones ou botões */
    .table-dark td.text-end, 
    .table-dark-custom td.text-end {
        text-align: center !important;
    }

    /* KPI Cards no Mobile */
    .content-kpi-card .card-text {
        font-size: 1.5rem;
    }
    
    /* Topbar adjustments */
    .mobile-topbar {
        padding: 0 15px;
    }
}

/* Modals should be above topbar and sidebar */
.modal-backdrop { z-index: 3000 !important; }
.modal { z-index: 3050 !important; }
