/* ================================================
   STYLE GLOBAL - COLLECTION WHISKY
   ================================================ */

body {
    background-color: #fdfaf5;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    color: #3b2f2f;
    margin: 0;
    min-height: 100vh;
}

/* ================================================
   LAYOUT PRINCIPAL
   ================================================ */

.layout-wrapper {
    display: flex;
    min-height: 100vh;
}

.content-area {
    flex: 1;
    margin-left: 240px;
    transition: margin-left 0.3s ease;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.content-area.sidebar-collapsed {
    margin-left: 60px;
}

.main-content {
    flex: 1;
    padding: 30px 40px;
}

/* ================================================
   SIDEBAR DESKTOP
   ================================================ */

/* État collapsed appliqué immédiatement via <html> class (anti-flash) */
html.sidebar-is-collapsed .sidebar-desktop {
    width: 60px;
}

html.sidebar-is-collapsed .content-area {
    margin-left: 60px;
}

html.sidebar-is-collapsed .site-footer {
    margin-left: 60px;
}

html.sidebar-is-collapsed .sidebar-logo-full {
    display: none;
}

html.sidebar-is-collapsed .sidebar-logo-mini {
    display: block;
}

html.sidebar-is-collapsed .nav-label,
html.sidebar-is-collapsed .sidebar-user .nav-label {
    opacity: 0;
    width: 0;
    overflow: hidden;
}

html.sidebar-is-collapsed .sidebar-nav li {
    margin: 2px 4px;
}

html.sidebar-is-collapsed .sidebar-nav-link {
    justify-content: center;
    padding: 10px 8px;
    gap: 0;
}

html.sidebar-is-collapsed .sidebar-toggle i {
    transform: rotate(180deg);
}

html.sidebar-is-collapsed .sidebar-avatar {
    width: 30px !important;
    height: 30px !important;
    max-width: 30px;
    max-height: 30px;
}

.sidebar-desktop {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 240px;
    background-color: #fdfaf5;
    border-right: 1px solid #d1bfa8;
    display: flex;
    flex-direction: column;
    z-index: 1000;
    transition: width 0.3s ease;
    overflow: hidden;
}

.sidebar-desktop.collapsed {
    width: 60px;
}

/* Logo sidebar */
.sidebar-desktop .sidebar-logo {
    padding: 20px 16px;
    border-bottom: 1px solid #d1bfa8;
    text-align: center;
}

.sidebar-desktop .sidebar-logo a {
    text-decoration: none;
}

.sidebar-desktop .sidebar-logo-full {
    display: block;
    margin: 0 auto;
    transition: opacity 0.2s;
}

.sidebar-desktop .sidebar-logo-mini {
    display: none;
    margin: 0 auto;
}

.sidebar-desktop.collapsed .sidebar-logo-full {
    display: none;
}

.sidebar-desktop.collapsed .sidebar-logo-mini {
    display: block;
}

/* Navigation sidebar */
.sidebar-nav {
    list-style: none;
    padding: 12px 0;
    margin: 0;
    flex: 1;
}

.sidebar-nav li {
    margin: 2px 8px;
}

.sidebar-nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    color: #5b3a29;
    text-decoration: none;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 500;
    transition: all 0.2s ease;
    white-space: nowrap;
    overflow: hidden;
}

.sidebar-nav-link:hover {
    background-color: #f0e6d8;
    color: #3b2213;
}

.sidebar-nav-link.active {
    background-color: #8c5c3b;
    color: #fff;
}

.sidebar-nav-link.active:hover {
    background-color: #a46a46;
    color: #fff;
}

.sidebar-nav-link i {
    font-size: 1.2rem;
    min-width: 22px;
    text-align: center;
    flex-shrink: 0;
}

/* Labels masqués quand collapsed */
.sidebar-desktop.collapsed .nav-label {
    opacity: 0;
    width: 0;
    overflow: hidden;
}

.sidebar-desktop.collapsed .sidebar-nav li {
    margin: 2px 4px;
}

.sidebar-desktop.collapsed .sidebar-nav-link {
    justify-content: center;
    padding: 10px 8px;
    gap: 0;
}

/* Footer sidebar (user + déconnexion) */
.sidebar-footer {
    padding: 12px 8px;
    border-top: 1px solid #d1bfa8;
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 14px;
    color: #7c6a58;
    font-size: 0.85rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
}

.sidebar-user i {
    font-size: 1.3rem;
    min-width: 22px;
    text-align: center;
    flex-shrink: 0;
}

.sidebar-desktop.collapsed .sidebar-user .nav-label {
    opacity: 0;
    width: 0;
}

.logout-link {
    color: #9c6b5a !important;
    font-size: 0.9rem;
}

.logout-link:hover {
    background-color: #f5e0d0 !important;
    color: #6b3a2a !important;
}

/* Avatar dans la sidebar */
.sidebar-avatar {
    width: 50px !important;
    height: 50px !important;
    max-width: 50px;
    max-height: 50px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #d1bfa8;
    flex-shrink: 0;
}

.sidebar-desktop.collapsed .sidebar-avatar {
    width: 30px !important;
    height: 30px !important;
    max-width: 30px;
    max-height: 30px;
}

/* Bouton toggle sidebar */
.sidebar-toggle {
    position: absolute;
    bottom: 80px;
    right: -14px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #8c5c3b;
    color: white;
    border: 2px solid #fdfaf5;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.75rem;
    transition: all 0.3s ease;
    z-index: 1001;
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}

.sidebar-toggle:hover {
    background: #a46a46;
    transform: scale(1.1);
}

.sidebar-desktop.collapsed .sidebar-toggle i {
    transform: rotate(180deg);
}

/* ================================================
   NAVBAR MOBILE
   ================================================ */

.navbar-mobile {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 56px;
    background-color: #fdfaf5;
    border-bottom: 1px solid #d1bfa8;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    z-index: 1050;
}

.navbar-mobile-logo img {
    height: 36px;
}

.navbar-mobile-burger {
    background: none;
    border: none;
    color: #5b3a29;
    font-size: 1.6rem;
    padding: 4px 8px;
    cursor: pointer;
    border-radius: 6px;
    transition: background 0.2s;
}

.navbar-mobile-burger:hover {
    background-color: #f0e6d8;
}

/* Offcanvas mobile */
.sidebar-offcanvas {
    background-color: #fdfaf5 !important;
    width: 280px !important;
}

.sidebar-offcanvas .offcanvas-header {
    border-bottom: 1px solid #d1bfa8;
    padding: 16px 20px;
}

.sidebar-offcanvas .sidebar-logo img {
    height: 40px;
}

.sidebar-offcanvas .btn-close-white {
    filter: invert(35%) sepia(20%) saturate(600%) hue-rotate(340deg);
}

.sidebar-offcanvas .sidebar-nav {
    padding: 8px 0;
}

.sidebar-offcanvas .sidebar-nav li {
    margin: 2px 12px;
}

.sidebar-offcanvas .sidebar-footer {
    margin-top: auto;
}

/* ================================================
   HEADER WHISKY
   ================================================ */

.header-whisky {
    position: relative;
    background: url('/assets/img/header-whisky.png') no-repeat center center;
    background-size: cover;
    height: 350px;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
}

.header-whisky .overlay {
    position: absolute;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.45);
    z-index: 1;
}

.header-whisky .top-bar {
    position: relative;
    z-index: 2;
    height: 80px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 40px;
}

.header-whisky .logo img {
    max-height: 140px;
}

.header-whisky .user-info {
    color: white;
    font-weight: bold;
    white-space: nowrap;
}

.header-whisky .header-content {
    position: relative;
    z-index: 2;
    padding: 20px 50px;
    color: #f5e8d8;
}

.header-whisky h1 {
    font-size: 2.6rem;
    margin-bottom: 0.4rem;
}

.header-whisky p {
    font-size: 1.2rem;
}

/* Header cliquable */
.header-link {
    display: flex;
    flex-direction: column;
    height: 100%;
    width: 100%;
    text-decoration: none;
    color: inherit;
}

.header-whisky .header-link:hover {
    opacity: 0.96;
    transition: opacity 0.25s ease;
}

.header-whisky .header-link:hover .logo img {
    filter: brightness(1.12);
    transform: scale(1.04) translateY(-4px);
    transition: all 0.25s ease;
}

.header-whisky:has(.header-link) {
    cursor: pointer;
}

/* ================================================
   LOGIN SPÉCIFIQUE
   ================================================ */

body.login-page .layout-wrapper {
    display: block;
}

body.login-page .sidebar-desktop {
    display: none !important;
}

body.login-page .navbar-mobile {
    display: none !important;
}

body.login-page .content-area {
    margin-left: 0;
}

body.login-page .header-whisky {
    height: 250px;
}

body.login-page .header-content {
    display: none;
}

body.login-page .header-link {
    pointer-events: none;
}

.login-wrapper {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.login-card {
    width: 100%;
    max-width: 420px;
    border: 1px solid #d1bfa8;
    border-radius: 10px;
    box-shadow: 0 8px 30px rgba(91,58,41,0.15);
}

.login-card .card-header {
    border-bottom: none;
}

.login-card input.form-control {
    background: #fffaf5;
    border: 1px solid #c5b7a5;
}

.login-card input.form-control:focus {
    border-color: #8c5c3b;
    box-shadow: 0 0 0 0.25rem rgba(140,92,59,0.2);
}

/* ================================================
   BOUTONS
   ================================================ */

.btn-primary {
    background-color: #8c5c3b;
    border-color: #8c5c3b;
}

.btn-primary:hover {
    background-color: #a46a46;
}

.btn-whisky {
    background-color: #6b4b3a;
    color: white;
    border: none;
    transition: all 0.25s;
}

.btn-whisky:hover {
    background-color: #835a43;
    transform: translateY(-2px);
}

/* ================================================
   TABLEAUX
   ================================================ */

.table thead.table-dark {
    background-color: #6f4e37;
    color: white;
}

.table-hover tbody tr {
    cursor: pointer;
    transition: background-color 0.15s;
}

.table-hover tbody tr:hover {
    background-color: #f8f1e7 !important;
}

.photo-mini-table {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 6px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.1);
}

/* ================================================
   BADGES & TEXTE
   ================================================ */

.badge.bg-whisky {
    background-color: #8c5c3b;
    font-weight: 500;
}

.whisky-text {
    color: #5b3a29;
}

/* ================================================
   FOOTER
   ================================================ */

.site-footer {
    padding: 1.2rem;
    background: #f8f1e7;
    border-top: 1px solid #d1bfa8;
    color: #7c6a58;
    font-size: 0.9rem;
    text-align: center;
    margin-left: 240px;
    transition: margin-left 0.3s ease;
}

/* Footer s'adapte à la sidebar collapsed */
.sidebar-desktop.collapsed ~ .content-area + .site-footer,
body:has(.sidebar-desktop.collapsed) .site-footer {
    margin-left: 60px;
}

/* ================================================
   FICHE BOUTEILLE
   ================================================ */

.fiche-principale {
    cursor: pointer;
    transition: transform 0.2s;
}

.fiche-principale:hover {
    transform: scale(1.02);
}

.photo-mini {
    cursor: pointer;
    transition: transform 0.2s;
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 6px;
}

.photo-mini:hover {
    transform: scale(1.1);
}

.photo-principale {
    position: absolute;
    top: 8px;
    left: 8px;
    background: rgba(108, 75, 58, 0.9);
    color: white;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: bold;
}

/* ================================================
   RESPONSIVE
   ================================================ */

/* Mobile : pas de sidebar desktop, contenu pleine largeur */
@media (max-width: 991.98px) {
    .content-area {
        margin-left: 0 !important;
    }

    .site-footer {
        margin-left: 0 !important;
    }

    /* Espace pour la navbar fixe mobile */
    .layout-wrapper {
        padding-top: 56px;
    }

    .header-whisky {
        height: 200px;
        background-attachment: scroll;
        background-position: center 55%;
    }

    .header-whisky .logo img {
        max-height: 80px;
    }

    .header-whisky h1 {
        font-size: 1.6rem;
    }

    .header-whisky p {
        font-size: 0.95rem;
    }

    .header-whisky .header-content {
        padding: 12px 20px;
    }

    .main-content {
        padding: 20px 16px;
    }
}

/* Tablette */
@media (min-width: 992px) and (max-width: 1199.98px) {
    .main-content {
        padding: 25px 30px;
    }
}