body{
    font-family: Arial, Helvetica, sans-serif;
}
.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
    padding: 20px;
}
.product-card {
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 16px;
    text-align: center;
    background-color: #fff;
}
.product-card img {
    max-width: 100%;
    height: auto;
    margin-bottom: 10px;
}
.product-card h3 {
    margin: 10px 0;
    font-size: 18px;
}
.product-card p {
    margin: 5px 0;
    color: #666;
}
.product-card button {
    padding: 8px 16px;
    background-color: #007bff;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    margin-top: 10px;
}
.product-card button:hover {
    background-color: #0056b3;
}

/* Stili per il form di login */
form {
    max-width: 400px;
    margin: 50px auto;
    padding: 20px;
    border: 1px solid #ddd;
    border-radius: 8px;
    background-color: #f9f9f9;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}

form h2 {
    text-align: center;
    margin-bottom: 20px;
    color: #333;
}

form label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
    color: #555;
}

form input[type="text"],
form input[type="password"],
form input[type="email"] {
    width: 100%;
    padding: 10px;
    margin-bottom: 15px;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-sizing: border-box;
}

form button {
    width: 100%;
    padding: 10px;
    background-color: #28a745;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
}

form button:hover {
    background-color: #218838;
}

/* Stili per la pagina prodotto */
.product-detail {
    max-width: 800px;
    margin: 20px auto;
    padding: 20px;
    border: 1px solid #ddd;
    border-radius: 8px;
    background-color: #fff;
    display: flex;
    flex-direction: column;
}

.product-detail img {
    max-width: 100%;
    height: auto;
    object-fit: contain;
    margin-bottom: 20px;
    flex-shrink: 0;
}

.product-detail > div {
    flex: 1;
}

@media (min-width: 768px) {
    .product-detail {
        flex-direction: row;
    }
    
    .product-detail img {
        max-width: 40%;
        margin-bottom: 0;
        margin-right: 20px;
    }
}

.img-square {
  position: relative;
  width: 100%;
  padding-top: 100%; /* crea un quadrato perfetto */
  overflow: hidden;
}

.img-square img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: contain; /* o "cover" */
}

/* Pagina carrello */
.cart-container {
    max-width: 900px;
    margin: 20px auto;
    padding: 20px;
}
.cart-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}
.cart-table th, .cart-table td {
    border: 1px solid #ddd;
    padding: 12px;
    text-align: left;
}
.cart-table th {
    background-color: #f2f2f2;
    font-weight: bold;
}
.cart-table button {
    padding: 5px 10px;
    background-color: #dc3545;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}
.cart-table button:hover {
    background-color: #c82333;
}
.cart-summary {
    margin-top: 20px;
    text-align: right;
    font-size: 18px;
    font-weight: bold;
}
.empty-cart {
    text-align: center;
    padding: 40px;
    font-size: 18px;
    color: #666;
}
.clear-cart-btn {
    padding: 10px 20px;
    background-color: #dc3545;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    margin-top: 20px;
}
.clear-cart-btn:hover {
    background-color: #c82333;
}
.checkout-btn {
    padding: 10px 20px;
    background-color: #28a745;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    margin-left: 10px;
}
.checkout-btn:hover {
    background-color: #218838;
}

/* Layout pagina account */
.account-layout {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    max-width: 1100px;
    margin: 20px auto;
    padding: 0 20px;
    box-sizing: border-box;
}

.my-sidebar {
    flex: 0 0 240px;
    border: 1px solid #ddd;
    border-radius: 8px;
    background-color: #fff;
    padding: 20px;
}

.my-sidebar ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.my-sidebar li {
    margin-bottom: 12px;
}

.my-sidebar a {
    color: #007bff;
    text-decoration: none;
}

.my-sidebar a:hover {
    text-decoration: underline;
}

.my-container {
    flex: 1 1 580px;
    border: 1px solid #ddd;
    border-radius: 8px;
    background-color: #fff;
    padding: 20px;
}

.product-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}

.product-table th,
.product-table td {
    border: 1px solid #ddd;
    padding: 12px;
    vertical-align: top;
}

.product-table th {
    background-color: #f8f9fa;
    font-weight: 700;
    text-align: left;
}

.product-row:hover {
    background-color: #f7f9fb;
}

.add-product-panel {
    margin-bottom: 24px;
    padding: 18px;
    border: 1px solid #ddd;
    border-radius: 8px;
    background-color: #fdfdfd;
}

.add-product-panel h2 {
    margin-top: 0;
    margin-bottom: 16px;
    color: #333;
    font-size: 1.25rem;
}

.add-product-form {
    display: grid;
    gap: 16px;
}

.add-product-form .form-row {
    display: grid;
    gap: 8px;
}

.add-product-form label {
    font-weight: 600;
    color: #444;
}

.toggle-button {
    padding: 10px 16px;
    background-color: #17a2b8;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    margin-bottom: 16px;
}

.toggle-button:hover {
    background-color: #117a8b;
}

.add-product-panel.collapsed {
    display: none;
}

.product-name-input,
.product-description-textarea,
.product-category-select,
.product-price-input,
.stock-input,
.product-image-input {
    width: 100%;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-sizing: border-box;
}

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

.stock-control {
    display: flex;
    align-items: center;
    gap: 8px;
}

.stock-button {
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 4px;
    background-color: #007bff;
    color: #fff;
    cursor: pointer;
}

.stock-button:hover {
    background-color: #0056b3;
}

.product-image-preview {
    max-width: 100px;
    display: block;
    margin-bottom: 8px;
}

.image-upload {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.save-button {
    padding: 10px 16px;
    background-color: #28a745;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.save-button:hover {
    background-color: #218838;
}

.admin-divider{
    display: block;
    height: 1px;
    border: 0;
    border-top: 1px solid #ddd;
    margin: 1em 0;
    padding: 0;
}

.admin-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-top: 20px;
}

.admin-stat-card {
    padding: 20px;
    border: 1px solid #ddd;
    border-radius: 12px;
    background-color: #fff;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
    text-align: center;
}

.admin-stat-card h2 {
    margin: 0 0 10px;
    font-size: 36px;
    color: #333;
}

.admin-stat-card p {
    margin: 0;
    color: #666;
    font-weight: 600;
}

.admin-stat-pending {
    border-color: #ffc107;
    background-color: #fff8e1;
}

.admin-stat-products {
    border-color: #17a2b8;
    background-color: #e9f7fb;
}

@media (max-width: 768px) {
    .account-layout {
        flex-direction: column;
    }
    .my-sidebar,
    .my-container {
        flex: 1 1 100%;
    }
}

/* Stili per la pagina ordini */
.orders-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.order-card {
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 20px;
    background-color: #fff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.order-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.order-header h3 {
    margin: 0;
    color: #333;
}

.order-status {
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: bold;
    text-transform: uppercase;
}

.status-pending {
    background-color: #ffc107;
    color: #212529;
}

.status-completed {
    background-color: #28a745;
    color: white;
}

.status-cancelled {
    background-color: #dc3545;
    color: white;
}

.order-details p {
    margin: 5px 0;
    color: #666;
}

/* Stili per la pagina admin di gestione ordini */
.admin-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
    background-color: #fff;
}

.admin-table th,
.admin-table td {
    border: 1px solid #ddd;
    padding: 12px;
    text-align: left;
}

.admin-table th {
    background-color: #f2f2f2;
    font-weight: bold;
}

.admin-table tbody tr:hover {
    background-color: #f9f9f9;
}

.status-select {
    padding: 5px 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
}

.status-select.status-pending {
    background-color: #fff3cd;
    color: #212529;
}

.status-select.status-completed {
    background-color: #d4edda;
    color: #155724;
}

.status-select.status-cancelled {
    background-color: #f8d7da;
    color: #721c24;
}

.btn-delete {
    padding: 5px 10px;
    background-color: #dc3545;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
}

.btn-delete:hover {
    background-color: #c82333;
}

.admin-table td form {
    display: contents;
    margin: 0;
    padding: 0;
}

/* Stili per role-select */
.role-select {
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
}

.role-select.role-user {
    background-color: #e7f3ff;
    color: #004085;
}

.role-select.role-admin {
    background-color: #fff3cd;
    color: #856404;
}

/* Stili per btn-reset */
.btn-reset {
    background-color: #17a2b8;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    margin-right: 5px;
}

.btn-reset:hover {
    background-color: #138496;
}
