/* Global Styles */
body {
    font-family: 'Arial', sans-serif;
    color: #333;
    margin: 0;
    padding: 0;
    background-color: #f5f5f5;
    text-align: center;
}

/* Header */
header {
    background-color: #333;
    color: #fff;
    padding: 15px 0;
}

header .container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
}

header .logo img {
    max-width: 150px;
    height: auto;
}

header nav ul {
    list-style-type: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
}

header nav ul li {
    margin: 5px 10px;
}

header nav ul li a {
    color: #fff;
    text-decoration: none;
    font-weight: bold;
    padding: 10px 15px;
}

header nav ul li a:hover {
    background-color: #555;
    border-radius: 5px;
}

/* Hero Section */
#hero {
    background-color: #e5e5e5;
    padding: 40px 0;
}

.hero-content {
    max-width: 800px;
    margin: 0 auto;
    text-align: center;
}

#hero h1 {
    font-size: 2em;
    margin-bottom: 20px;
    color: #333;
}

#hero p {
    font-size: 1.2em;
    margin-bottom: 30px;
}

#search-bar {
    width: calc(100% - 40px); /* Reduce width to avoid overflow */
    max-width: none; /* Disable width limit */
    margin-bottom: 20px;
    margin-left: auto;
    margin-right: auto;
}

#search-bar input {
    width: 100%; /* Ensure input takes full width of parent */
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
}

/* Materials Grid */
#materials-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    max-width: 1200px;
    margin: 0 auto;
}

.material-card {
    background-color: #fff;
    border: 1px solid #ddd;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    transition: transform 0.3s, box-shadow 0.3s;
}

.material-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.material-card img {
    width: 100%;
    height: 150px;
    object-fit: cover;
}

.material-info {
    padding: 15px;
    text-align: center;
}

.material-info h2 {
    font-size: 1.5em;
    margin-bottom: 10px;
}

.material-info p {
    font-size: 1em;
    color: #666;
}

/* Cart Icon */
.cart-icon {
    position: relative;
    font-size: 24px;
    color: #28a745; /* Green color for the cart icon */
    text-decoration: none;
}

.cart-icon .fas {
    position: relative;
}

.cart-item-count {
    position: absolute;
    top: -10px;
    right: -10px;
    background-color: #ff4757; /* Red color for the item count badge */
    color: #fff;
    border-radius: 50%;
    padding: 4px 8px;
    font-size: 14px;
    font-weight: bold;
}

#cart-modal {
    z-index: 1002;
}

/* Cart Details */
.cart-details {
	z-index: 1001;
    position: fixed;
    right: 20px;
    top: 100px;
    width: 250px;
    background-color: #fff;
    border: 1px solid #ddd;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    z-index: 1001;
	display: none;
}

.cart-details.show {
    display: block;
}

.cart-details h3 {
    font-size: 1.5em;
    margin-top: 0;
    text-align: center;
}

.cart-details p {
    margin: 10px 0;
    font-weight: bold;
    text-align: center;
}

.cart-details button {
    width: 100%;
    padding: 10px;
    background-color: #333;
    color: #fff;
    border: none;
    border-radius: 5px;
    cursor: pointer;
	margin-bottom: 10px;
}

.cart-details button:hover {
    background-color: #555;
}

/* Style du modal de confirmation */
#confirm-delete-modal {
    display: none; /* Par défaut, le modal est caché */
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    justify-content: center;
    align-items: center;
	z-index: 2000;
}

#confirm-delete-modal .modal-content {
    background-color: #fff;
    padding: 20px;
    border-radius: 10px;
    text-align: center;
    max-width: 400px;
    margin: auto;
}

#confirm-delete-modal .modal-actions #confirm-delete-btn {
    background-color: #ff4757; /* Rouge pour Supprimer */
    color: white;
}

#confirm-delete-modal .modal-actions #cancel-delete-btn {
    background-color: #28a745; /* Vert pour Annuler */
    color: white;
}

#confirm-delete-modal .modal-actions {
    display: flex;
    justify-content: space-evenly;
    margin-top: 20px;
}

#confirm-delete-modal .modal-actions #confirm-delete-btn,
#confirm-delete-modal .modal-actions #cancel-delete-btn {
    padding: 10px 20px;
    border-radius: 5px;
    border: none;
    cursor: pointer;
}

#confirm-delete-modal .modal-actions #confirm-delete-btn:hover {
    background-color: #e63946; /* Rouge plus foncé au survol */
}

#confirm-delete-modal .modal-actions #cancel-delete-btn:hover {
    background-color: #218838; /* Vert plus foncé au survol */
}

#modify-cart-modal {
    z-index: 1060;
}

#modify-cart-modal .modal-content {
    background-color: #fff;
    padding: 20px;
    border-radius: 10px;
    text-align: left;
    max-width: 500px;
    margin: auto;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

#modify-cart-modal h2 {
    text-align: center;
    font-size: 1.8em;
    margin-bottom: 20px;
    color: #333;
}

#modify-cart-modal ul {
    list-style-type: none;
    padding: 0;
}

#modify-cart-modal li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid #ddd;
    margin-bottom: 10px;
}

#modify-cart-modal li:last-child {
    border-bottom: none;
}

#modify-cart-modal li p {
    margin: 0;
    font-size: 1.2em;
    flex: 2;
    color: #333;
}

/* Style du bouton "Supprimer" */
#modify-cart-modal .remove-item-btn {
    background-color: #ff4757;
    color: #fff;
    padding: 8px 12px;
    border: none;
    border-radius: 5px;
    font-size: 0.9em;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

#modify-cart-modal .remove-item-btn:hover {
    background-color: #e63946;
}

/* Style de l'input de quantité */
#modify-cart-modal input[type="number"] {
    width: 60px;
    padding: 5px;
    font-size: 1em;
    border: 1px solid #ccc;
    border-radius: 5px;
    margin-left: 10px;
}

/* Style du total */
#modify-cart-modal p.total {
    font-size: 1.5em;
    font-weight: bold;
    text-align: right;
    color: #28a745;
    margin-top: 20px;
}

/* Centrer le texte dans les champs d'input */
#modify-cart-modal input[type="number"] {
    text-align: center;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background-color: #fff;
    padding: 20px;
    border-radius: 10px;
    width: 90%;
    max-width: 600px;
    position: relative;
}

.modal .close-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    background-color: #333;
    color: #fff;
    border: none;
    padding: 5px 10px;
    cursor: pointer;
    border-radius: 50%;
}

.modal .material-details h3 {
    font-size: 1.8em;
    margin-bottom: 15px;
}

.modal .material-details p {
    font-size: 1.2em;
    margin-bottom: 20px;
}

.carousel-container {
    position: relative;
    width: 100%;
    overflow: hidden;
    max-width: 600px;
    margin: 0 auto;
}

.carousel-track {
    display: flex;
    transition: transform 0.5s ease-in-out;
}

.carousel-item {
    min-width: 100%;
    box-sizing: border-box;
    padding: 20px;
    text-align: center;
}

.carousel-item img {
    width: 100%;
    height: auto;
    max-height: 300px;
    object-fit: cover;
    border-radius: 10px;
}

/* Style général pour les boutons du carrousel */
.carousel-btn {
    position: absolute;
    top: 50%;
    background-color: rgba(0, 0, 0, 0.5); /* Arrière-plan semi-transparent */
    color: #fff;
    border: none;
    padding: 15px;
    cursor: pointer;
    z-index: 1000;
    border-radius: 50%;
    opacity: 1; /* Les boutons sont toujours visibles */
    transition: transform 0.3s ease-in-out;
}

/* Animation pour agrandir légèrement les boutons au survol */
.carousel-btn:hover {
    background-color: rgba(0, 0, 0, 0.7); /* Arrière-plan plus sombre au survol */
    transform: translateY(-50%) scale(1.1); /* Agrandissement léger au survol */
}

/* Position des boutons précédent et suivant */
.prev-btn {
    left: 10px;
}

.next-btn {
    right: 10px;
}

/* Animation wiggle continue pour attirer l'œil */
.carousel-btn.wiggle {
    animation: wiggle-animation 1.5s infinite ease-in-out;
}

/* Définition de l'animation wiggle */
@keyframes wiggle-animation {
    0%, 100% {
        transform: translateY(-50%) rotate(0deg);
    }
    25% {
        transform: translateY(-50%) rotate(-5deg);
    }
    50% {
        transform: translateY(-50%) rotate(5deg);
    }
    75% {
        transform: translateY(-50%) rotate(-5deg);
    }
}

.add-btn {
    background-color: green;
    color: white;
    border: none;
    padding: 10px;
    font-size: 20px;
    border-radius: 5px;
    cursor: pointer;
}

.modal-content {
    padding: 20px;
    border-radius: 10px;
    background: #fff;
    max-width: 400px;
    margin: auto;
    text-align: center;
}

@keyframes wiggle {
    0%, 100% {
        transform: rotate(0deg);
    }
    25% {
        transform: rotate(5deg);
    }
    75% {
        transform: rotate(-5deg);
    }
}

.wiggle {
    animation: wiggle 0.5s ease-in-out infinite;
}

.wiggle:hover {
    animation: none; /* Arrêter l'animation au survol */
}

/* Appliquer le wiggle aux flèches et au bouton "+" */
.add-btn.wiggle,
.carousel-btn.wiggle {
    display: inline-block;
    transition: transform 0.3s ease-in-out;
}

/* Footer */
footer {
    background-color: #333;
    color: #fff;
    padding: 15px 0;
    text-align: center;
    margin-top: auto;
}

footer p {
    margin: 0;
    font-size: 0.9em;
}

/* Style du modal Détails du panier */
#cart-modal .modal-content {
    background-color: #f9f9f9; /* Couleur de fond plus claire */
    padding: 25px;
    border-radius: 15px; /* Coins arrondis */
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2); /* Ombre plus prononcée */
    text-align: left;
    max-width: 500px;
    margin: auto;
}

#cart-modal h2 {
    text-align: center;
    font-size: 1.8em;
    color: #333;
    margin-bottom: 20px;
    border-bottom: 2px solid #ddd;
    padding-bottom: 10px;
}

#cart-modal ul {
    list-style-type: none;
    padding: 0;
}

#cart-modal li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid #ddd;
}

#cart-modal li:last-child {
    border-bottom: none;
}

#cart-modal li p {
    margin: 0;
    font-size: 1.1em;
    color: #555;
}

#cart-modal li input[type="number"] {
    width: 60px;
    padding: 5px;
    font-size: 1em;
    border: 1px solid #ccc;
    border-radius: 5px;
}

#cart-modal .remove-item-btn {
    background-color: #ff4757;
    color: #fff;
    border: none;
    padding: 5px 10px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.9em;
}

#cart-modal .remove-item-btn:hover {
    background-color: #e63946;
}

#cart-modal p {
    font-size: 1.2em;
    color: #333;
    text-align: right;
    margin-top: 20px;
}

#cart-modal .modal-content p.total-price {
    font-size: 1.5em;
    font-weight: bold;
    color: #28a745;
}

/* Style du bouton "Passer la commande" */
#cart-modal .checkout-button {
    background-color: #28a745;
    color: #fff;
    border: none;
    padding: 15px 20px;
    font-size: 1.2em;
    border-radius: 5px;
    cursor: pointer;
    text-align: center;
    width: 100%; /* Prend toute la largeur du parent */
    margin-top: 20px; /* Espacement au-dessus du bouton */
    display: block; /* Assure que le bouton est centré */
}

#cart-modal .checkout-button:hover {
    background-color: #218838; /* Changement de couleur au survol */
}

.modal-content h3 {
    font-size: 1.5em;
    margin-bottom: 20px;
    color: #333;
}

.modal-content label {
    display: block;
    font-weight: bold;
    margin-bottom: 5px;
    color: #666;
}

.modal-content input[type="text"],
.modal-content input[type="number"],
.modal-content select,
.modal-content input[type="file"] {
    width: 100%;
    padding: 10px;
    margin-bottom: 15px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 1em;
    box-sizing: border-box;
}

.modal-content button {
    background-color: #28a745;
    color: #fff;
    padding: 10px 15px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1em;
}

.modal-content button:hover {
    background-color: #218838;
}

/* Alignement des boutons dans le modal */
.modal-actions {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 20px;
}

.modal-actions .btn-cancel {
    background-color: #ff4757; /* Rouge pour Annuler */
    padding: 10px 15px;
    border-radius: 5px;
    font-size: 1em;
    color: #fff;
    border: none;
    cursor: pointer;
}

.modal-actions .btn-cancel:hover {
    background-color: #e63946; /* Rouge plus foncé au survol */
}

.btn-admin.btn-cancel {
    background-color: #28a745; /* Vert pour annuler */
    padding: 10px 15px;
    border-radius: 5px;
    font-size: 1em;
    color: white; /* Texte en blanc */
    cursor: pointer;
}

.btn-admin.btn-cancel:hover {
    background-color: #218838; /* Vert foncé au survol */
}

.btn-admin.btn-danger {
    background-color: #ff4757;
    padding: 10px 15px;
    border-radius: 5px;
    font-size: 1em;
    cursor: pointer;
}

.btn-admin.btn-danger:hover {
    background-color: #e63946;
}

.alert {
    padding: 15px;
    background-color: #f44336; /* Rouge par défaut */
    color: white;
    margin-bottom: 20px;
    border-radius: 4px;
}

.alert.success {
    background-color: #4CAF50; /* Vert pour le succès */
}

.alert.error {
    background-color: #f44336; /* Rouge pour les erreurs */
}

.alert.info {
    background-color: #2196F3; /* Bleu pour les informations */
}

/* Add to cart */
#add-to-cart-modal .modal-content {
    padding: 20px;
    background-color: #f8f9fa;
    border-radius: 10px;
    text-align: center;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    max-width: 400px;
    margin: auto;
}

#add-to-cart-modal h3 {
    font-size: 1.5em;
    margin-bottom: 20px;
    color: #343a40;
}

#add-to-cart-modal p {
    font-size: 1.2em;
    margin-bottom: 20px;
    color: #6c757d;
}

#add-to-cart-modal input[type="number"] {
    width: 50px;
    padding: 5px;
    margin-bottom: 20px;
    font-size: 1em;
    text-align: center;
    border: 1px solid #ced4da;
    border-radius: 5px;
}

#add-to-cart-modal button {
    padding: 10px 20px;
    background-color: #28a745;
    color: white;
    border: none;
    border-radius: 5px;
    font-size: 1em;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

#add-to-cart-modal button:hover {
    background-color: #218838;
}

/* Login Section */
body, html {
    height: 100%; /* Ensure the body and html take full height */
    margin: 0;
    display: flex;
    flex-direction: column;
}

#login-section {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-grow: 1; /* Allow this section to take the remaining space */
    background-color: #f5f5f5;
}

.login-container {
    background-color: #fff;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    max-width: 400px;
    width: 100%;
    text-align: center;
}

.login-container h2 {
    font-size: 1.8em;
    margin-bottom: 20px;
    color: #333;
}

.login-form {
    display: flex;
    flex-direction: column;
}

.form-group {
    margin-bottom: 15px;
}

.admin-input {
    width: 100%;
    padding: 10px;
    margin-top: 5px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 1em;
    box-sizing: border-box;
}

.btn-admin {
    padding: 10px 15px;
    margin: 5px;
    background-color: #28a745;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
}

.btn-admin:hover {
    background-color: #218838;
}

.error-msg {
    color: red;
    margin-bottom: 15px;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
}

.admin-table th, .admin-table td {
    padding: 12px;
    text-align: center;
    border: 1px solid #ddd;
}

.metal-img {
    width: 100px; 
    height: auto; 
    object-fit: cover; 
    border-radius: 5px; 
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

#checkout-form-modal {
    z-index: 1004;
}

#checkout-form-modal .modal-content {
    background-color: #fff;
    padding: 20px;
    border-radius: 10px;
    max-width: 400px;
    margin: auto;
    text-align: left;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

#checkout-form-modal h2 {
    text-align: center;
    font-size: 1.8em;
    margin-bottom: 20px;
    color: #333;
}

#checkout-form-modal .form-group {
    margin-bottom: 15px;
}

#checkout-form-modal .form-group label {
    display: block;
    font-weight: bold;
    margin-bottom: 5px;
}

#checkout-form-modal .form-group input {
    width: calc(100% - 22px);
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
	box-sizing: border-box;
}

#checkout-form-modal button {
    background-color: #28a745;
    color: #fff;
    padding: 10px 15px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1em;
    width: 100%;
}

#checkout-form-modal button:hover {
    background-color: #218838;
}

/* Notification bubble styles */
.invalid-quantity-message {
    position: absolute;
    background-color: #f44336; /* Red background */
    color: white;
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 14px;
    box-shadow: 0px 2px 5px rgba(0, 0, 0, 0.3);
    display: none;
    z-index: 1060;
}

#contact-modal ul li {
    list-style: none;
    margin-bottom: 10px;
    font-size: 1.2em;
}

#contact-modal ul li i {
    margin-right: 10px;
}

#contact-modal ul li .fa-phone-alt {
    color: #28a745; /* Vert pour l'icône de téléphone */
}

#contact-modal ul li .fa-envelope {
    color: #333; /* Couleur par défaut pour l'icône d'email */
}

#contact-modal ul li a {
    color: #333; /* Couleur du texte du lien */
    text-decoration: none;
    font-weight: bold;
}

#contact-modal ul li a:hover {
    text-decoration: underline;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    #hero h1 {
        font-size: 1.8em;
    }

    #materials-grid {
        grid-template-columns: 1fr;
        padding: 0 10px;
    }

    .cart-details {
        display: none;
    }

    #cart-btn {
        position: fixed;
        top: 10px;  /* Adjusted position to top */
        right: 10px;
        background-color: #333; /* Gray background color */
        color: #28a745; /* Green color for the cart icon */
        padding: 10px 15px;
        border-radius: 5px; /* Rounded rectangle */
        box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
        z-index: 1002;
    }

    .cart-icon {
        font-size: 24px;
        color: #28a745; /* Green color for the cart icon */
    }

    .cart-item-count {
        top: -8px;
        right: -8px;
        background-color: #ff4757; /* Red color for the item count badge */
        color: #fff;
        border-radius: 50%;
        padding: 2px 6px;
        font-size: 12px;
        font-weight: bold;
    }

    .modal-content {
        padding: 15px;
    }
}
