:root {
    --bg-dark: #0f172a;
    --bg-card: #1e293b;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --accent: #38bdf8;
    --accent-hover: #0284c7;
    --border: #334155;
    --danger: #ef4444;
    --danger-muted: rgba(239, 68, 68, 0.15);
    --success: #22c55e;
    --container-width: 1200px;
}

* { margin: 0; padding: 0; box-sizing: border-box; font-family: 'Inter', sans-serif; }

body { background-color: var(--bg-dark); color: var(--text-main); line-height: 1.6; }

a { text-decoration: none; color: inherit; }

.container { max-width: var(--container-width); margin: 0 auto; padding: 0 20px; }

/* ── NAVBAR ─────────────────────────────────────────────────────────────────── */
.navbar {
    border-bottom: 1px solid var(--border);
    padding: 16px 0;
    background-color: rgba(15, 23, 42, 0.9);
    backdrop-filter: blur(12px);
    position: sticky; top: 0; z-index: 100;
}
.nav-container { display: flex; justify-content: space-between; align-items: center; }
.logo-text { font-size: 1.4rem; font-weight: 700; letter-spacing: 1px; }
.logo-accent { color: var(--accent); }
.nav-links { display: flex; gap: 16px; align-items: center; }
.nav-links a:not(.btn):hover { color: var(--accent); }
.nav-toggle {
    display: none; background: none; border: 1px solid var(--border);
    color: var(--text-main); padding: 6px 12px; border-radius: 6px;
    cursor: pointer; font-size: 1.2rem;
}

/* ── BOTÕES ──────────────────────────────────────────────────────────────────── */
.btn {
    padding: 10px 20px; border-radius: 8px; font-weight: 600;
    transition: all 0.2s ease; cursor: pointer; display: inline-block;
    border: none; font-size: 0.9rem; white-space: nowrap;
}
.btn-primary { background-color: var(--accent); color: #0f172a; }
.btn-primary:hover { background-color: var(--accent-hover); color: white; }
.btn-outline { background: transparent; border: 1px solid var(--accent); color: var(--accent); }
.btn-outline:hover { background-color: var(--accent); color: #0f172a; }
.btn-danger-outline { background: transparent; border: 1px solid var(--danger); color: var(--danger); }
.btn-danger-outline:hover { background: var(--danger); color: white; }
.btn-sm { padding: 6px 12px; font-size: 0.8rem; border-radius: 6px; }
.btn-large { padding: 15px 30px; font-size: 1.1rem; }

/* ── GRID ────────────────────────────────────────────────────────────────────── */
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; }

/* ── CARDS ───────────────────────────────────────────────────────────────────── */
.card {
    background-color: var(--bg-card); padding: 28px 24px;
    border-radius: 12px; border: 1px solid var(--border);
    transition: border-color 0.2s, transform 0.2s;
}
.card:hover { border-color: var(--accent); }
.card h3 { font-size: 1.2rem; margin-bottom: 12px; color: var(--accent); }

.card-link { cursor: pointer; display: block; }
.card-link:hover { transform: translateY(-4px); }

/* ── STAT CARDS ──────────────────────────────────────────────────────────────── */
.stat-card {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: 12px; padding: 24px; text-align: center;
    display: block; transition: all 0.2s;
}
.stat-card:hover { border-color: var(--accent); transform: translateY(-3px); }
.stat-icon { font-size: 2rem; margin-bottom: 8px; }
.stat-number { font-size: 2.4rem; font-weight: 700; color: var(--accent); line-height: 1; }
.stat-label { color: var(--text-muted); font-size: 0.85rem; margin-top: 6px; }

/* ── PAGE HEADER ─────────────────────────────────────────────────────────────── */
.page-header {
    display: flex; justify-content: space-between; align-items: flex-start;
    margin-bottom: 32px; gap: 16px; flex-wrap: wrap;
}
.page-header h2 { font-size: 1.8rem; }

/* ── FORM GROUPS ─────────────────────────────────────────────────────────────── */
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group label { font-size: 0.85rem; color: var(--text-muted); font-weight: 500; }
.form-group input, .form-group select, .form-group textarea {
    width: 100%; padding: 10px 14px; border-radius: 8px;
    border: 1px solid var(--border); background-color: var(--bg-dark);
    color: var(--text-main); font-size: 0.95rem; font-family: 'Inter', sans-serif;
    transition: border-color 0.2s;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
    outline: none; border-color: var(--accent);
}

/* ── BADGES ──────────────────────────────────────────────────────────────────── */
.badge {
    display: inline-block; padding: 3px 10px; border-radius: 20px;
    font-size: 0.78rem; font-weight: 700; letter-spacing: 0.5px;
    background: rgba(56, 189, 248, 0.15); color: var(--accent); border: 1px solid rgba(56,189,248,0.3);
}
.badge--danger { background: var(--danger-muted); color: var(--danger); border-color: rgba(239,68,68,0.3); }
.badge--lg { padding: 5px 14px; font-size: 0.9rem; }

/* ── LIST ITEMS ──────────────────────────────────────────────────────────────── */
.list-item {
    padding: 14px 16px; border-radius: 8px;
    border: 1px solid var(--border); background: rgba(255,255,255,0.02);
    transition: border-color 0.2s;
}
.list-item:hover { border-color: var(--accent); }
.list-item--inativo { opacity: 0.5; }
.list-item--clickable { cursor: pointer; }

/* ── PEÇA BLOCKS ─────────────────────────────────────────────────────────────── */
.peca-block {
    margin-bottom: 16px; border: 1px solid var(--border);
    border-radius: 10px; overflow: hidden;
    background: rgba(255,255,255,0.02);
}
.peca-header {
    display: flex; justify-content: space-between; align-items: flex-start;
    padding: 14px 16px; gap: 10px; flex-wrap: wrap;
    border-bottom: 1px solid var(--border); background: rgba(0,0,0,0.15);
}

/* ── ARQUIVO LISTA ───────────────────────────────────────────────────────────── */
.arquivo-lista { padding: 8px; display: flex; flex-direction: column; gap: 4px; }
.arquivo-item {
    display: flex; justify-content: space-between; align-items: center;
    padding: 8px 10px; border-radius: 6px; gap: 8px;
    background: rgba(0,0,0,0.2); border: 1px solid rgba(255,255,255,0.04);
    transition: background 0.15s;
}
.arquivo-item:hover { background: rgba(56,189,248,0.05); }
.arquivo-info { display: flex; align-items: center; gap: 8px; min-width: 0; }
.arquivo-icone { font-size: 1.1rem; flex-shrink: 0; }
.arquivo-nome {
    font-size: 0.82rem; color: #cbd5e1;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    max-width: 300px; display: block;
}
.arquivo-meta { font-size: 0.73rem; color: var(--text-muted); display: block; }

/* Arquivo no dashboard do cliente */
.arquivo-cliente {
    display: flex; justify-content: space-between; align-items: center;
    padding: 7px 10px; border-radius: 6px; gap: 8px;
    background: rgba(0,0,0,0.2); border: 1px solid rgba(255,255,255,0.04);
}

/* ── MODAL ───────────────────────────────────────────────────────────────────── */
.modal-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,0.7);
    display: flex; align-items: center; justify-content: center; z-index: 1000;
    backdrop-filter: blur(4px);
}
.modal-box {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: 16px; padding: 32px; width: 100%; max-width: 480px;
    max-height: 90vh; overflow-y: auto;
    animation: modalIn 0.2s ease;
}
@keyframes modalIn { from { opacity: 0; transform: scale(0.95); } to { opacity: 1; transform: scale(1); } }

/* ── FILTRO ATIVO ────────────────────────────────────────────────────────────── */
.filtro-ativo { background: var(--accent) !important; color: #0f172a !important; }

/* ── HERO ────────────────────────────────────────────────────────────────────── */
.hero { padding: 100px 0; }
.hero-container { display: flex; align-items: center; gap: 50px; }
.hero-text { flex: 1; }
.hero-text h1 { font-size: 3.5rem; line-height: 1.2; margin-bottom: 20px; }
.text-accent { color: var(--accent); }
.hero-text p { font-size: 1.2rem; color: var(--text-muted); margin-bottom: 40px; }
.hero-image-placeholder {
    flex: 1; background-color: var(--bg-card); height: 400px;
    border-radius: 12px; border: 1px dashed var(--border);
    display: flex; align-items: center; justify-content: center; color: var(--accent);
    min-height: 400px;
}

/* ── SERVICES ────────────────────────────────────────────────────────────────── */
.services { padding: 80px 0; background-color: #0b1120; }
.section-title { text-align: center; font-size: 2.5rem; margin-bottom: 50px; }

/* ── FOOTER ──────────────────────────────────────────────────────────────────── */
.footer { text-align: center; padding: 40px 0; border-top: 1px solid var(--border); color: var(--text-muted); font-size: 0.9rem; }
.main-content { min-height: calc(100vh - 140px); }

/* ── IMAGENS DE CAPA ─────────────────────────────────────────────────────────── */
.img-capa-wrap {
    position: relative; flex-shrink: 0;
    border-radius: 8px; overflow: hidden;
    border: 1px solid var(--border);
    background: var(--bg-dark);
}
.img-capa-wrap img {
    display: block; width: 100%; height: 100%;
    object-fit: cover; object-position: center;
    transition: transform 0.3s ease;
}
.img-capa-wrap:hover img { transform: scale(1.04); }
.img-capa-wrap .img-upload-overlay {
    position: absolute; inset: 0; background: rgba(0,0,0,0.55);
    display: flex; align-items: center; justify-content: center;
    opacity: 0; transition: opacity 0.2s; cursor: pointer;
    font-size: 0.78rem; color: white; font-weight: 600;
    flex-direction: column; gap: 4px;
}
.img-capa-wrap:hover .img-upload-overlay { opacity: 1; }

/* Tamanhos específicos */
.img-capa-120 { width: 120px; height: 120px; }
.img-capa-160 { width: 160px; height: 160px; }

/* Card de peça no cliente (imagem + info lado a lado) */
.peca-card-cliente {
    display: flex; gap: 16px; align-items: flex-start;
    padding: 14px; border-radius: 10px;
    border: 1px solid rgba(255,255,255,0.06);
    background: rgba(0,0,0,0.2);
    margin-bottom: 10px; transition: border-color 0.2s;
}
.peca-card-cliente:hover { border-color: rgba(56,189,248,0.3); }
.peca-card-cliente .peca-info { flex: 1; min-width: 0; }
.peca-card-cliente .peca-titulo { font-weight: 600; color: white; margin-bottom: 4px; display: block; }
.peca-card-cliente .peca-codigo { color: var(--text-muted); font-size: 0.78rem; }

/* ── RESPONSIVIDADE ──────────────────────────────────────────────────────────── */
@media (max-width: 900px) {
    .grid-4 { grid-template-columns: repeat(2, 1fr); }
    .grid-3 { grid-template-columns: 1fr 1fr; }
    .grid-3[style*="1fr 2fr"] { grid-template-columns: 1fr !important; }
}

@media (max-width: 640px) {
    .hero { padding: 40px 0; }
    .hero-container { flex-direction: column; text-align: center; }
    .hero-text h1 { font-size: 2rem; }
    .hero-image-placeholder { height: 320px; min-height: 320px; width: 100%; flex: none; }
    .grid-3, .grid-4 { grid-template-columns: 1fr; }
    .arquivo-nome { max-width: 160px; }
    .page-header { flex-direction: column; align-items: flex-start; }
    .peca-header { flex-direction: column; align-items: flex-start; }
    .nav-toggle { display: block; }
    .nav-links {
        display: none; position: absolute; top: 70px; left: 0; right: 0;
        background: var(--bg-dark); border-bottom: 1px solid var(--border);
        flex-direction: column; padding: 16px 20px; gap: 12px; z-index: 99;
    }
    .nav-links.open { display: flex; }
}
