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

body {
    font-family: Arial, sans-serif;
    background: #f5f5f5;
    color: #222;
}

/* ── Header ── */
header {
    background: #222;
    color: white;
    padding: 14px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
header h1 { font-size: 1.1rem; }
header .btn-logout {
    background: transparent;
    color: white;
    border: 1px solid white;
    padding: 5px 12px;
    border-radius: 4px;
    cursor: pointer;
}

/* ── Layout ── */
.container {
    max-width: 1100px;
    margin: 30px auto;
    padding: 0 20px;
}

/* ── Auth pages (login / register) ── */
.auth-page {
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    background: #f5f5f5;
}
.auth-box {
    background: white;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    width: 320px;
}
.auth-box h1 { text-align: center; margin-bottom: 20px; }
.auth-box input {
    width: 100%;
    padding: 10px;
    margin: 8px 0;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 1rem;
}
.auth-box .btn-primary {
    width: 100%;
    margin-top: 10px;
    padding: 10px;
    font-size: 1rem;
}
.auth-box .link { text-align: center; margin-top: 14px; font-size: 0.9rem; }
.auth-box .link a { color: #007bff; text-decoration: none; }
.message { text-align: center; margin-top: 10px; padding: 8px; border-radius: 4px; font-size: 0.9rem; display: none; }
.message.error   { background: #f8d7da; color: #721c24; display: block; }
.message.success { background: #d4edda; color: #155724; display: block; }

/* ── Buttons ── */
.btn-primary { background: #222; color: white; border: none; padding: 7px 14px; border-radius: 4px; cursor: pointer; }
.btn-primary:hover { background: #444; }
.btn-green   { background: #28a745; color: white; border: none; padding: 7px 14px; border-radius: 4px; cursor: pointer; }
.btn-green:hover { background: #218838; }
.btn-red     { background: #dc3545; color: white; border: none; text-align: center; align-items: right; padding: 7px 14px; border-radius: 4px; cursor: pointer; }
.btn-red:hover { background: #c82333; }

/* ── Tabs ── */
.tabs { display: flex; gap: 6px; margin-bottom: 18px; }
.tab { padding: 8px 18px; border: 1px solid #ccc; background: white; border-radius: 4px; cursor: pointer; font-size: 0.95rem; }
.tab.active { background: #222; color: white; border-color: #222; }

/* ── Search ── */
.search-bar { display: flex; gap: 8px; margin-bottom: 20px; }
.search-bar input { flex: 1; padding: 8px 12px; border: 1px solid #ccc; border-radius: 4px; font-size: 1rem; }

/* ── Grid di card ── */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.card { background: white; border: 1px solid #ddd; border-radius: 6px; padding: 20px; margin-bottom: 5px; }
.card h3 { font-size: 0.95rem; margin-bottom: 6px; }
.card .price { font-weight: bold; margin-bottom: 4px; }
.card .sub   { font-size: 0.82rem; color: #666; margin-bottom: 12px; }
.card button { width: 100%; }

/* ── Carrello ── */
.cart-section { background: white; border: 1px solid #ddd; border-radius: 6px; padding: 16px; margin-top: 30px; }
.cart-section h2 { margin-bottom: 12px; }
.cart-item { display: flex; justify-content: space-between; align-items: center; padding: 7px 0; border-bottom: 1px solid #eee; font-size: 0.9rem; }
.cart-item:last-child { border-bottom: none; }
.cart-footer { display: flex; justify-content: space-between; align-items: center; margin-top: 14px; }
.cart-total { font-weight: bold; font-size: 1.1rem; }

/* ── Modal officine ── */
.modal-bg { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.45); justify-content: center; align-items: center; z-index: 100; }
.modal-bg.open { display: flex; }
.modal { background: white; border-radius: 8px; padding: 24px; width: 480px; max-width: 95vw; max-height: 80vh; overflow-y: auto; }
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.modal-header h2 { font-size: 1.1rem; }
.modal-close { background: none; border: none; font-size: 1.4rem; cursor: pointer; color: #666; }
.officina-item { border: 1px solid #ddd; border-radius: 4px; padding: 10px 14px; margin-bottom: 8px; display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.officina-info strong { display: block; margin-bottom: 2px; }
.officina-info span { font-size: 0.85rem; color: #555; }

/* ── Utility ── */
.empty   { color: #888; font-size: 0.9rem; padding: 6px 0; }
.loading { color: #888; font-size: 0.9rem; }

/* ── Admin form select ── */
select {
    width: 100%;
    padding: 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 1rem;
    background: white;
}

/* ── Header link ── */
header a {
    color: white;
    margin-right: 14px;
    font-size: 0.9rem;
    text-decoration: none;
}
header a:hover { text-decoration: underline; }

/* ── Controlli quantità carrello ── */
.cart-item-controls {
    display: flex;
    align-items: center;
    gap: 6px;
}
.btn-qty {
    background: #eee;
    border: 1px solid #ccc;
    width: 26px;
    height: 26px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
}
.btn-qty:hover { background: #ddd; }
.qty-value {
    min-width: 24px;
    text-align: center;
    font-weight: bold;
}

table, td, th {
    text-align: center;
    padding: 10px;
    border: 1px solid black;
    border-collapse: collapse;
}