/* Variables */
:root {
    --primary-color: #000000; /* Noir */
    --secondary-color: #ffffff; /* Blanc */
    --background-color: #000000; /* Fond noir */
    --text-color: #ffffff; /* Texte blanc */
    --dark-color: #111111; /* Nuance de noir */
    --light-color: #f8f9fa; /* Nuance de blanc */
    --gray-color: #6c757d; /* Gris (proche du noir/blanc) */
    --border-color: #dee2e6; /* Gris clair (proche du blanc) */
    --shadow: 0 0.25rem 1rem rgba(0, 0, 0, 0.15);
    --radius: 0.5rem; /* Bordures plus arrondies pour un look moderne */
    --font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
}

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

body {
    font-family: var(--font-family);
    font-size: 16px;
    line-height: 1.5;
    color: var(--text-color);
    background-color: var(--background-color);
    background-image: url('/assets/img/logoDada.png');
    background-size: 50%;
    background-position: center;
    background-repeat: no-repeat;
    background-attachment: fixed;
    position: relative;
}

body::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: -1;
}

a {
    color: var(--secondary-color);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* Layout */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background-color: var(--primary-color);
    color: var(--text-color);
    box-shadow: var(--shadow);
}

.logo {
    font-size: 1.5rem;
    font-weight: bold;
}

nav ul {
    display: flex;
    list-style: none;
}

nav ul li {
    margin-left: 1rem;
}

main {
    padding: 0;
}

/* Disposition pour la caisse */
.pos-container {
    display: flex;
    height: calc(100vh - 60px);
    max-width: 100%;
    width: 100%;
    margin: 0;
}

/* Sidebar gauche pour les catégories */
.category-sidebar {
    width: 200px;
    background-color: var(--dark-color);
    padding: 1rem;
    overflow-y: auto;
    border-right: 1px solid var(--border-color);
}

.categories {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.category {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    width: 100%;
    padding: 0.75rem;
    border: none;
    border-radius: 10px;
    background: linear-gradient(135deg, #333, #444);
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    color: var(--text-color);
    font-size: 1rem;
}

.category:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.5);
    background: linear-gradient(135deg, #444, #555);
}

.category.active {
    background: var(--primary-color);
    color: var(--secondary-color);
}

.category-name {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.2em;
    max-height: 2.4em;
}

/* Zone centrale pour les produits */
.product-main {
    flex: 1;
    padding: 1rem;
    overflow-y: auto;
    background-color: var(--background-color);
}

.products {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
}

.product {
    display: flex;
    flex-direction: column;
    padding: 1rem;
    height: 160px;
    border: none;
    border-radius: 10px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    background: var(--light-color);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    justify-content: space-between;
}

.product:hover {
    transform: scale(1.05);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
}

.product-name {
    margin-bottom: 0.5rem;
    font-weight: bold;
    font-size: 1rem;
    flex-grow: 1;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.2em;
    max-height: 2.4em;
}

.product-price {
    color: var(--primary-color);
    font-weight: bold;
    padding: 0.25rem 0;
    border-top: 1px solid var(--border-color);
    font-size: 1rem;
}

/* Zone centrale pour la gestion des tickets */
.center {
    width: 40%;
    background: var(--background-color);
    padding: 20px;
    overflow-y: auto;
}

.center h2 {
    font-size: 1.8em;
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 20px;
    font-weight: 700;
    text-align: center;
    color: var(--text-color);
}

.search-bar {
    display: flex;
    align-items: center;
    margin-bottom: 15px;
}

.search-bar input {
    width: 75%;
    background: var(--light-color);
    color: var(--primary-color);
    border: none;
    padding: 12px;
    font-size: 1em;
}

.search-bar .search-btn {
    width: 25%;
    background: var(--light-color);
    color: var(--primary-color);
    border: none;
    padding: 12px;
    font-size: 1.2em;
    cursor: pointer;
}

.search-bar .search-btn:hover {
    background: var(--gray-color);
}

.shift-buttons {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.shift-buttons button {
    flex: 1;
    background: var(--light-color);
    color: var(--primary-color);
    border: none;
    padding: 10px;
    font-size: 1em;
    cursor: pointer;
    transition: background 0.1s ease;
}

.shift-buttons button:hover {
    background: var(--gray-color);
}

.ticket-list {
    color: var(--text-color);
}

/* Sidebar droite pour Table, Client, Panier, Paiement */
.action-sidebar {
    width: 300px;
    background-color: var(--dark-color);
    padding: 1rem;
    overflow-y: auto;
    border-left: 1px solid var(--border-color);
}

.order-details {
    margin-bottom: 1rem;
}

.cart {
    margin-top: 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    background-color: var(--light-color);
    box-shadow: var(--shadow);
}

.cart h2 {
    padding: 0.75rem;
    background-color: var(--primary-color);
    color: var(--text-color);
    border-top-left-radius: var(--radius);
    border-top-right-radius: var(--radius);
}

.cart-items {
    padding: 0.75rem;
    max-height: 300px;
    overflow-y: auto;
}

.cart-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem;
    margin-bottom: 0.5rem;
    border-radius: var(--radius);
    background-color: var(--light-color);
    transition: all 0.2s ease;
    cursor: move;
}

.cart-item:hover {
    background-color: var(--gray-color);
}

.cart-item.selected {
    background-color: #e0e0e0;
}

.cart-item-info {
    flex: 1;
}

.cart-item-price {
    margin-left: 1rem;
    font-weight: bold;
}

.cart-item-actions {
    margin-left: 1rem;
}

.cart-total, .selected-items-total {
    display: flex;
    justify-content: space-between;
    padding: 0.75rem;
    background-color: var(--primary-color);
    color: var(--text-color);
    font-weight: bold;
    border-bottom-left-radius: var(--radius);
    border-bottom-right-radius: var(--radius);
}

.payment-section {
    margin-top: 1.5rem;
}

.payment-section h2 {
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--primary-color);
    color: var(--text-color);
}

.search-ticket {
    margin-bottom: 1rem;
}

.payment-options {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    visibility: visible;
}

.payment-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1rem 0.5rem;
    text-align: center;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    background-color: var(--light-color);
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: var(--shadow);
    color: var(--primary-color);
}

.payment-option i {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    color: var(--primary-color); /* Icônes en noir */
}

.payment-option:hover {
    transform: translateY(-3px);
    box-shadow: 0 0.5rem 1.5rem rgba(0, 0, 0, 0.1);
}

.payment-option.active {
    background-color: var(--primary-color);
    color: var(--text-color);
    border-color: var(--primary-color);
}

.payment-details {
    margin-bottom: 1.5rem;
    padding: 1.5rem;
    border-radius: var(--radius);
    background-color: var(--light-color);
    box-shadow: var(--shadow);
}

.payment-input {
    display: flex;
    align-items: center;
    margin-bottom: 0.75rem;
}

.payment-input label {
    flex: 0 0 120px;
    margin-bottom: 0;
    color: var(--primary-color);
}

.payment-input input {
    flex: 1;
    background: var(--light-color);
    color: var(--primary-color);
    border: 1px solid var(--border-color);
}

.preset-amounts {
    margin-top: 1rem;
}

.preset-amount-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

/* Autocomplete */
.autocomplete {
    position: relative;
}

.autocomplete-items {
    position: absolute;
    z-index: 999;
    top: 100%;
    left: 0;
    right: 0;
    max-height: 200px;
    overflow-y: auto;
    background-color: var(--light-color);
    border: 1px solid var(--border-color);
    border-top: none;
    border-radius: 0 0 var(--radius) var(--radius);
    box-shadow: var(--shadow);
}

.autocomplete-item {
    padding: 0.75rem;
    cursor: pointer;
    border-bottom: 1px solid var(--border-color);
    color: var(--primary-color);
}

.autocomplete-item:last-child {
    border-bottom: none;
}

.autocomplete-item:hover {
    background-color: var(--gray-color);
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    overflow: auto;
}

.modal-content {
    position: relative;
    margin: 10% auto;
    padding: 1.5rem;
    width: 90%;
    max-width: 600px;
    background-color: var(--light-color);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    animation: modalFadeIn 0.3s;
}

@keyframes modalFadeIn {
    from { opacity: 0; transform: translateY(-50px); }
    to { opacity: 1; transform: translateY(0); }
}

.modal-close {
    position: absolute;
    top: 0.5rem;
    right: 1rem;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--gray-color);
    transition: color 0.2s;
}

.modal-close:hover {
    color: var(--primary-color);
}

.modal-actions {
    margin-top: 1.5rem;
    text-align: right;
}

.modal-actions .btn {
    margin-left: 0.5rem;
}

/* Ticket Styling */
.ticket {
    font-family: monospace;
    width: 300px;
    margin: 0 auto;
    padding: 10px;
    border: 1px dashed var(--primary-color);
    background: var(--light-color);
}

.ticket-header, .ticket-footer {
    text-align: center;
    margin: 10px 0;
}

.ticket-header h2 {
    font-size: 1.5rem;
    margin: 5px 0;
    color: var(--primary-color);
}

.ticket-item {
    display: flex;
    justify-content: space-between;
    margin: 5px 0;
    font-size: 0.9rem;
    color: var(--primary-color);
}

.ticket-item.paid {
    text-decoration: line-through;
    color: var(--gray-color);
}

.ticket-total {
    border-top: 2px solid var(--primary-color);
    margin-top: 10px;
    padding-top: 10px;
    font-weight: bold;
    display: flex;
    justify-content: space-between;
    color: var(--primary-color);
}

.ticket-payment h3 {
    margin: 10px 0 5px;
    font-size: 1rem;
    color: var(--primary-color);
}

.ticket-footer p {
    font-size: 0.9rem;
    font-style: italic;
    color: var(--primary-color);
}

/* Virtual Keyboard */
.virtual-keyboard {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background-color: var(--light-color);
    padding: 10px;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    display: none;
    transition: transform 0.3s ease;
}

.keyboard-row {
    display: flex;
    justify-content: center;
    margin-bottom: 5px;
}

.keyboard-key {
    flex: 1;
    min-width: 40px;
    height: 40px;
    margin: 2px;
    background-color: var(--light-color);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    user-select: none;
    font-size: 1rem;
    color: var(--primary-color);
}

.keyboard-key:hover {
    background-color: var(--gray-color);
}

.keyboard-key.large {
    flex: 2;
}

.keyboard-key.extra-large {
    flex: 3;
}

.keyboard-key.active {
    background-color: var(--gray-color);
}

.keyboard-close {
    position: absolute;
    top: 5px;
    right: 10px;
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: var(--gray-color);
}

/* Styles pour la partie admin */
.admin-container {
    display: flex;
    height: calc(100vh - 60px);
    max-width: 100%;
    width: 100%;
    margin: 0;
}

.admin-sidebar {
    width: 200px;
    background-color: var(--dark-color);
    padding: 1rem;
    overflow-y: auto;
    border-right: 1px solid var(--border-color);
}

.admin-sidebar ul {
    list-style: none;
}

.admin-sidebar li {
    margin-bottom: 0.5rem;
}

.admin-sidebar a {
    display: flex;
    align-items: center;
    padding: 0.75rem;
    color: var(--text-color);
    background: linear-gradient(135deg, #333, #444);
    border-radius: 10px;
    transition: all 0.2s ease;
}

.admin-sidebar a:hover {
    background: linear-gradient(135deg, #444, #555);
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.5);
}

.admin-sidebar a.active {
    background: var(--primary-color);
    color: var(--secondary-color);
}

.admin-sidebar i {
    margin-right: 0.5rem;
    color: var(--text-color);
}

.admin-content {
    flex: 1;
    padding: 2rem;
    overflow-y: auto;
    background-color: rgba(255, 255, 255, 0.05);
    color: var(--text-color);
}

.admin-content h1 {
    margin-bottom: 1.5rem;
    font-size: 1.8rem;
    color: var(--text-color);
}

.dashboard-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.card {
    background: linear-gradient(135deg, #333, #444);
    padding: 1.5rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    text-align: center;
    color: var(--text-color);
    transition: transform 0.2s ease;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
}

.card-title {
    font-size: 1rem;
    margin-bottom: 0.5rem;
    color: var(--gray-color);
}

.card-value {
    font-size: 1.5rem;
    font-weight: bold;
    margin-bottom: 0.5rem;
    color: var(--text-color);
}

.card-footer {
    font-size: 0.8rem;
    color: var(--gray-color);
}

.recent-sales, .stock-alerts, .stock-inventory, .client-credit-list {
    background: linear-gradient(135deg, #333, #444);
    padding: 1.5rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.recent-sales h2, .stock-alerts h2, .stock-inventory h2, .client-credit-list h2 {
    margin-bottom: 1rem;
    color: var(--text-color);
}

.client-credit-item {
    background: #222;
    padding: 1rem;
    margin-bottom: 1rem;
    border-radius: var(--radius);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.client-credit-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}

.client-credit-name {
    font-weight: bold;
    color: var(--text-color);
}

.client-credit-amount {
    color: var(--gray-color);
}

.client-credit-actions {
    display: flex;
    gap: 0.5rem;
}

/* Responsive */
@media (max-width: 1024px) {
    .pos-container {
        flex-direction: column;
        height: auto;
    }

    .category-sidebar, .action-sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
    }

    .category-sidebar {
        order: -1;
    }

    .products {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }

    .admin-container {
        flex-direction: column;
    }

    .admin-sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
    }
}

@media (max-width: 768px) {
    .category-sidebar {
        padding: 0.5rem;
    }

    .categories {
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
        gap: 0.5rem;
    }

    .category {
        flex-direction: column;
        justify-content: center;
        height: 80px;
        font-size: 0.9rem;
    }

    .products {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    }

    .action-sidebar {
        padding: 0.5rem;
        position: sticky;
        bottom: 0;
        background: var(--dark-color);
        z-index: 10;
    }

    .cart {
        max-height: 200px;
    }

    .payment-options {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    }

    .virtual-keyboard {
        padding: 5px;
    }

    .keyboard-key {
        min-width: 12vw;
        height: 12vw;
        font-size: 1rem;
    }
}

@media (max-width: 480px) {
    header {
        flex-direction: column;
        padding: 0.5rem;
    }

    nav ul {
        margin-top: 0.5rem;
        flex-wrap: wrap;
        justify-content: center;
    }

    nav ul li {
        margin: 0.25rem;
    }

    .products {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    }

    .product {
        height: 100px;
        font-size: 0.9rem;
    }

    .keyboard-key {
        min-width: 10vw;
        height: 10vw;
        font-size: 0.9rem;
    }
}