/*
|--------------------------------------------------------------------------
| File: public/assets/css/layout.css
|--------------------------------------------------------------------------
*/

.app-shell{
  min-height: 100vh;
  display: flex;
}

.sidebar{
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border-color);
  padding: 20px 16px;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  overflow-y: auto;
  z-index: 1100;
  transition: transform 0.25s ease;
}

.sidebar-brand{
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 24px;
}

.sidebar-nav{
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.sidebar-nav a{
  display: block;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
}

.sidebar-nav a:hover{
  background: #F9FAFB;
  color: var(--text-primary);
  text-decoration: none;
}

.sidebar-nav a.active{
  background: var(--accent-soft);
  color: var(--text-primary);
  font-weight: 600;
}

.app-main{
  flex: 1;
  margin-left: var(--sidebar-width);
  min-width: 0;
}

.topbar{
  height: var(--topbar-height);
  background: #EEE1C9;
  border-bottom: 1px solid #E3CFA6;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  gap: 16px;
}

.topbar-left{
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 0 0 auto;
  min-width: 0;
}

.topbar-center{
  flex: 1 1 auto;
  display: flex;
  justify-content: center;
  min-width: 0;
  padding: 0 20px;
}

.topbar-right{
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 0 0 auto;
  margin-left: 0;
}

.topbar-title{
  font-size: 16px;
  font-weight: 700;
}

.topbar-user{
  color: var(--text-secondary);
  font-size: 13px;
  text-align: right;
}

.sidebar-toggle{
  display: none; /* hidden by default (desktop) */
  width: 40px;
  height: 40px;
  border: 1px solid var(--border-color);
  background: #fff;
  border-radius: 10px;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  line-height: 1;
}

.topbar-toggle{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border: none;
  background: transparent;
  color: var(--text-primary);
  cursor: pointer;
  padding: 0;
  box-shadow: none;
  outline: none;
}

.topbar-toggle:hover{
  background: transparent;
}

.topbar-toggle:focus,
.topbar-toggle:focus-visible{
  outline: none;
  box-shadow: none;
}

.topbar-toggle svg{
  width: 24px;
  height: 24px;
  display: block;
}

.content-wrap{
  padding: 20px;
}

.content-inner{
  max-width: var(--content-max-width);
  margin: 0 auto;
}

.sidebar-overlay{
  display: none;
}

.mobile-only{
  display: none;
}

.desktop-only{
  display: block;
}

.desktop-sidebar-toggle{
  display: none;
}

@media (max-width: 992px){
  .sidebar{
    transform: translateX(-100%);
    width: min(280px, 86vw);
    box-shadow: 0 10px 30px rgba(0,0,0,0.12);
  }

  body.sidebar-open .sidebar{
    transform: translateX(0);
  }

  .app-main{
    margin-left: 0;
  }

  .sidebar-toggle{
    display: inline-flex; /* show only on small screens */
  }

  .sidebar-overlay{
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(17, 24, 39, 0.4);
    z-index: 1000;
  }

  body.sidebar-open .sidebar-overlay{
    display: block;
  }
}

@media (max-width: 768px){
  .mobile-only{
    display: block;
  }

  .desktop-only{
    display: none;
  }

  .topbar-left{
    flex: 1 1 auto;
    min-width: 0;
  }

  .topbar-right{
    margin-left: 0;
  }

  .topbar-toggle.mobile-only{
    width: 46px;
    height: 46px;
  }

  .topbar-toggle.mobile-only svg{
    width: 26px;
    height: 26px;
  }
}

@media (min-width: 993px){
  .sidebar-toggle{
    display: none !important;
  }
}