/* ========================================
   MARMOLERÍA BENJAMIN — Layout
   ======================================== */

/* ── App Container ── */
.app-container {
  display: flex;
  min-height: 100vh;
  background: var(--color-stone-50);
}

/* ── Sidebar ── */
.sidebar {
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  width: var(--sidebar-width);
  background: var(--color-white);
  border-right: 1px solid var(--color-stone-200);
  display: flex;
  flex-direction: column;
  z-index: var(--z-sticky);
  transition: transform var(--transition-drawer);
  overflow-y: auto;
  overflow-x: hidden;
}

.sidebar-header {
  padding: var(--space-6) var(--space-5);
  border-bottom: 1px solid var(--color-stone-100);
  flex-shrink: 0;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  text-decoration: none;
}

.sidebar-logo-icon {
  width: 38px;
  height: 38px;
  background: linear-gradient(135deg, var(--color-stone-800) 0%, var(--color-stone-600) 100%);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-white);
  font-weight: var(--font-bold);
  font-size: var(--text-lg);
  letter-spacing: var(--tracking-tight);
  flex-shrink: 0;
}

.sidebar-logo-img {
  width: 42px;
  height: 42px;
  object-fit: contain;
  flex-shrink: 0;
  border-radius: var(--radius-md);
  background: #ffffff;
  border: 1px solid var(--color-stone-200);
  padding: 2px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.sidebar-logo-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
  overflow: hidden;
}

.sidebar-logo-name {
  font-size: var(--text-md);
  font-weight: var(--font-semibold);
  color: var(--color-stone-900);
  letter-spacing: var(--tracking-tight);
  white-space: nowrap;
}

.sidebar-logo-sub {
  font-size: var(--text-xs);
  color: var(--color-stone-400);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wider);
  white-space: nowrap;
}

/* Navigation */
.sidebar-nav {
  flex: 1;
  padding: var(--space-3) var(--space-3);
  overflow-y: auto;
}

.sidebar-nav-section {
  margin-bottom: var(--space-2);
}

.sidebar-nav-label {
  font-size: var(--text-xs);
  font-weight: var(--font-medium);
  color: var(--color-stone-400);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wider);
  padding: var(--space-3) var(--space-3) var(--space-2);
}

.sidebar-nav-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  color: var(--color-stone-600);
  font-size: var(--text-base);
  font-weight: var(--font-medium);
  cursor: pointer;
  transition: all var(--transition-fast);
  text-decoration: none;
  margin-bottom: 2px;
  user-select: none;
}

.sidebar-nav-item:hover {
  background: var(--color-stone-100);
  color: var(--color-stone-800);
}

.sidebar-nav-item.active {
  background: var(--color-stone-900);
  color: var(--color-white);
}

.sidebar-nav-item.active .sidebar-nav-icon {
  color: var(--color-white);
}

.sidebar-nav-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  color: var(--color-stone-400);
  transition: color var(--transition-fast);
}

.sidebar-nav-item:hover .sidebar-nav-icon {
  color: var(--color-stone-700);
}

.sidebar-nav-badge {
  margin-left: auto;
  background: var(--color-error);
  color: var(--color-white);
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
  padding: 1px 7px;
  border-radius: var(--radius-full);
  line-height: 1.4;
}

/* Sidebar Footer */
.sidebar-footer {
  padding: var(--space-4) var(--space-5);
  border-top: 1px solid var(--color-stone-100);
  flex-shrink: 0;
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.sidebar-user-avatar {
  width: 34px;
  height: 34px;
  background: var(--color-stone-200);
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  color: var(--color-stone-600);
  flex-shrink: 0;
}

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

.sidebar-user-name {
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  color: var(--color-stone-800);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-user-role {
  font-size: var(--text-xs);
  color: var(--color-stone-400);
}

.sidebar-logout-btn {
  padding: var(--space-1);
  border-radius: var(--radius-md);
  color: var(--color-stone-400);
  transition: all var(--transition-fast);
}

.sidebar-logout-btn:hover {
  background: var(--color-stone-100);
  color: var(--color-error);
}

/* ── Mobile Toggle ── */
.sidebar-toggle {
  display: none;
  position: fixed;
  top: var(--space-4);
  left: var(--space-4);
  z-index: var(--z-drawer);
  width: 40px;
  height: 40px;
  border-radius: var(--radius-lg);
  background: var(--color-white);
  box-shadow: var(--shadow-md);
  align-items: center;
  justify-content: center;
  color: var(--color-stone-700);
  border: 1px solid var(--color-stone-200);
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(28, 25, 23, 0.3);
  z-index: calc(var(--z-sticky) - 1);
  opacity: 0;
  transition: opacity var(--transition-slow);
}

.sidebar-overlay.visible {
  display: block;
  opacity: 1;
}

/* ── Main Content ── */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ── Page Header ── */
.page-header {
  background: var(--color-white);
  border-bottom: 1px solid var(--color-stone-200);
  padding: var(--space-5) var(--content-padding);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  flex-shrink: 0;
  min-height: var(--header-height);
  position: sticky;
  top: 0;
  z-index: var(--z-sticky);
}

.page-header-left {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  min-width: 0;
}

.page-breadcrumb {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  color: var(--color-stone-400);
}

.page-breadcrumb a {
  color: var(--color-stone-400);
  transition: color var(--transition-fast);
}

.page-breadcrumb a:hover {
  color: var(--color-stone-700);
}

.page-breadcrumb-sep {
  color: var(--color-stone-300);
}

.page-title {
  font-size: var(--text-xl);
  font-weight: var(--font-semibold);
  color: var(--color-stone-900);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.page-header-actions {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-shrink: 0;
}

/* ── Page Content ── */
.page-content {
  flex: 1;
  padding: var(--content-padding);
  max-width: var(--content-max-width);
  width: 100%;
}

.page-content.full-width {
  max-width: 100%;
}

/* ── Login Page ── */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: linear-gradient(135deg, var(--color-stone-100) 0%, var(--color-warm-100) 50%, var(--color-stone-200) 100%);
  padding: var(--space-4);
}

.login-card {
  background: var(--color-white);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  padding: var(--space-10) var(--space-8);
  width: 100%;
  max-width: 400px;
  text-align: center;
  animation: fadeInUp var(--transition-slow) ease;
}

.login-logo {
  width: 56px;
  height: 56px;
  background: linear-gradient(135deg, var(--color-stone-800) 0%, var(--color-stone-600) 100%);
  border-radius: var(--radius-xl);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-white);
  font-weight: var(--font-bold);
  font-size: var(--text-2xl);
  margin: 0 auto var(--space-5);
}

.login-title {
  font-size: var(--text-2xl);
  font-weight: var(--font-bold);
  color: var(--color-stone-900);
  margin-bottom: var(--space-1);
}

.login-subtitle {
  font-size: var(--text-sm);
  color: var(--color-stone-400);
  margin-bottom: var(--space-8);
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  text-align: left;
}

.login-form .form-group {
  margin-bottom: 0;
}

.login-btn {
  margin-top: var(--space-2);
}

.login-error {
  background: var(--color-error-light);
  color: var(--color-error-dark);
  font-size: var(--text-sm);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  display: none;
}

.login-error.visible {
  display: block;
  animation: fadeIn var(--transition-fast) ease;
}

/* ── Section Groups ── */
.section-group {
  margin-bottom: var(--space-8);
}

.section-title {
  font-size: var(--text-lg);
  font-weight: var(--font-semibold);
  color: var(--color-stone-800);
  margin-bottom: var(--space-4);
  padding-bottom: var(--space-2);
  border-bottom: 1px solid var(--color-stone-200);
}

.section-subtitle {
  font-size: var(--text-base);
  font-weight: var(--font-medium);
  color: var(--color-stone-600);
  margin-bottom: var(--space-3);
}

/* ── Grid Layouts ── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: var(--space-4);
  margin-bottom: var(--space-6);
}

.two-col-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-6);
}

.three-col-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-4);
}

/* ── Tabs ── */
.tabs-container {
  margin-bottom: var(--space-6);
}

.tabs-header {
  display: flex;
  border-bottom: 1px solid var(--color-stone-200);
  gap: 0;
  overflow-x: auto;
}

.tab-btn {
  padding: var(--space-3) var(--space-5);
  font-size: var(--text-base);
  font-weight: var(--font-medium);
  color: var(--color-stone-500);
  border-bottom: 2px solid transparent;
  transition: all var(--transition-fast);
  white-space: nowrap;
  cursor: pointer;
}

.tab-btn:hover {
  color: var(--color-stone-700);
}

.tab-btn.active {
  color: var(--color-stone-900);
  border-bottom-color: var(--color-stone-900);
}

.tab-content {
  display: none;
  padding-top: var(--space-5);
}

.tab-content.active {
  display: block;
  animation: fadeIn var(--transition-base) ease;
}
