/* =========================================================================
   OFICINA SYSTEM - DESIGN SYSTEM UNIFICADO
   Fonte unica, cores unicas, componentes padronizados.
========================================================================= */

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

:root {
    --bg-body: #F8F9FB;
    --surface: #FFFFFF;
    --surface-hover: #F1F5F9;

    --border: #E2E8F0;
    --border-hover: #CBD5E1;

    --text-900: #0F172A;
    --text-800: #1E293B;
    --text-600: #475569;
    --text-500: #64748B;
    --text-400: #94A3B8;

    --primary: #1E293B;
    --primary-hover: #334155;
    --accent: #2563EB;
    --accent-hover: #1D4ED8;

    --success: #16A34A;
    --success-bg: #DCFCE7;
    --success-text: #166534;

    --warning: #EAB308;
    --warning-bg: #FEF9C3;
    --warning-text: #854D0E;

    --danger: #DC2626;
    --danger-bg: #FEE2E2;
    --danger-text: #991B1B;

    --info: #0EA5E9;
    --info-bg: #E0F2FE;
    --info-text: #0C4A6E;

    --shadow-sm: 0 1px 2px rgba(0,0,0,.05);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,.07), 0 2px 4px -2px rgba(0,0,0,.05);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,.08), 0 4px 6px -4px rgba(0,0,0,.04);

    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-xl: 20px;

    --transition: .2s ease;
}

/* =====================================
   RESET
===================================== */
*, *::before, *::after {
    margin: 0; padding: 0; box-sizing: border-box;
}

body {
    background: var(--bg-body);
    color: var(--text-800);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6 {
    color: var(--text-900);
    font-weight: 700;
    letter-spacing: -0.025em;
    line-height: 1.3;
}

a { color: var(--accent); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--accent-hover); }

/* =====================================
   NAVBAR (PAINEL)
===================================== */
nav {
    display: flex;
    align-items: center;
    padding: 0 32px;
    height: 60px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
    gap: 4px;
    overflow-x: auto;
}

nav a {
    color: var(--text-600);
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    transition: all var(--transition);
}

nav a:hover, nav a.active {
    background: var(--surface-hover);
    color: var(--text-900);
}

/* =====================================
   LAYOUT
===================================== */
.container {
    padding: 32px 40px 80px;
    max-width: 1400px;
    margin: 0 auto;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border);
}

.page-header h1 { font-size: 26px; }

.page-title {
    font-size: 26px;
    margin-bottom: 28px;
    font-weight: 700;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* =====================================
   BOTOES
===================================== */
button { border: none; outline: none; font-family: inherit; }

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    letter-spacing: 0.01em;
}

.btn:active { transform: scale(.97); }

.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }

.btn-action { background: var(--accent); color: #fff; }
.btn-action:hover { background: var(--accent-hover); }

.btn-secondary { background: var(--surface); color: var(--text-800); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--surface-hover); border-color: var(--border-hover); }

.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #B91C1C; }

.btn-success { background: var(--success); color: #fff; border: none; }
.btn-success:hover { background: #15803D; }

.btn-warning { background: var(--warning); color: var(--text-900); border: none; }
.btn-warning:hover { background: #CA8A04; }

.btn-info { background: var(--info); color: #fff; border: none; }
.btn-info:hover { background: #0284C7; }

.btn-voltar {
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text-600);
    padding: 8px 18px;
    border-radius: var(--radius-sm);
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
    transition: all var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.btn-voltar:hover { background: var(--surface-hover); color: var(--text-900); border-color: var(--border-hover); }

.btn-info-icon {
    display: inline-flex; align-items: center; justify-content: center;
    width: 30px; height: 30px; border-radius: var(--radius-sm);
    background: var(--surface-hover); border: 1px solid var(--border);
    color: var(--text-500); cursor: pointer; transition: all var(--transition);
}
.btn-info-icon:hover { color: var(--text-900); background: var(--border); }

/* =====================================
   FORMS
===================================== */
.form-group { margin-bottom: 20px; display: flex; flex-direction: column; }
.form-group label {
    font-size: 12px; color: var(--text-600); margin-bottom: 6px;
    font-weight: 600; text-transform: uppercase; letter-spacing: .06em;
}

.form-control, .form-select {
    width: 100%;
    padding: 10px 14px;
    font-size: 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text-900);
    transition: all var(--transition);
    outline: none;
    font-family: inherit;
}
.form-control:focus, .form-select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
}
.form-control::placeholder { color: var(--text-400); }

/* =====================================
   CARDS
===================================== */
.card-premium {
    background: var(--surface);
    padding: 28px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    transition: all .3s ease;
}
.card-premium:hover { box-shadow: var(--shadow-md); }

/* =====================================
   TABELAS
===================================== */
.table-wrapper {
    background: var(--surface);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.table-premium { width: 100%; border-collapse: collapse; }
.table-premium th, .table-premium td {
    padding: 14px 20px; text-align: left; font-size: 14px;
    border-bottom: 1px solid var(--border);
}
.table-premium th {
    background: var(--surface-hover);
    font-weight: 600; color: var(--text-600);
    font-size: 12px; text-transform: uppercase; letter-spacing: .06em;
}
.table-premium tbody tr:hover { background: #F8FAFC; }
.table-premium tr:last-child td { border-bottom: none; }

.table-actions { display: flex; gap: 6px; align-items: center; }

/* =====================================
   BADGES
===================================== */
.badge {
    display: inline-flex; align-items: center;
    padding: 4px 10px; border-radius: 4px;
    font-size: 11px; font-weight: 600;
    text-transform: uppercase; letter-spacing: .04em;
}
.badge-success, .text-finalizado { background: var(--success-bg); color: var(--success-text); }
.badge-warning, .text-em_execucao { background: var(--warning-bg); color: var(--warning-text); }
.badge-danger, .text-aguardando_peca { background: var(--danger-bg); color: var(--danger-text); }
.badge-info, .text-em_teste { background: var(--info-bg); color: var(--info-text); }
.badge-neutral, .text-pendente, .text-aguardando_servico { background: #F1F5F9; color: var(--text-600); }

/* =====================================
   MODAL UNIFICADO
===================================== */
.saas-modal-backdrop {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(15, 23, 42, .5);
    backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
    z-index: 9999;
    display: flex; align-items: center; justify-content: center;
    opacity: 0; pointer-events: none;
    transition: opacity .3s ease;
    padding: 20px;
}
.saas-modal-backdrop.show { opacity: 1; pointer-events: auto; }

.saas-modal-content {
    background: var(--surface);
    width: 100%; max-width: 520px;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border);
    transform: scale(.96) translateY(16px);
    opacity: 0;
    transition: all .3s cubic-bezier(.16, 1, .3, 1);
    display: flex; flex-direction: column;
    max-height: 85vh;
    overflow: hidden;
}
.saas-modal-backdrop.show .saas-modal-content {
    transform: scale(1) translateY(0); opacity: 1;
}

.saas-modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
    display: flex; justify-content: space-between; align-items: center;
    background: var(--surface-hover);
}
.saas-modal-header h3 {
    font-size: 16px; margin: 0; font-weight: 700; color: var(--text-900);
}
.saas-modal-close {
    background: var(--border); width: 28px; height: 28px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    color: var(--text-600); cursor: pointer; transition: all var(--transition);
    font-size: 14px;
}
.saas-modal-close:hover { background: var(--border-hover); color: var(--text-900); }

.saas-modal-body { padding: 24px; overflow-y: auto; }

.info-row {
    display: flex; justify-content: space-between; align-items: center;
    padding: 14px 0; border-bottom: 1px solid var(--border);
}
.info-row:last-child { border-bottom: none; }
.info-label { color: var(--text-500); font-size: 13px; font-weight: 500; }
.info-value { color: var(--text-900); font-size: 14px; font-weight: 600; text-align: right; max-width: 60%; word-break: break-word; }

/* =====================================
   FLASH / ALERTS
===================================== */
.flash-messages { margin-bottom: 24px; }
.alert {
    padding: 14px 20px; border-radius: var(--radius-sm);
    margin-bottom: 12px; font-size: 14px; font-weight: 500;
    display: flex; align-items: center; gap: 10px;
    border-left: 4px solid transparent;
}
.alert-success { background: var(--success-bg); color: var(--success-text); border-left-color: var(--success); }
.alert-warning { background: var(--warning-bg); color: var(--warning-text); border-left-color: var(--warning); }
.alert-danger { background: var(--danger-bg); color: var(--danger-text); border-left-color: var(--danger); }
.alert-info { background: var(--info-bg); color: var(--info-text); border-left-color: var(--info); }

/* =====================================
   SKELETON
===================================== */
.skeleton {
    background: linear-gradient(90deg, #F1F5F9 25%, #E2E8F0 50%, #F1F5F9 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite linear;
    border-radius: 4px;
}
@keyframes shimmer { 0%{background-position:200% 0} 100%{background-position:-200% 0} }

/* =====================================
   METRICS GRID (DASHBOARD)
===================================== */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}
.metric-card { display: flex; flex-direction: column; }
.metric-card h2 { font-size: 30px; margin-bottom: 6px; font-weight: 800; letter-spacing: -0.03em; }
.metric-card p { font-size: 13px; color: var(--text-500); font-weight: 500; }

/* =====================================
   DASHBOARD GRID
===================================== */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 340px;
    gap: 24px;
    margin-bottom: 32px;
}
@media (max-width: 1024px) { .dashboard-grid { grid-template-columns: 1fr; } }

.feed { max-height: 400px; overflow-y: auto; padding-right: 8px; }
.feed-item { display: flex; gap: 14px; padding: 14px 0; border-bottom: 1px dashed var(--border); }
.feed-item:last-child { border-bottom: none; }
.feed-hora { font-size: 12px; color: var(--text-400); font-variant-numeric: tabular-nums; width: 40px; flex-shrink: 0; }
.feed-content { flex: 1; display: flex; flex-direction: column; gap: 3px; }
.feed-titulo { font-size: 13px; font-weight: 600; color: var(--text-900); }
.feed-detalhes { font-size: 12px; color: var(--text-500); }

.grafico-wrapper { width: 100%; height: 200px; position: relative; display: flex; align-items: flex-end; justify-content: space-between; gap: 10px; margin-top: 20px; }
.grafico-col { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; height: 100%; position: relative; z-index: 2; }
.grafico-barra { width: 28px; background: var(--primary); border-radius: 4px 4px 0 0; transition: height 1s cubic-bezier(.16,1,.3,1); min-height: 4px; }
.grafico-valor { font-size: 11px; font-weight: 700; color: var(--text-500); margin-bottom: 6px; }
.grafico-dia { font-size: 12px; color: var(--text-500); font-weight: 600; margin-top: 10px; }
.grafico-grid { position: absolute; top: 0; left: 0; width: 100%; height: 100%; display: flex; flex-direction: column; justify-content: space-between; z-index: 1; pointer-events: none; }
.grafico-grid span { width: 100%; border-top: 1px dashed var(--border); }

/* =====================================
   STATUS COLORS (DASHBOARD TABLE)
===================================== */
.status-header { border-left: 4px solid transparent; }
.status-header.aguardando_servico { border-left-color: var(--warning); }
.status-header.em_execucao { border-left-color: var(--accent); }
.status-header.aguardando_peca { border-left-color: var(--danger); }
.status-header.em_teste { border-left-color: var(--info); }
.status-header.finalizado { border-left-color: var(--success); }

/* =====================================
   RESPONSIVE
===================================== */
@media (max-width: 768px) {
    .container { padding: 16px 12px 60px; }
    nav { padding: 0 12px; height: 52px; overflow-x: auto; -webkit-overflow-scrolling: touch; }
    nav a { padding: 8px 10px; font-size: 12px; }
    .page-header { flex-direction: column; align-items: flex-start; gap: 12px; }
    .page-title { flex-direction: column; align-items: flex-start; gap: 12px; font-size: 20px; }
    .table-premium th, .table-premium td { padding: 10px 8px; font-size: 13px; }
    .saas-modal-content { max-height: 95vh; max-width: 100%; border-radius: 12px; }
    .dashboard-grid { grid-template-columns: 1fr; }
    .metrics-grid { grid-template-columns: 1fr; gap: 12px; }
    
    /* Bootstrap Overrides for mobile Cards (Veiculos) */
    .card { border-radius: 12px !important; }
    .card-body { padding: 16px !important; }
    
    /* Stack action buttons on mobile */
    .d-flex.gap-2 { flex-wrap: wrap; }
    .d-flex.gap-2 .btn { flex: 1; min-width: 120px; text-align: center; }
    .d-flex.justify-content-between.align-items-start { flex-direction: column; gap: 16px; }
}
