/* =========================================================
   GLOBAL THEME VARIABLES
========================================================= */
:root {
    --bg-app: #F2F2F7;
    --bg-card: #ffffff;
    --bg-light: #f7f7fa;
    --text-dark: #1c1c1e;
    --text-light: #555;

    --primary: #007AFF;
    --success: #34C759;
    --danger: #FF3B30;
    --grey: #e9e9ef;
    --shadow: rgba(0,0,0,0.08);
    --radius: 16px;
}

/* =========================================================
   GLOBAL BODY
========================================================= */
body {
    background: var(--bg-app);
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Helvetica Neue", sans-serif;
    color: var(--text-dark);
    margin: 0;
    padding: 0;
}

/* =========================================================
   HEADER
========================================================= */
.header-dashboard {
    background: #4a4a4a;
    color: #fff;
    padding: 20px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 4px 12px var(--shadow);
}

.header-dashboard .site-title {
    font-size: 1.8rem;
    font-weight: 700;
}

.header-dashboard .user-info {
    text-align: right;
}

.header-dashboard .user-info .welcome-text {
    font-size: 0.95rem;
    margin-bottom: 5px;
}

.header-dashboard .user-info a.btn {
    font-size: 0.85rem;
    padding: 5px 12px;
    border-radius: 12px;
    background: rgba(255,255,255,0.1);
    color: #fff;
    transition: all 0.25s ease;
}

.header-dashboard .user-info a.btn:hover {
    background: rgba(255,255,255,0.25);
}

/* Header responsive */
.header-dashboard .container {
    flex-wrap: wrap;
    text-align: center;
}

@media (max-width: 576px) {
    .header-dashboard .container {
        justify-content: center !important;
    }

    .header-dashboard h1.site-title {
        width: 100%;
        font-size: 1.3rem;
        margin-bottom: 10px;
    }

    .header-dashboard .user-info {
        width: 100%;
        justify-content: center;
    }

    .header-dashboard .welcome-text {
        font-size: 0.9rem;
    }

    .header-dashboard .btn {
        padding: 4px 8px;
        font-size: 0.8rem;
    }
}

/* =========================================================
   SEARCH BAR BLOCK
========================================================= */
.ios-header {
    background: var(--bg-card);
    padding: 20px;
    border-radius: var(--radius);
    box-shadow: 0 4px 12px var(--shadow);
    margin-bottom: 1.5rem;
}

.ios-search {
    border-radius: 12px !important;
    background: #f1f1f3;
    border: none;
    padding-left: 15px;
    height: 45px;
}

/* =========================================================
   IOS BUTTONS
========================================================= */
.ios-label {
    font-size: 0.85rem;
    opacity: 0.75;
}

.btn-ios {
    border-radius: 14px;
    padding: 8px 18px;
    font-weight: 600;
}

.btn-ios-primary {
    background: #007aff;
    color: white;
}

.btn-ios-danger {
    background: #ff3b30;
    color: white;
}

.btn-ios-success {
    background: #34c759;
    color: white;
}

/* =========================================================
   TABLE (LISTE DES VINS)
========================================================= */
.table-responsive {
    overflow-x: auto;
}

#wineListTable {
    min-width: 600px;
}

#wineListTable thead th {
    background: var(--bg-light);
    position: sticky;
    top: 0;
    z-index: 5;
    font-weight: 600;
}

#wineListTable tbody tr {
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: 0 2px 8px var(--shadow);
    transition: all 0.2s ease;
}

#wineListTable tbody tr:hover {
    background: #f9f9f9;
}

#wineListTable td {
    padding: 12px 15px;
}

/* =========================================================
   WINE CARDS MOBILE
========================================================= */
.wine-card {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
    padding: 12px;
    margin-bottom: 12px;
    cursor: pointer;
    border: 1px solid #e0e0e0;
    transition: box-shadow 0.2s, transform 0.2s;
}

.wine-card h5 {
    margin: 0 0 6px 0;
}

.wine-card p {
    margin: 2px 0;
    font-size: 0.9rem;
}

.wine-card .stock-badge {
    display: inline-block;
    background: #f1f1f1;
    border-radius: 8px;
    padding: 2px 6px;
    margin-right: 4px;
    font-size: 0.85em;
}

.wine-card:hover {
    background-color: #f9f9f9;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

/* =========================================================
   STOCK BADGES
========================================================= */
.stock-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 10px;
    background: var(--grey);
    font-size: .85rem;
    margin-bottom: 3px;
}

/* =========================================================
   PAGINATION
========================================================= */
.pagination {
    margin: 20px 0;
    justify-content: center;
}

.pagination .page-item .page-link {
    border-radius: 10px;
    margin: 0 4px;
    border: none;
    padding: 8px 14px;
    background: #f1f1f4;
    color: #333;
    transition: all .25s ease;
}

.pagination .page-item.active .page-link {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 4px 10px rgba(0,122,255,0.3);
}

.pagination .page-item .page-link:hover {
    background: #e5e5ea;
}

/* =========================================================
   MODAL
========================================================= */
.modal-backdrop.show {
    background-color: rgba(0,0,0,0.3);
}

.modal.fade .modal-dialog {
    transform: translateY(50px) scale(0.95);
    opacity: 0;
    transition: transform 0.35s ease-out, opacity 0.35s ease-out;
}

.modal.fade.show .modal-dialog {
    transform: translateY(0) scale(1);
    opacity: 1;
}

.ios-card {
    background: #fefefe;
    border-radius: 22px;
    box-shadow: 0 12px 30px rgba(0,0,0,0.08);
}

.ios-input {
    border-radius: 14px;
    padding: 10px 14px;
    background: #f7f7f7;
    border: 1px solid #e3e3e3;
}

.ios-input:focus {
    background: white;
    box-shadow: 0 0 0 3px rgba(0,122,255,0.25);
}

/* =========================================================
   IMAGE PREVIEW
========================================================= */
#imgPreview {
    border-radius: 15px;
    box-shadow: 0 4px 12px var(--shadow);
    max-height: 220px;
    width: 100%;
    object-fit: cover;
}

/* =========================================================
   STATISTICS CARDS
========================================================= */
#statsRow .col > div {
    background: var(--bg-card);
    padding: 20px;
    border-radius: 20px;
    box-shadow: 0 6px 20px rgba(0,0,0,0.05);
    transition: all 0.2s ease;
}

#statsRow .col > div:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.1);
}

#statsRow h4 {
    font-size: 1.5rem;
    margin-bottom: 0;
}

#statsRow small {
    color: var(--text-light);
}

/* =========================================================
   STOCK ADD / REMOVE BUTTONS
========================================================= */
#addStock,
.remove-stock {
    border-radius: 12px;
    padding: 6px 12px;
    font-size: 0.85rem;
}

/* Desktop grid */
.stock-grid {
    display: grid;
    grid-template-columns: 70px 50px 1fr 50px;
    gap: 8px;
    padding: 4px 0;
    align-items: center;
    border-bottom: 1px solid #eee;
}

/* Mobile grid */
.stock-grid-mobile {
    display: grid;
    grid-template-columns: 60px 40px 1fr;
    gap: 6px;
    padding: 3px 0;
    border-bottom: 1px solid #f2f2f2;
}

.stock-head {
    font-weight: bold;
    color: #555;
}

.stock-line {
    display: flex;
    align-items: center;
}

.stock-mobile-line {
    margin-bottom: 4px;
}

.stock-badge {
    background: #eee;
    padding: 3px 7px;
    border-radius: 6px;
    font-size: 0.85rem;
}

.wine-card .stock-inventory {
    margin-top: 0.5rem;
}

.section-title {
    font-size: 0.85rem;
    font-weight: 600;
    opacity: 0.6;
    margin-bottom: 6px;
    padding-left: 2px;
}

.section-block {
    background: #ffffff;
    border-radius: 18px;
    padding: 15px;
    border: 1px solid #efefef;
}
/* Autocomplete menu au-dessus du modal */
.ui-autocomplete {
    z-index: 2000 !important;
    max-height: 200px;
    overflow-y: auto;
    overflow-x: hidden;
}


#wineListTable .badge {
    font-size: 0.8rem;
}

.stock-item {
    font-size: 0.85rem;
    border: 1px solid #e0e0e0;
    background-color: #f9f9f9;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
}

.stock-item:hover {
    background-color: #e9ecef;
}

.removeBtn {
    font-size: 0.75rem;
    padding: 0.2rem 0.5rem;
}