/* =========================================================
   Estoque de Urnas Cinerárias — estilo visual compartilhado
   AJR Soluções Digitais
   ========================================================= */

@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@500;600;700&family=Inter:wght@400;500;600&display=swap');

:root {
    --gold: #db7720;
    --gold-light: #f0993f;
    --gold-dark: #b8611a;
    --dark: #1f2937;
    --dark-2: #111827;
    --bg: #f3f4f6;
    --card-bg: #ffffff;
    --border: #e5e7eb;
    --text: #1f2937;
    --text-muted: #6b7280;
    --success: #15803d;
    --success-bg: #dcfce7;
    --danger: #b91c1c;
    --danger-bg: #fee2e2;
    --radius: 14px;
    --shadow: 0 1px 3px rgba(17, 24, 39, 0.06), 0 6px 20px rgba(17, 24, 39, 0.06);
}

* { box-sizing: border-box; }

body {
    background: var(--bg);
    color: var(--text);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 0.95rem;
}

h1, h2, h3, h4, .navbar-brand, .page-title {
    font-family: 'Poppins', sans-serif;
    font-weight: 600;
    color: var(--dark-2);
}

/* ---------- Navbar ---------- */
.navbar {
    background: var(--dark-2) !important;
    box-shadow: 0 2px 10px rgba(0,0,0,0.15);
    padding: 0.4rem 1rem;
}
.navbar-brand img.navbar-logo { max-height: 34px; width: auto; margin-right: 8px; }
.navbar-nav .nav-link {
    color: rgba(255,255,255,0.75) !important;
    font-size: 0.8rem;
    font-weight: 500;
    padding: 0.45rem 0.6rem !important;
    border-radius: 8px;
    white-space: nowrap;
    transition: all 0.15s ease;
}
.navbar-nav .nav-link:hover { color: #fff !important; background: rgba(255,255,255,0.06); }
.navbar-nav .nav-link.active {
    color: #fff !important;
    background: linear-gradient(90deg, var(--gold), var(--gold-dark));
}
.navbar-toggler { border: none; padding: 0.3rem 0.5rem; }
.navbar-toggler:focus { box-shadow: none; }

/* Menu mais compacto em telas médias, evita corte antes do colapso mobile */
@media (max-width: 1200px) {
    .navbar-nav .nav-link {
        font-size: 0.74rem;
        padding: 0.4rem 0.45rem !important;
    }
    .navbar-nav .nav-link i { margin-right: 3px !important; }
}

/* ---------- Layout / page header ---------- */
.page-wrap { max-width: 100%; margin: 0 auto; padding: 1.5rem 0.75rem 2.5rem; }
.page-title {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-size: 1.35rem;
    margin-bottom: 1rem;
}
.page-title i { color: var(--gold); }

/* ---------- Cards ---------- */
.card-panel {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.25rem 0.5rem;
    margin-bottom: 1.25rem;
}

/* ---------- Stat cards (dashboard) ---------- */
.stat-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 0.9rem 1.1rem;
    display: flex;
    align-items: center;
    gap: 0.8rem;
    height: 100%;
}
.stat-card .stat-icon {
    width: 40px; height: 40px;
    border-radius: 11px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.05rem;
    color: #fff;
    background: linear-gradient(135deg, var(--gold), var(--gold-dark));
    flex-shrink: 0;
}
.stat-card .stat-icon.alt { background: linear-gradient(135deg, #4b5563, var(--dark-2)); }
.stat-card .stat-icon.warn { background: linear-gradient(135deg, #ef4444, #b91c1c); }
.stat-card .stat-value { font-family: 'Poppins', sans-serif; font-weight: 700; font-size: 1.2rem; line-height: 1.1; color: var(--dark-2); }
.stat-card .stat-label { font-size: 0.72rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.03em; }

/* ---------- Tables ---------- */
/* Compactada para caber sem barra de rolagem horizontal em telas de notebook/desktop comuns */
.table-modern {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.72rem;
    table-layout: auto;
}
.table-modern thead th {
    background: var(--dark-2);
    color: #fff;
    font-weight: 500;
    font-size: 0.62rem;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    padding: 0.45rem 0.35rem;
    border: none;
    white-space: nowrap;
}
.table-modern thead th:first-child { border-top-left-radius: 10px; }
.table-modern thead th:last-child { border-top-right-radius: 10px; }
.table-modern tbody td {
    padding: 0.32rem 0.35rem;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
    white-space: nowrap;
}
.table-modern tbody tr:hover { background: #fff7ed; }
.table-modern tbody tr:last-child td { border-bottom: none; }
.table-modern tbody tr.total-row td {
    font-weight: 700;
    background: #f9fafb;
    border-top: 2px solid var(--dark-2);
}

/* Colunas de menor prioridade quebram texto em vez de empurrar a tabela pra fora */
.table-modern td:nth-child(3),
.table-modern td:nth-child(4),
.table-modern td:nth-child(5) {
    white-space: normal;
    word-break: break-word;
    max-width: 140px;
}

/* Em telas menores reduz ainda mais antes de precisar rolar */
@media (max-width: 1400px) {
    .table-modern { font-size: 0.66rem; }
    .table-modern thead th { padding: 0.4rem 0.3rem; font-size: 0.58rem; }
    .table-modern tbody td { padding: 0.28rem 0.3rem; }
}

.table-modern td[title] {
    cursor: help;
    text-decoration: underline dotted var(--text-muted);
    text-underline-offset: 3px;
}

/* Badges */
.badge-tipo { padding: 0.28em 0.6em; border-radius: 999px; font-size: 0.66rem; font-weight: 600; letter-spacing: 0.02em; }
.badge-reposicao { background: #e0e7ff; color: #3730a3; }
.badge-consignada { background: #fef3c7; color: #92400e; }
.badge-low-stock { background: var(--danger-bg); color: var(--danger); padding: 0.24em 0.5em; border-radius: 999px; font-size: 0.62rem; font-weight: 600; display: inline-flex; align-items: center; gap: 0.25em; margin-left: 0.35em; }
.badge-low-stock i { font-size: 0.6rem; }

/* Action icons */
.action-icon { display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px; border-radius: 7px; transition: background 0.15s ease; }
.action-icon.edit { color: var(--gold-dark); }
.action-icon.edit:hover { background: #fff1e0; }
.action-icon.del { color: var(--danger); }
.action-icon.del:hover { background: var(--danger-bg); }

/* ---------- Busca de urnas (dashboard) ---------- */
.search-box {
    position: relative;
    display: flex;
    align-items: center;
}
.search-box i.bi-search {
    position: absolute;
    left: 0.85rem;
    color: var(--text-muted);
    font-size: 0.95rem;
    pointer-events: none;
}
.search-box .form-control {
    padding-left: 2.4rem;
    padding-right: 2.4rem;
}
.search-box .search-clear {
    position: absolute;
    right: 0.85rem;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1rem;
}
.search-box .search-clear:hover { color: var(--danger); }

/* ---------- Forms ---------- */
.form-label { font-weight: 500; font-size: 0.85rem; color: var(--dark); }
.form-control, .form-select {
    border-radius: 9px;
    border: 1px solid var(--border);
    padding: 0.55rem 0.8rem;
}
.form-control:focus, .form-select:focus {
    border-color: var(--gold);
    box-shadow: 0 0 0 3px rgba(219, 119, 32, 0.15);
}

/* ---------- Buttons ---------- */
.btn-primary {
    background: linear-gradient(90deg, var(--gold-light), var(--gold-dark));
    border: none;
    font-weight: 500;
    border-radius: 9px;
    padding: 0.6rem 1.3rem;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 6px 16px rgba(219,119,32,0.35); }
.btn-secondary { border-radius: 9px; font-weight: 500; padding: 0.6rem 1.3rem; }
.btn-outline-primary { border-radius: 9px; font-weight: 500; color: var(--gold-dark); border-color: var(--gold); }
.btn-outline-primary:hover { background: var(--gold); border-color: var(--gold); }

/* ---------- Alerts ---------- */
.alert { border-radius: 10px; border: none; font-size: 0.88rem; }
.alert-success { background: var(--success-bg); color: var(--success); }
.alert-danger { background: var(--danger-bg); color: var(--danger); }

/* ---------- Login page ---------- */
.login-body {
    min-height: 100vh; display: flex; flex-direction: column;
    justify-content: center; align-items: center;
    background: radial-gradient(circle at top left, #2b3648, var(--dark-2) 65%);
    margin: 0;
}
.login-container {
    max-width: 400px; width: 90%; padding: 2.25rem;
    background: var(--card-bg); border-radius: 18px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.35);
    animation: fadeIn 0.5s ease-in-out;
}
.login-logo { max-width: 130px; height: auto; display: block; margin: 0 auto 1.1rem; }
.welcome-text { font-family: 'Poppins', sans-serif; font-size: 1.3rem; font-weight: 600; color: var(--dark-2); text-align: center; margin-bottom: 1.5rem; }
.login-footer { margin-top: 1.25rem; font-size: 0.82rem; color: rgba(255,255,255,0.55); text-align: center; }
.login-footer a { color: var(--gold-light); text-decoration: none; font-weight: 600; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }

@media (max-width: 576px) {
    .navbar-logo { max-height: 30px; }
    .page-wrap { padding: 1.25rem 0.75rem 2rem; }
}
