/* === Tema Base Moderno === */
:root {
    --bg-body: #F3F4F6; /* Cinza Claro Fundo */
    --bg-sidebar: #111827; /* Azul/Preto Profundo */
    --text-sidebar: #9CA3AF; /* Cinza Claro Texto */
    --text-main: #1F2937; /* Cinza Escuro Texto */
    --primary-color: #0D6EFD; /* Azul Bootstrap Vibrante */
    --card-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

body {
    background-color: var(--bg-body) !important;
    color: var(--text-main) !important;
    font-family: "Inter", "Segoe UI", Helvetica, Arial, sans-serif;
    margin: 0;
    padding: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

main {
    height: 100vh;
    overflow-y: auto;
    background-color: var(--bg-body);
}

/* === Navbar e Header (Agora Brancos e Limpos) === */
.navbar, header {
    background-color: #FFFFFF;
    color: var(--text-main);
    padding: 12px 24px;
    border-bottom: 1px solid #E5E7EB;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}

    .navbar a, header a {
        color: var(--text-main);
        text-decoration: none;
        font-weight: 600;
    }

        .navbar a:hover, header a:hover {
            color: var(--primary-color);
        }

/* === Sidebar Moderna (Escura) === */
.sidebar-container {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    width: 260px;
    background-color: var(--bg-sidebar);
    color: #FFFFFF;
    display: flex;
    flex-direction: column;
    transition: width 0.3s ease;
    z-index: 1000;
    overflow-x: hidden;
}

    .sidebar-container.collapsed {
        width: 80px;
    }

/* Cabeçalho da Sidebar */
.sidebar-header {
    background-color: #1F2937; /* Levemente mais claro que o fundo */
    color: white;
    padding: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid #374151;
}

    .sidebar-header .logo-text {
        font-weight: 700;
        font-size: 1.2rem;
        letter-spacing: 0.5px;
    }

/* Lista de Navegação */
.sidebar-nav {
    display: flex;
    flex-direction: column;
    padding: 16px 12px;
    gap: 4px;
}

    .sidebar-nav .nav-link {
        display: flex;
        align-items: center;
        gap: 12px;
        color: var(--text-sidebar);
        text-decoration: none;
        padding: 12px 16px;
        border-radius: 8px;
        font-weight: 500;
        transition: all 0.2s ease;
        white-space: nowrap;
    }

        .sidebar-nav .nav-link:hover {
            background-color: #374151;
            color: #FFFFFF;
        }

        .sidebar-nav .nav-link.active {
            background-color: var(--primary-color);
            color: #FFFFFF;
            box-shadow: 0 4px 6px rgba(13, 110, 253, 0.3);
        }

        .sidebar-nav .nav-link i {
            font-size: 1.2rem;
            min-width: 24px;
            text-align: center;
        }

/* Estado Recolhido */
.sidebar-container.collapsed .nav-link {
    justify-content: center;
    padding: 12px 0;
}

    .sidebar-container.collapsed .nav-link span.text {
        display: none;
    }

.sidebar-container.collapsed .logo-text {
    display: none;
}

/* Botão Logout */
.logout-section {
    margin-top: auto;
    padding: 16px;
    border-top: 1px solid #374151;
}

.btn-logout {
    background-color: transparent;
    color: #EF4444; /* Vermelho suave */
    border: 1px solid #EF4444;
    border-radius: 8px;
    padding: 10px;
    transition: all 0.2s ease;
    width: 100%;
    font-weight: 600;
}

    .btn-logout:hover {
        background-color: #EF4444;
        color: white;
    }

/* Botão Hambúrguer e Toggle */
.toggle-btn {
    background: none;
    border: none;
    color: var(--text-sidebar);
    cursor: pointer;
    font-size: 1.2rem;
    padding: 4px;
}

    .toggle-btn:hover {
        color: white;
    }

/* Ajuste de Conteúdo Principal */
.content-area {
    margin-left: 260px;
    transition: margin-left 0.3s ease;
    padding: 24px;
}

.sidebar-container.collapsed ~ .content-area {
    margin-left: 80px;
}

/* === Tabelas Modernas === */
.table {
    background-color: white;
    border-radius: 12px;
    overflow: hidden; /* Arredonda os cantos da tabela */
    border-collapse: separate;
    border-spacing: 0;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    border: 1px solid #E5E7EB;
}

    .table thead th {
        background-color: #F9FAFB; /* Cinza muito claro */
        color: #374151;
        font-weight: 600;
        text-transform: uppercase;
        font-size: 0.75rem;
        letter-spacing: 0.05em;
        border-bottom: 1px solid #E5E7EB;
        padding: 12px 16px;
    }

    .table tbody td {
        padding: 16px;
        border-bottom: 1px solid #F3F4F6;
        color: #4B5563;
        vertical-align: middle;
    }

    .table tbody tr:last-child td {
        border-bottom: none;
    }

/* === Cards e Containers === */
.card, .dashboard-container, .config-card, .devices-card {
    background-color: #FFFFFF;
    border: 1px solid #E5E7EB;
    border-radius: 12px;
    box-shadow: var(--card-shadow);
}

.card-header {
    background-color: white;
    border-bottom: 1px solid #F3F4F6;
    font-weight: 600;
}

/* === Dashboard Cards Específicos === */
.stat-card {
    background: white;
    border: 1px solid #E5E7EB;
    border-radius: 12px;
    padding: 24px;
    display: flex;
    align-items: center;
    transition: transform 0.2s, box-shadow 0.2s;
}

    .stat-card:hover {
        transform: translateY(-2px);
        box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
        border-color: var(--primary-color);
    }

    /* Ícones dos Cards */
    .stat-card .icon {
        font-size: 1.5rem;
        width: 48px;
        height: 48px;
        display: flex;
        align-items: center;
        justify-content: center;
        border-radius: 10px;
        margin-right: 16px;
        /* Fundo suave para ícones */
        background-color: #EFF6FF;
        color: var(--primary-color);
    }

    .stat-card .info strong {
        display: block;
        font-size: 1.5rem;
        color: #111827;
        line-height: 1;
        margin-bottom: 4px;
    }

    .stat-card .info div {
        color: #6B7280;
        font-size: 0.875rem;
        font-weight: 500;
    }

/* === Inputs e Formulários === */
input.form-control, select.form-select, textarea.form-control {
    border: 1px solid #D1D5DB;
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 0.95rem;
    box-shadow: none;
    transition: border-color 0.15s ease;
}

    input.form-control:focus, select.form-select:focus {
        border-color: var(--primary-color);
        box-shadow: 0 0 0 3px rgba(13, 110, 253, 0.15);
    }

/* === Botões === */
.btn-primary {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    font-weight: 500;
    padding: 8px 16px;
    border-radius: 8px;
}

    .btn-primary:hover {
        background-color: #0b5ed7;
    }

.btn-outline-secondary {
    border-color: #D1D5DB;
    color: #374151;
}

    .btn-outline-secondary:hover {
        background-color: #F3F4F6;
        color: #111827;
    }

/* === Mobile === */
@media (max-width: 768px) {
    .sidebar-container {
        transform: translateX(-100%);
        width: 260px;
    }

        .sidebar-container.mobile-open {
            transform: translateX(0);
        }

    .content-area {
        margin-left: 0 !important;
    }

    .toggle-btn.d-lg-none {
        color: #374151; /* Escuro no mobile header branco */
    }
}
