/* ============================================================
   BV TECH - assets/css/style.css
   Identidade visual: branco + roxo #521863 + azul #0076d6
   ============================================================ */

/* --- Reset & Base --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --roxo:          #521863;
    --roxo-dark:     #3d1049;
    --roxo-light:    #6b2280;
    --roxo-bg:       #f5eef8;
    --roxo-border:   #d9b3e8;
    --azul:          #0076d6;
    --azul-light:    #e8f3fc;
    --branco:        #ffffff;
    --cinza-50:      #f9f9f9;
    --cinza-100:     #f3f3f3;
    --cinza-200:     #e8e8e8;
    --cinza-300:     #d0d0d0;
    --cinza-500:     #8a8a8a;
    --cinza-700:     #4a4a4a;
    --cinza-900:     #1a1a1a;
    --verde:         #16a34a;
    --verde-bg:      #dcfce7;
    --amarelo:       #d97706;
    --amarelo-bg:    #fef3c7;
    --vermelho:      #dc2626;
    --vermelho-bg:   #fee2e2;

    --radius-sm:     4px;
    --radius:        8px;
    --radius-lg:     12px;
    --radius-xl:     16px;

    --shadow-sm:     0 1px 3px rgba(0,0,0,.08);
    --shadow:        0 2px 8px rgba(0,0,0,.10);
    --shadow-lg:     0 4px 20px rgba(0,0,0,.12);

    --sidebar-w:     256px;
    --header-h:      64px;
    --font:          'Inter', system-ui, -apple-system, sans-serif;
}

html { font-size: 15px; -webkit-font-smoothing: antialiased; }
body {
    font-family: var(--font);
    background: var(--cinza-100);
    color: var(--cinza-900);
    line-height: 1.6;
    min-height: 100vh;
}

a { color: var(--roxo); text-decoration: none; }
a:hover { color: var(--roxo-light); }
img { max-width: 100%; }

/* --- Layout Principal --- */
.layout {
    display: flex;
    min-height: 100vh;
}

/* --- Sidebar --- */
.sidebar {
    width: var(--sidebar-w);
    background: var(--roxo);
    color: var(--branco);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 100;
    overflow-y: auto;
}

.sidebar-logo {
    padding: 24px 20px 20px;
    border-bottom: 1px solid rgba(255,255,255,.15);
}

.sidebar-logo .app-name {
    font-size: 18px;
    font-weight: 700;
    letter-spacing: -.3px;
    color: var(--branco);
}

.sidebar-logo .app-sub {
    font-size: 11px;
    color: rgba(255,255,255,.6);
    margin-top: 2px;
    font-weight: 400;
}

.sidebar-nav {
    padding: 12px 0;
    flex: 1;
}

.nav-section-label {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: rgba(255,255,255,.45);
    padding: 14px 20px 4px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 20px;
    font-size: 13.5px;
    color: rgba(255,255,255,.82);
    transition: background .15s, color .15s;
    border-radius: 0;
    cursor: pointer;
}

.nav-item:hover {
    background: rgba(255,255,255,.1);
    color: var(--branco);
}

.nav-item.active {
    background: rgba(255,255,255,.18);
    color: var(--branco);
    font-weight: 500;
}

.nav-item .nav-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    opacity: .85;
}

.nav-item.active .nav-icon { opacity: 1; }

.sidebar-user {
    padding: 16px 20px;
    border-top: 1px solid rgba(255,255,255,.15);
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: rgba(255,255,255,.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 600;
    color: var(--branco);
    flex-shrink: 0;
}

.user-info .user-name { font-size: 13px; font-weight: 500; color: var(--branco); }
.user-info .user-role { font-size: 11px; color: rgba(255,255,255,.55); }

.btn-logout {
    margin-left: auto;
    background: none;
    border: none;
    cursor: pointer;
    color: rgba(255,255,255,.55);
    padding: 4px;
    border-radius: 4px;
    transition: color .15s;
}
.btn-logout:hover { color: var(--branco); }

/* --- Main Content --- */
.main {
    margin-left: var(--sidebar-w);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* --- Topbar --- */
.topbar {
    height: var(--header-h);
    background: var(--branco);
    border-bottom: 1px solid var(--cinza-200);
    display: flex;
    align-items: center;
    padding: 0 28px;
    gap: 16px;
    position: sticky;
    top: 0;
    z-index: 50;
}

.topbar-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--cinza-900);
    flex: 1;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* --- Page Body --- */
.page-body {
    padding: 28px;
    flex: 1;
}

/* --- Cards --- */
.card {
    background: var(--branco);
    border-radius: var(--radius-lg);
    border: 1px solid var(--cinza-200);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.card-header {
    padding: 18px 22px;
    border-bottom: 1px solid var(--cinza-200);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.card-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--cinza-900);
}

.card-body {
    padding: 22px;
}

/* --- Stats Cards --- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--branco);
    border-radius: var(--radius-lg);
    border: 1px solid var(--cinza-200);
    padding: 20px 22px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.stat-card.accent-roxo { border-left: 4px solid var(--roxo); }
.stat-card.accent-azul  { border-left: 4px solid var(--azul); }
.stat-card.accent-verde { border-left: 4px solid var(--verde); }
.stat-card.accent-amarelo { border-left: 4px solid var(--amarelo); }

.stat-label { font-size: 12px; color: var(--cinza-500); font-weight: 500; }
.stat-value { font-size: 28px; font-weight: 700; color: var(--cinza-900); line-height: 1; }
.stat-sub   { font-size: 12px; color: var(--cinza-500); }

/* --- Botões --- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: var(--radius);
    font-size: 13.5px;
    font-weight: 500;
    cursor: pointer;
    transition: all .15s;
    border: 1px solid transparent;
    white-space: nowrap;
    text-decoration: none;
}

.btn-primary {
    background: var(--roxo);
    color: var(--branco);
    border-color: var(--roxo);
}
.btn-primary:hover {
    background: var(--roxo-dark);
    border-color: var(--roxo-dark);
    color: var(--branco);
}

.btn-secondary {
    background: var(--branco);
    color: var(--cinza-700);
    border-color: var(--cinza-300);
}
.btn-secondary:hover { background: var(--cinza-50); }

.btn-azul {
    background: var(--azul);
    color: var(--branco);
    border-color: var(--azul);
}
.btn-azul:hover { background: #005fa8; color: var(--branco); }

.btn-danger {
    background: var(--vermelho);
    color: var(--branco);
    border-color: var(--vermelho);
}
.btn-danger:hover { background: #b91c1c; color: var(--branco); }

.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-lg { padding: 11px 22px; font-size: 15px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* --- Badges --- */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
}
.badge-roxo    { background: var(--roxo-bg);     color: var(--roxo); }
.badge-azul    { background: var(--azul-light);  color: var(--azul); }
.badge-verde   { background: var(--verde-bg);    color: var(--verde); }
.badge-amarelo { background: var(--amarelo-bg);  color: var(--amarelo); }
.badge-vermelho{ background: var(--vermelho-bg); color: var(--vermelho); }
.badge-cinza   { background: var(--cinza-200);   color: var(--cinza-700); }

/* --- Tabelas --- */
.table-wrap { overflow-x: auto; }

table.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13.5px;
}

.data-table th {
    text-align: left;
    padding: 10px 14px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--cinza-500);
    border-bottom: 1px solid var(--cinza-200);
    background: var(--cinza-50);
    white-space: nowrap;
}

.data-table td {
    padding: 13px 14px;
    border-bottom: 1px solid var(--cinza-100);
    vertical-align: middle;
    color: var(--cinza-700);
}

.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: var(--cinza-50); }

/* --- Formulários --- */
.form-group { margin-bottom: 18px; }

.form-label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--cinza-700);
    margin-bottom: 6px;
}

.form-label.required::after {
    content: ' *';
    color: var(--vermelho);
}

.form-control {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid var(--cinza-300);
    border-radius: var(--radius);
    font-size: 14px;
    font-family: var(--font);
    color: var(--cinza-900);
    background: var(--branco);
    transition: border-color .15s, box-shadow .15s;
    appearance: none;
}

.form-control:focus {
    outline: none;
    border-color: var(--roxo);
    box-shadow: 0 0 0 3px rgba(82,24,99,.12);
}

.form-control::placeholder { color: var(--cinza-500); }
.form-control:disabled { background: var(--cinza-100); color: var(--cinza-500); cursor: not-allowed; }

select.form-control { cursor: pointer; }
textarea.form-control { resize: vertical; min-height: 90px; }

.form-error { font-size: 12px; color: var(--vermelho); margin-top: 4px; }
.form-hint  { font-size: 12px; color: var(--cinza-500); margin-top: 4px; }

.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }

/* --- Alerts / Flash --- */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius);
    font-size: 13.5px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 16px;
}
.alert-success { background: var(--verde-bg); color: #15803d; border: 1px solid #bbf7d0; }
.alert-danger   { background: var(--vermelho-bg); color: #991b1b; border: 1px solid #fecaca; }
.alert-warning  { background: var(--amarelo-bg); color: #92400e; border: 1px solid #fde68a; }
.alert-info     { background: var(--azul-light); color: #1d4ed8; border: 1px solid #bfdbfe; }

/* --- Progresso --- */
.progress {
    height: 8px;
    background: var(--cinza-200);
    border-radius: 99px;
    overflow: hidden;
}
.progress-bar {
    height: 100%;
    background: var(--roxo);
    border-radius: 99px;
    transition: width .4s ease;
}
.progress-bar.bg-verde   { background: var(--verde); }
.progress-bar.bg-amarelo { background: var(--amarelo); }
.progress-bar.bg-vermelho{ background: var(--vermelho); }

/* --- Checklist Items --- */
.checklist-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--cinza-100);
}
.checklist-item:last-child { border-bottom: none; }
.checklist-item input[type="checkbox"] {
    width: 18px; height: 18px;
    accent-color: var(--roxo);
    cursor: pointer;
    flex-shrink: 0;
    margin-top: 2px;
}
.checklist-item.done .item-desc { text-decoration: line-through; color: var(--cinza-500); }
.item-desc { font-size: 14px; flex: 1; }
.item-meta { font-size: 11px; color: var(--cinza-500); margin-top: 2px; }

/* --- Modal --- */
.modal-backdrop {
    position: fixed; inset: 0;
    background: rgba(0,0,0,.45);
    z-index: 900;
    display: flex; align-items: center; justify-content: center;
    padding: 20px;
}
.modal {
    background: var(--branco);
    border-radius: var(--radius-xl);
    width: 100%; max-width: 540px;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}
.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--cinza-200);
    display: flex; align-items: center; justify-content: space-between;
}
.modal-title { font-size: 16px; font-weight: 600; }
.modal-body  { padding: 22px 24px; }
.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--cinza-200);
    display: flex; justify-content: flex-end; gap: 8px;
}
.modal-close {
    background: none; border: none; cursor: pointer;
    color: var(--cinza-500); font-size: 20px; line-height: 1;
    padding: 2px 6px; border-radius: 4px;
}
.modal-close:hover { background: var(--cinza-100); color: var(--cinza-900); }

/* --- Linha do Tempo (histórico proprietários) --- */
.timeline { padding: 4px 0; }
.timeline-item {
    display: flex; gap: 14px; padding-bottom: 20px;
    position: relative;
}
.timeline-item:not(:last-child)::before {
    content: '';
    position: absolute; left: 11px; top: 28px; bottom: 0;
    width: 2px; background: var(--cinza-200);
}
.timeline-dot {
    width: 24px; height: 24px; border-radius: 50%;
    background: var(--roxo-bg); border: 2px solid var(--roxo);
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0; margin-top: 2px;
}
.timeline-dot.inactive { background: var(--cinza-100); border-color: var(--cinza-300); }
.timeline-content { flex: 1; }
.timeline-title { font-size: 14px; font-weight: 500; }
.timeline-date  { font-size: 12px; color: var(--cinza-500); margin-top: 2px; }

/* --- Status Hardware / Usuário --- */
.status-disponivel { color: var(--verde); }
.status-alocado    { color: var(--azul); }
.status-manutencao { color: var(--amarelo); }
.status-descartado { color: var(--cinza-500); }
.status-ativo      { color: var(--verde); }
.status-inativo    { color: var(--cinza-500); }
.status-desligado  { color: var(--vermelho); }

/* --- Paginação --- */
.pagination {
    display: flex; align-items: center; gap: 4px;
    justify-content: flex-end;
    padding: 16px 0 0;
}
.page-btn {
    min-width: 34px; height: 34px;
    display: flex; align-items: center; justify-content: center;
    border-radius: var(--radius);
    font-size: 13px; font-weight: 500;
    border: 1px solid var(--cinza-200);
    background: var(--branco); color: var(--cinza-700);
    cursor: pointer; transition: all .15s;
    text-decoration: none;
}
.page-btn:hover { border-color: var(--roxo); color: var(--roxo); }
.page-btn.active { background: var(--roxo); border-color: var(--roxo); color: var(--branco); }
.page-btn:disabled { opacity: .4; cursor: not-allowed; }

/* --- Login Page --- */
.login-page {
    min-height: 100vh;
    display: flex;
    background: var(--branco);
}
.login-left {
    width: 480px;
    flex-shrink: 0;
    background: var(--roxo);
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 60px;
    color: var(--branco);
}
.login-right {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
}
.login-box { width: 100%; max-width: 400px; }
.login-logo-text { font-size: 32px; font-weight: 800; letter-spacing: -1px; }
.login-logo-sub  { font-size: 14px; color: rgba(255,255,255,.65); margin-top: 6px; }
.login-quote {
    margin-top: 48px;
    font-size: 18px;
    line-height: 1.6;
    color: rgba(255,255,255,.85);
    font-style: italic;
}
.login-quote-author { font-size: 13px; color: rgba(255,255,255,.55); margin-top: 12px; font-style: normal; }

.login-title { font-size: 24px; font-weight: 700; color: var(--cinza-900); margin-bottom: 6px; }
.login-sub   { font-size: 14px; color: var(--cinza-500); margin-bottom: 36px; }

.btn-ms {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    width: 100%;
    padding: 13px 20px;
    background: var(--branco);
    border: 1.5px solid var(--cinza-300);
    border-radius: var(--radius-lg);
    font-size: 15px;
    font-weight: 500;
    color: var(--cinza-900);
    cursor: pointer;
    transition: all .2s;
    text-decoration: none;
}
.btn-ms:hover {
    border-color: var(--roxo);
    box-shadow: 0 0 0 3px rgba(82,24,99,.1);
    color: var(--cinza-900);
}
.btn-ms svg { flex-shrink: 0; }

.login-divider {
    display: flex; align-items: center; gap: 12px;
    margin: 24px 0;
    font-size: 12px; color: var(--cinza-500);
}
.login-divider::before,
.login-divider::after {
    content: ''; flex: 1; height: 1px; background: var(--cinza-200);
}

.login-note { font-size: 12px; color: var(--cinza-500); text-align: center; margin-top: 24px; line-height: 1.6; }

/* --- Utilities --- */
.d-flex   { display: flex; }
.gap-8    { gap: 8px; }
.gap-12   { gap: 12px; }
.gap-16   { gap: 16px; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.flex-1   { flex: 1; }
.text-center { text-align: center; }
.text-right  { text-align: right; }
.text-muted  { color: var(--cinza-500); }
.text-small  { font-size: 12px; }
.text-roxo   { color: var(--roxo); }
.text-azul   { color: var(--azul); }
.fw-600   { font-weight: 600; }
.fw-700   { font-weight: 700; }
.mt-4  { margin-top: 4px; }
.mt-8  { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.w-100 { width: 100%; }

/* --- Responsive --- */
@media (max-width: 900px) {
    .sidebar { transform: translateX(-100%); transition: transform .25s; }
    .sidebar.open { transform: translateX(0); }
    .main { margin-left: 0; }
    .login-left { display: none; }
    .form-grid-2, .form-grid-3 { grid-template-columns: 1fr; }
}