/* assets/style.css — Ufficio Giudiziario */
@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@300;400;500;600&family=DM+Mono:wght@400;500&display=swap');

:root {
    --bg:         #0f1117;
    --bg-card:    #1a1d27;
    --bg-hover:   #22263a;
    --border:     rgba(255,255,255,0.07);
    --accent:     #4f8ef7;
    --accent-dim: rgba(79,142,247,0.15);
    --danger:     #e05252;
    --success:    #3ecf8e;
    --warning:    #f5a623;
    --text:       #e8eaf0;
    --muted:      #7a7f99;
    --radius:     10px;
    --radius-lg:  16px;
    --shadow:     0 4px 24px rgba(0,0,0,0.4);
    --font:       'DM Sans', sans-serif;
    --font-mono:  'DM Mono', monospace;
    --transition: 0.2s ease;
}

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

html { font-size: 15px; }

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    line-height: 1.6;
}

/* ── LAYOUT ── */
.app-wrapper { display: flex; min-height: 100vh; }

.sidebar {
    width: 240px;
    background: var(--bg-card);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 28px 0;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 100;
}

.sidebar-logo {
    padding: 0 24px 28px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 16px;
}

.sidebar-logo h1 {
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--muted);
}

.sidebar-logo span {
    display: block;
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--text);
    margin-top: 2px;
}

.sidebar-nav { flex: 1; padding: 0 12px; }

.nav-label {
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--muted);
    padding: 0 12px;
    margin: 20px 0 8px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 14px;
    border-radius: var(--radius);
    color: var(--muted);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: var(--transition);
    margin-bottom: 2px;
}

.nav-item:hover, .nav-item.active {
    background: var(--accent-dim);
    color: var(--accent);
}

.nav-item .icon { font-size: 1rem; width: 20px; text-align: center; }

.sidebar-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border);
}

.logout-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--danger);
    text-decoration: none;
    font-size: 0.88rem;
    font-weight: 500;
    transition: var(--transition);
}

.logout-btn:hover { opacity: 0.75; }

.main-content {
    margin-left: 240px;
    flex: 1;
    padding: 36px 40px;
    max-width: 100%;
}

/* ── TOPBAR ── */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 32px;
}

.page-title { font-size: 1.6rem; font-weight: 600; }
.page-subtitle { color: var(--muted); font-size: 0.88rem; margin-top: 2px; }

/* ── CARDS ── */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    margin-bottom: 24px;
}

.card-title {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 18px;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ── FORM ── */
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.form-grid.wide { grid-template-columns: 1fr 1fr 1fr; }
.form-full { grid-column: 1 / -1; }

.form-group { display: flex; flex-direction: column; gap: 6px; }

label {
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--muted);
}

input[type="text"],
input[type="email"],
input[type="date"],
input[type="password"],
select,
textarea {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-family: var(--font);
    font-size: 0.9rem;
    padding: 9px 13px;
    transition: border-color var(--transition);
    width: 100%;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--accent);
}

textarea { resize: vertical; min-height: 80px; }

/* ── BUTTONS ── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 18px;
    border-radius: var(--radius);
    font-family: var(--font);
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: var(--transition);
    text-decoration: none;
    white-space: nowrap;
}

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

.btn-success   { background: var(--success); color: #0f1117; }
.btn-success:hover { filter: brightness(1.1); }

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

.btn-ghost {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--muted);
}
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }

.btn-sm { padding: 5px 11px; font-size: 0.8rem; }

.btn-group { display: flex; gap: 8px; flex-wrap: wrap; }

/* ── SEARCH BAR ── */
.search-row {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: flex-end;
    margin-bottom: 20px;
}

.search-row .form-group { min-width: 180px; }

/* ── TABLE ── */
.table-wrap { overflow-x: auto; border-radius: var(--radius); }

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.87rem;
}

thead th {
    background: var(--bg);
    color: var(--muted);
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    padding: 10px 14px;
    text-align: left;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

thead th a {
    color: inherit;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

thead th a:hover { color: var(--accent); }

tbody tr {
    border-bottom: 1px solid var(--border);
    transition: background var(--transition);
}

tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: var(--bg-hover); }

tbody td {
    padding: 10px 14px;
    color: var(--text);
    vertical-align: middle;
    max-width: 220px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

tbody td.wrap { white-space: normal; max-width: 280px; }

/* ── BADGES ── */
.badge {
    display: inline-block;
    padding: 2px 9px;
    border-radius: 99px;
    font-size: 0.72rem;
    font-weight: 600;
    background: var(--accent-dim);
    color: var(--accent);
}

/* ── ALERTS ── */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius);
    font-size: 0.88rem;
    margin-bottom: 18px;
    border-left: 3px solid;
}

.alert-success { background: rgba(62,207,142,0.1); border-color: var(--success); color: var(--success); }
.alert-danger  { background: rgba(224,82,82,0.1);  border-color: var(--danger);  color: var(--danger); }
.alert-info    { background: var(--accent-dim);     border-color: var(--accent);  color: var(--accent); }

/* ── PAGINATION ── */
.pagination {
    display: flex;
    gap: 4px;
    justify-content: center;
    padding: 16px 0 0;
    list-style: none;
}

.pagination a, .pagination span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: var(--radius);
    font-size: 0.85rem;
    text-decoration: none;
    transition: var(--transition);
    color: var(--muted);
    border: 1px solid var(--border);
}

.pagination a:hover { border-color: var(--accent); color: var(--accent); }
.pagination .current { background: var(--accent); color: #fff; border-color: var(--accent); }

/* ── STAT CARDS (dashboard) ── */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; margin-bottom: 24px; }

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px 24px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.stat-card .stat-label { font-size: 0.72rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); }
.stat-card .stat-value { font-size: 2rem; font-weight: 600; color: var(--text); font-family: var(--font-mono); }
.stat-card .stat-desc  { font-size: 0.8rem; color: var(--muted); }

/* ── LOGIN ── */
.login-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: var(--bg);
}

.login-box {
    width: 360px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 40px 36px;
}

.login-box h2 {
    font-size: 1.35rem;
    font-weight: 600;
    margin-bottom: 8px;
}

.login-box p.sub { color: var(--muted); font-size: 0.88rem; margin-bottom: 28px; }

.login-box .form-group { margin-bottom: 16px; }
.login-box label { display: block; margin-bottom: 6px; }
.login-box .btn { width: 100%; justify-content: center; margin-top: 8px; padding: 11px; }

/* ── EMPTY STATE ── */
.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: var(--muted);
}

.empty-state .icon { font-size: 2.5rem; margin-bottom: 12px; }
.empty-state p { font-size: 0.9rem; }

/* ── DIVIDER ── */
.divider { border: none; border-top: 1px solid var(--border); margin: 24px 0; }

/* ── SCROLLBAR ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: var(--muted); }

/* ── RESPONSIVE ── */
@media (max-width: 900px) {
    .sidebar { transform: translateX(-100%); }
    .main-content { margin-left: 0; padding: 20px 16px; }
}
