/* =========================
   RESET MODERNO
========================= */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
}

body {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
    background-color: #f6f7fb;
    color: #1f2933;
    line-height: 1.6;
}

/* =========================
   VARIÁVEIS (IDENTIDADE VISUAL)
========================= */
:root {
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --secondary: #64748b;
    --success: #16a34a;
    --danger: #dc2626;
    --warning: #f59e0b;
    --border: #e5e7eb;
    --bg-card: #ffffff;
    --radius: 8px;
    --shadow: 0 2px 10px rgba(0,0,0,0.05);
}

/* =========================
   TIPOGRAFIA
========================= */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    color: #0f172a;
    margin-bottom: 0.5rem;
}

h1 { font-size: 2rem; }
h2 { font-size: 1.6rem; }
h3 { font-size: 1.3rem; }

p {
    margin-bottom: 1rem;
    color: #334155;
}

small {
    color: #64748b;
}

/* =========================
   CONTAINERS
========================= */
.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 1.5rem;
}

.card {
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

/* =========================
   BOTÕES
========================= */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.6rem 1.2rem;
    border-radius: var(--radius);
    border: none;
    cursor: pointer;
    font-weight: 500;
    transition: 0.2s ease;
    text-decoration: none;
    font-size: 0.95rem;
}

.btn-primary {
    background: var(--primary);
    color: #fff;
}

.btn-primary:hover {
    background: var(--primary-hover);
}

.btn-secondary {
    background: var(--secondary);
    color: #fff;
}

.btn-danger {
    background: var(--danger);
    color: #fff;
}

.btn-success {
    background: var(--success);
    color: #fff;
}

/* =========================
   FORMULÁRIOS
========================= */
.form-group {
    margin-bottom: 1rem;
}

label {
    display: block;
    margin-bottom: 0.4rem;
    font-weight: 500;
    color: #334155;
}

input,
select,
textarea {
    width: 100%;
    padding: 0.6rem 0.7rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.95rem;
    background: #fff;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.15);
}

textarea {
    resize: vertical;
    min-height: 100px;
}

/* =========================
   TABELAS (CRUD)
========================= */
.table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}

.table th,
.table td {
    padding: 0.75rem;
    border-bottom: 1px solid var(--border);
    text-align: left;
}

.table th {
    background: #f1f5f9;
    font-weight: 600;
    color: #0f172a;
}

.table tr:hover {
    background: #f8fafc;
}

/* =========================
   ALERTAS
========================= */
.alert {
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.alert-success {
    background: #dcfce7;
    color: #166534;
}

.alert-danger {
    background: #fee2e2;
    color: #991b1b;
}

.alert-warning {
    background: #fef3c7;
    color: #92400e;
}

/* =========================
   UTILITÁRIOS
========================= */
.mt-1 { margin-top: .5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }

.mb-1 { margin-bottom: .5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }

.text-center { text-align: center; }
.text-right { text-align: right; }

/* =========================
   LINKS
========================= */
a {
    color: var(--primary);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* =========================
   BOTÕES – PADRÃO COMPLETO
========================= */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.6rem 1.2rem;
    border-radius: var(--radius);
    border: none;
    cursor: pointer;
    font-weight: 500;
    font-size: 0.95rem;
    transition: all 0.2s ease;
    text-decoration: none;
    user-select: none;
    line-height: 1;
}

/* Cores principais */
.btn-primary {
    background: var(--primary);
    color: #fff;
}

.btn-primary:hover {
    background: var(--primary-hover);
}

.btn-secondary {
    background: var(--secondary);
    color: #fff;
}

.btn-success {
    background: var(--success);
    color: #fff;
}

.btn-danger {
    background: var(--danger);
    color: #fff;
}

.btn-warning {
    background: var(--warning);
    color: #111827;
}

/* Outline */
.btn-outline {
    background: transparent;
    border: 1px solid var(--border);
    color: #0f172a;
}

.btn-outline-primary {
    border: 1px solid var(--primary);
    color: var(--primary);
    background: transparent;
}

.btn-outline-primary:hover {
    background: var(--primary);
    color: #fff;
}

/* Tamanhos */
.btn-sm {
    padding: 0.4rem 0.8rem;
    font-size: 0.8rem;
}

.btn-lg {
    padding: 0.8rem 1.6rem;
    font-size: 1.05rem;
}

/* Estados */
.btn:disabled,
.btn.disabled {
    opacity: 0.6;
    cursor: not-allowed;
    pointer-events: none;
}

/* Botão com ícone */
.btn-icon {
    padding: 0.5rem;
    width: 36px;
    height: 36px;
    justify-content: center;
}

/* Grupo de botões */
.btn-group {
    display: inline-flex;
}

.btn-group .btn {
    border-radius: 0;
}

.btn-group .btn:first-child {
    border-top-left-radius: var(--radius);
    border-bottom-left-radius: var(--radius);
}

.btn-group .btn:last-child {
    border-top-right-radius: var(--radius);
    border-bottom-right-radius: var(--radius);
}

/* Botão de link (parece link) */
.btn-link {
    background: none;
    border: none;
    color: var(--primary);
    padding: 0;
}

.btn-link:hover {
    text-decoration: underline;
}

/* Loading (pra AJAX no CRUD) */
.btn-loading {
    position: relative;
    pointer-events: none;
    opacity: 0.7;
}

.btn-loading::after {
    content: "";
    width: 16px;
    height: 16px;
    border: 2px solid #fff;
    border-top-color: transparent;
    border-radius: 50%;
    position: absolute;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}


/* =========================
   SIDEBAR – PADRÃO COMPLETO
========================= */
/* Sidebar base */
.sidebar {
    width: 280px;
    height: 100vh;
    background: linear-gradient(180deg, #212529, #1c1f23);
    box-shadow: 2px 0 10px rgba(0,0,0,.4);
}

/* Links */
.sidebar .nav-link {
    color: #ced4da;
    border-radius: 0.5rem;
    padding: 0.6rem 0.75rem;
    transition: all .2s ease;
    display: flex;
    align-items: center;
    gap: .5rem;
}

/* Hover */
.sidebar .nav-link:hover {
    background-color: #343a40;
    color: #fff;
}

/* Item ativo */
.sidebar .nav-link.active {
    background-color: #0d6efd;
    color: #fff;
    box-shadow: inset 3px 0 0 #fff;
}

/* Ícones */
.sidebar .nav-link i {
    font-size: 1.1rem;
    opacity: .9;
}

/* Submenu */
.sidebar .collapse .nav-link {
    font-size: .9rem;
    padding-left: 2.2rem;
    color: #adb5bd;
}

/* Seta animada */
.sidebar .toggle-icon {
    transition: transform .2s ease;
}

.sidebar [aria-expanded="true"] .toggle-icon {
    transform: rotate(180deg);
}
/* END SIDE BAR */