/* Layout */
.app-layout {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 260px;
    background: linear-gradient(180deg, #0d6efd, #0b5ed7);
    color: #fff;
    display: flex;
    flex-direction: column;
    padding: 1.5rem 1rem;
}

.sidebar-header {
    display: flex;
    align-items: center;
    margin-bottom: 2rem;
}

.sidebar-logo {
    width: 40px;
    height: 40px;
    border-radius: 999px;
    background: rgba(255,255,255,0.15);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    margin-right: 0.75rem;
}

.sidebar-title {
    font-size: 1.2rem;
    font-weight: 600;
}

.sidebar-nav a {
    display: block;
    padding: 0.6rem 0.9rem;
    border-radius: 0.75rem;
    margin-bottom: 0.3rem;
    color: rgba(255,255,255,0.9);
    text-decoration: none;
    font-size: 0.95rem;
}

.sidebar-nav a:hover,
.sidebar-nav a.active {
    background: rgba(255,255,255,0.18);
}

.sidebar-footer {
    margin-top: auto;
    font-size: 0.8rem;
}

/* Main */
.main {
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* Topbar */
.topbar {
    height: 70px;
    background: #ffffff;
    border-bottom: 1px solid rgba(0,0,0,0.05);
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    padding: 0 2rem;
    position: sticky;
    top: 0;
    z-index: 10;
}

.topbar-center {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.top-logo-circle {
    width: 32px;
    height: 32px;
    border-radius: 999px;
    background: #0d6efd;
    margin-bottom: 2px;
}

.top-logo-text {
    font-weight: 600;
    font-size: 0.9rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: #444;
}

/* Login Card */
.login-card {
    max-width: 400px;
    width: 100%;
    border-radius: 1.5rem;
}

.logo-circle {
    width: 48px;
    height: 48px;
    border-radius: 999px;
    background: #0d6efd22;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Content */
.content {
    background: #f5f6fa;
}

/* Mobile: Sidebar is off-canvas (opened via toggle button). */

/* Dashboard & Produkte Erweiterungen */
.low-stock-row {
    padding: 0.35rem 0;
    border-bottom: 1px dashed rgba(0,0,0,0.06);
}
.low-stock-row:last-child {
    border-bottom: none;
}

.movement-list {
    max-height: 420px;
    overflow-y: auto;
}

.movement-row {
    padding: 0.25rem 0.15rem;
}

.scanner-frame {
    width: 100%;
    min-height: 220px;
    border-radius: 0.75rem;
    border: 1px dashed rgba(13, 110, 253, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8f9fa;
}

/* Extra compact tables/buttons for "viele Spalten" Ansichten */
.table-compact {
    font-size: 0.78rem;
}
.table-compact th,
.table-compact td {
    padding: 0.35rem 0.45rem;
    vertical-align: middle;
    white-space: nowrap;
}

.btn-xs {
    padding: 0.15rem 0.4rem;
    font-size: 0.75rem;
    line-height: 1.2;
}


/* Sidebar toggle button */
.sidebar-toggle {
    border-color: rgba(255,255,255,0.7);
}

/* Backdrop for sidebar on mobile */
.sidebar-backdrop {
    display: none;
}

/* Responsive layout for tablets & phones */
@media (max-width: 991.98px) {
    /* Prevent background scrolling when the off-canvas menu is open (important on iOS). */
    body.sidebar-open {
        overflow: hidden;
        touch-action: none;
    }

    .app-layout {
        flex-direction: column;
    }

    .sidebar {
        display: flex;
        position: fixed;
        top: 0;
        bottom: 0;
        left: 0;
        z-index: 1030;
        transform: translateX(-100%);
        transition: transform 0.25s ease-in-out;
        max-width: 80%;
        width: 260px;
        height: 100dvh;
        padding-top: calc(1.5rem + env(safe-area-inset-top));
    }

    body.sidebar-open .sidebar {
        transform: translateX(0);
    }

    .sidebar-backdrop {
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,0.4);
        z-index: 1020;
    }

    body.sidebar-open .sidebar-backdrop {
        display: block;
    }

    /* Prevent background scrolling when the menu is open (important on iOS). */
    body.sidebar-open {
        overflow: hidden;
        touch-action: none;
    }

    .topbar {
        padding: 0 1rem;
        grid-template-columns: auto 1fr auto;
    }

    .topbar-center {
        align-items: flex-start;
    }

    .content.container,
    .content.container-fluid {
        padding-left: 1rem;
        padding-right: 1rem;
    }
}

/* Make the toggle button clearly visible on phones */
@media (max-width: 991.98px) {
  .topbar .sidebar-toggle {
    background: #0d6efd;
    color: #fff;
    border-color: #0d6efd;
  }
}

@media (max-width: 576px) {
  h1, h2, h3 {
    font-size: 1.1rem;
  }
  .btn {
    width: 100%;
  }
}


/* Logo */
.app-logo {
  max-width: 220px;
  width: 70%;
  opacity: 0.9;
}

/* Dashboard fix */
.dashboard-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit,minmax(250px,1fr));
  gap: 1rem;
}

/* Mobile menu button */
.navbar-toggler {
  background-color: #0b5ed7 !important;
  border-color: #0a58ca;
}


/* (legacy menu-toggle removed – we use .sidebar-toggle + body.sidebar-open) */


/* Scanner width fix (match products.php) */
.scanner-card {
  max-width: 420px;
}

.scanner-frame {
  max-width: 100%;
}


/* Transfer layout = products.php width */
.transfer-wrapper {
  max-width: 640px;
}

.transfer-wrapper .form-control,
.transfer-wrapper .form-select,
.transfer-wrapper button {
  width: 100%;
}

.scanner-card {
  margin-left: auto;
  margin-right: auto;
}


/* Scanner page - match products layout */
#reader.scanner-frame {
  max-width: 420px;
  margin-left: auto;
  margin-right: auto;
}
