/* 
  layout.css 
  Shell, layout structure, responsive grids for Strok.
*/

* { box-sizing: border-box; }

body {
  margin: 0; padding: 0;
  height: 100vh;
  background: var(--bg-app);
  font-family: var(--font-family);
  color: var(--text-primary);
  display: flex;
  overflow: hidden;
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: var(--radius-sm); }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.2); }

/* App Background Asset Container */
.app-bg {
  position: absolute;
  inset: 0;
  z-index: -1;
  background-size: cover;
  background-position: center;
  opacity: 0.1; /* Subtle overlay */
  pointer-events: none;
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  border-right: 1px solid var(--sidebar-border);
  display: flex;
  flex-direction: column;
  z-index: 10;
  height: 100vh;
  overflow: hidden;
  transition: width 0.3s ease;
}

.sidebar-header {
  padding: var(--space-5);
  border-bottom: 1px solid var(--sidebar-border);
  display: flex;
  align-items: center;
  height: 70px;
}

.logo-container {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-weight: var(--font-weight-bold);
  font-size: var(--text-lg);
  color: #38bdf8;
}

.logo-container img {
  height: 24px;
  width: auto;
}

/* Navigation Menu */
.nav-menu {
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
  overflow-y: auto;
}

.nav-item {
  padding: 12px 16px;
  border-radius: var(--radius-md);
  color: var(--sidebar-text);
  font-family: 'Gotham Pro', sans-serif;
  font-size: 14px; /* Subtitle 2 Medium 14px */
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 12px; /* Spacing between icon/text */
  line-height: 1.2;
}

.nav-item span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-item .icon-container {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.nav-item .icon-container img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  /* Light gray for inactive state */
  filter: invert(70%) sepia(10%) saturate(400%) hue-rotate(180deg) brightness(90%) contrast(90%);
  transition: all 0.2s ease;
}

.nav-item:hover {
  background: var(--sidebar-hover-bg);
  color: #ffffff;
}

.nav-item:hover .icon-container img { 
  /* White for hover state */
  filter: invert(100%); 
}

.nav-item.active {
  background: var(--sidebar-active-bg);
  color: var(--sidebar-active-text);
  border-left: 3px solid var(--sidebar-active-text);
}

.nav-item.active .icon-container img { 
  /* Softer blue active state */
  filter: invert(24%) sepia(98%) saturate(2745%) hue-rotate(206deg) brightness(93%) contrast(106%);
}

/* User Profile Sidebar Block */
.sidebar-user {
  margin-top: auto;
  padding: var(--space-4);
  border-top: 1px solid var(--sidebar-border);
  display: flex;
  align-items: center;
  gap: var(--space-3);
  background: rgba(0, 0, 0, 0.15); /* Flatter navy background */
}

.sidebar-user .avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--sidebar-active-text);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: var(--font-weight-bold);
  font-size: var(--text-sm);
  flex-shrink: 0;
}

.sidebar-user-info {
  flex: 1;
  overflow: hidden;
}

.sidebar-user-name {
  font-family: 'Gotham Pro', sans-serif;
  font-size: 14px; /* Subtitle 2 Medium 14px */
  font-weight: 500;
  color: var(--sidebar-text);
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
}

.sidebar-user-role {
  font-family: 'Gotham Pro', sans-serif;
  font-size: 12px; /* Caption Regular 12px */
  font-weight: 400;
  color: #8F9AA5;
  text-transform: capitalize;
}

/* Main Content Area */
.main-editor {
  flex: 1;
  background: var(--bg-app);
  color: var(--text-primary);
  display: flex;
  flex-direction: column;
  position: relative;
  height: 100vh;
  overflow: hidden;
}

.editor-header {
  padding: 0 var(--space-6);
  height: 72px;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #ffffff;
  color: #0f172a;
  z-index: 50;
  box-shadow: none;
  border-radius: 0;
  margin: 0;
}

.editor-title {
  font-size: var(--text-xl);
  font-weight: var(--font-weight-semibold);
  color: var(--text-primary);
}

.editor-body {
  flex: 1;
  padding: 32px; /* Workspace Canvas Padding */
  overflow-y: auto;
  min-height: 0;
}

.workspace-canvas {
  width: 100%;
  max-width: 100%;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.editor-footer {
  padding: var(--space-4) var(--space-6);
  background: var(--bg-sidebar);
  border-top: 1px solid var(--border-subtle);
  display: flex;
  justify-content: flex-end;
  gap: var(--space-3);
}

/* Card System */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  margin-bottom: var(--space-5);
  box-shadow: var(--shadow-sm);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-4);
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: var(--space-3);
}

.card-title {
  font-size: var(--text-base);
  font-weight: var(--font-weight-semibold);
  color: var(--text-primary);
}

/* Responsive Rules */
@media (max-width: 1024px) {
  :root {
    --sidebar-width: 200px;
  }
}

@media (max-width: 768px) {
  :root {
    --sidebar-width: 60px;
  }
  .sidebar-header .logo-container span,
  .nav-item span,
  .sidebar-user-info {
    display: none;
  }
  .nav-item {
    justify-content: center;
    padding: var(--space-3);
  }
  .nav-item.active {
    border-left: none;
    border-bottom: 3px solid var(--brand-primary);
  }
}
