/* =============================================================
   Olde Tool Workshop — Left Sidebar Navigation
   - Desktop (≥768px): Permanent sidebar, content pushed right
   - Mobile  (<768px): Off-canvas drawer with hamburger toggle
   ============================================================= */

/* Remove Bootstrap body padding added by navbar-fixed-top */
body {
    padding-top: 0 !important;
}

/* =============================================================
   SIDEBAR PANEL — base styles (mobile-first, off-canvas)
   ============================================================= */
.otw-sidebar {
    position: fixed;
    top: 0;
    left: -210px;
    width: 189px;
    height: 100vh;
    background-image: url('/img/wood-sidebar.png');
    background-size: cover;
    background-position: center top;
    background-color: #e2d5be; /* fallback if image fails */
    color: #1a1a1a;
    z-index: 1200;
    overflow-y: auto;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    transition: left 0.3s cubic-bezier(0.23, 1, 0.32, 1);
    box-shadow: 4px 0 15px rgba(0, 0, 0, 0.3);
}

.otw-sidebar.open {
    left: 0;
}

/* =============================================================
   SIDEBAR HEADER (brand + close button)
   ============================================================= */
.otw-sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 16px;
    background: rgba(0, 0, 0, 0.12);
    border-bottom: 1px solid rgba(0, 0, 0, 0.15);
    flex-shrink: 0;
}

.otw-sidebar-brand {
    color: #1a1a1a;
    font-size: 1.5rem;
    font-weight: 700;
    text-decoration: none;
    letter-spacing: 0.5px;
    line-height: 1.3;
    flex: 1;
}

.otw-sidebar-brand:hover,
.otw-sidebar-brand:focus {
    color: #0085a1;
    text-decoration: none;
}

.otw-sidebar-close {
    background: none;
    border: none;
    color: rgba(0, 0, 0, 0.45);
    font-size: 1.1rem;
    cursor: pointer;
    padding: 4px 6px;
    margin-left: 8px;
    line-height: 1;
    border-radius: 3px;
    transition: color 0.2s ease, background 0.2s ease;
}

.otw-sidebar-close:hover,
.otw-sidebar-close:focus {
    color: #1a1a1a;
    background: rgba(0, 0, 0, 0.1);
    outline: none;
}

/* =============================================================
   SIDEBAR NAV LINKS
   ============================================================= */
.otw-sidebar-nav {
    list-style: none;
    padding: 12px 0;
    margin: 0;
    flex: 1;
}

.otw-sidebar-nav li a {
    display: flex;
    align-items: center;
    padding: 11px 18px;
    color: rgba(0, 0, 0, 0.72);
    text-decoration: none;
    font-size: 1.38rem;
    font-weight: 600;
    letter-spacing: 0.8px;
    text-transform: uppercase;
    border-left: 3px solid transparent;
    transition: all 0.2s ease;
    gap: 8px;
}

.otw-sidebar-nav li a i {
    width: 16px;
    text-align: center;
    font-size: 0.82rem;
    opacity: 0.6;
    flex-shrink: 0;
    transition: opacity 0.2s ease;
}

.otw-sidebar-nav li a:hover,
.otw-sidebar-nav li a:focus {
    color: #1a1a1a;
    background: rgba(0, 0, 0, 0.08);
    border-left-color: #0085a1;
    padding-left: 22px;
    text-decoration: none;
}

.otw-sidebar-nav li a:hover i,
.otw-sidebar-nav li a:focus i {
    opacity: 1;
}

/* Divider before search */
.otw-sidebar-nav li:last-child {
    margin-top: 8px;
    border-top: 1px solid rgba(0, 0, 0, 0.12);
    padding-top: 8px;
}

/* =============================================================
   HAMBURGER TOGGLE BUTTON (mobile only)
   ============================================================= */
.otw-sidebar-toggle {
    position: fixed;
    top: 16px;
    left: 16px;
    z-index: 1100;
    background: rgba(0, 0, 0, 0.45);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 4px;
    padding: 9px 11px;
    cursor: pointer;
    transition: background 0.2s ease;
}

.otw-sidebar-toggle:hover,
.otw-sidebar-toggle:focus {
    background: rgba(0, 133, 161, 0.75);
    outline: none;
}

.otw-sidebar-toggle .icon-bar {
    display: block;
    width: 22px;
    height: 2px;
    background-color: #fff;
    border-radius: 1px;
    transition: all 0.25s ease;
}

.otw-sidebar-toggle .icon-bar + .icon-bar {
    margin-top: 5px;
}

/* Animate hamburger → X when drawer is open */
body.otw-sidebar-open .otw-sidebar-toggle .icon-bar:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}
body.otw-sidebar-open .otw-sidebar-toggle .icon-bar:nth-child(2) {
    opacity: 0;
    transform: scaleX(0);
}
body.otw-sidebar-open .otw-sidebar-toggle .icon-bar:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

/* =============================================================
   OVERLAY (mobile only)
   ============================================================= */
.otw-sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 1150;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.otw-sidebar-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

/* =============================================================
   DESKTOP (≥768px) — Permanent sidebar, content pushed right
   ============================================================= */
@media (min-width: 768px) {

    /* Sidebar always visible — no animation needed */
    .otw-sidebar {
        left: 0;
        box-shadow: 2px 0 10px rgba(0, 0, 0, 0.2);
        transition: none;
    }

    /* Push all page content to the right of the sidebar */
    body {
        margin-left: 189px !important;
        padding-top: 0 !important;
    }

    /* Hide hamburger toggle on desktop */
    .otw-sidebar-toggle {
        display: none;
    }

    /* Hide close button on desktop */
    .otw-sidebar-close {
        display: none;
    }

    /* Overlay never needed on desktop */
    .otw-sidebar-overlay {
        display: none !important;
    }
}

/* =============================================================
   VERY SMALL MOBILE (<480px) — Wider drawer
   ============================================================= */
@media (max-width: 479px) {
    .otw-sidebar {
        width: 88vw;
        left: -92vw;
    }
    .otw-sidebar.open {
        left: 0;
    }
}
