/* 
 * layout.css
 * Layout-specific styles for Data Integration Platform
 */

/* Grid System */
.container {
  width: 100%;
  padding-right: var(--space-md);
  padding-left: var(--space-md);
  margin-right: auto;
  margin-left: auto;
}

.row {
  display: flex;
  flex-wrap: wrap;
  margin-right: -0.5rem;
  margin-left: -0.5rem;
}

.col {
  position: relative;
  width: 100%;
  padding-right: 0.5rem;
  padding-left: 0.5rem;
}

/* Column sizing */
.col-1 { flex: 0 0 8.333333%; max-width: 8.333333%; }
.col-2 { flex: 0 0 16.666667%; max-width: 16.666667%; }
.col-3 { flex: 0 0 25%; max-width: 25%; }
.col-4 { flex: 0 0 33.333333%; max-width: 33.333333%; }
.col-5 { flex: 0 0 41.666667%; max-width: 41.666667%; }
.col-6 { flex: 0 0 50%; max-width: 50%; }
.col-7 { flex: 0 0 58.333333%; max-width: 58.333333%; }
.col-8 { flex: 0 0 66.666667%; max-width: 66.666667%; }
.col-9 { flex: 0 0 75%; max-width: 75%; }
.col-10 { flex: 0 0 83.333333%; max-width: 83.333333%; }
.col-11 { flex: 0 0 91.666667%; max-width: 91.666667%; }
.col-12 { flex: 0 0 100%; max-width: 100%; }

/* Page Layout */
.page-container {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.page-content {
  flex: 1;
  padding: 1.5rem 0;
}

/* Main Layouts */
.main-layout {
  display: flex;
  min-height: calc(100vh - 60px);
}

.sidebar {
  width: 280px;
  background-color: var(--bg-card, #fff);
  border-right: 1px solid var(--color-gray-300, #ced4da);
  padding: 1.5rem 1rem;
  position: sticky;
  top: 60px;
  height: calc(100vh - 60px);
  overflow-y: auto;
}

.main-content {
  flex: 1;
  padding: 1.5rem;
  background-color: var(--color-gray-100, #e9ecef);
}

/* Two-column Layout */
.two-column-layout {
  display: flex;
  gap: 1.5rem;
}

.left-column {
  flex: 2;
}

.right-column {
  flex: 1;
}

/* Dashboard Layout */
.dashboard-layout {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.5rem;
}

/* Settings Layout */
.settings-layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 2rem;
}

.settings-nav {
  position: sticky;
  top: 1.5rem;
}

.settings-content {
  background-color: var(--bg-card, #fff);
  border-radius: 0.5rem;
  padding: 1.5rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* Form Layout */
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}

.form-section {
  background-color: var(--bg-card, #fff);
  border-radius: 0.5rem;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.form-section-title {
  margin-bottom: 1rem;
  font-weight: 600;
  font-size: 1.25rem;
}

/* Card Grid */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 1rem;
}

/* Home dashboard layout */
.home-shell {
  --home-sidebar-collapsed: clamp(52px, 6vw, 60px);
  --home-sidebar-expanded: clamp(200px, 22vw, 260px);
  --home-sidebar-gap: clamp(1rem, 2vw, 1.5rem);
  position: relative;
  display: grid;
  grid-template-columns: var(--home-sidebar-collapsed) minmax(0, 1fr);
  column-gap: var(--home-sidebar-gap);
  align-items: stretch;
  min-height: 100%;
  flex: 1;
  padding: 0 var(--home-sidebar-gap) 0 0;
  background: linear-gradient(180deg, var(--bg-body) 0%, var(--bg-hover) 100%);
  transition: grid-template-columns 0.2s ease;
}

.home-shell.is-pinned {
  grid-template-columns: var(--home-sidebar-expanded) minmax(0, 1fr);
}

.home-shell.is-hovered:not(.is-pinned) {
  grid-template-columns: var(--home-sidebar-expanded) minmax(0, 1fr);
}

.home-sidebar {
  width: var(--home-sidebar-collapsed);
  background: linear-gradient(180deg, var(--bg-card) 0%, var(--bg-hover) 100%);
  border: 1px solid var(--border);
  border-radius: 0;
  padding: 1rem 0.75rem;
  position: sticky;
  top: 0;
  align-self: stretch;
  height: auto;
  max-height: none;
  overflow-x: hidden;
  overflow-y: auto;
  box-shadow: 0 18px 40px rgba(45, 40, 36, 0.08);
  transition: width 0.2s ease, box-shadow 0.2s ease;
  z-index: 10;
}

.home-shell.is-pinned .home-sidebar {
  width: var(--home-sidebar-expanded);
  padding: 1rem;
}

.home-sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.home-brand {
  display: flex;
  align-items: center;
  gap: 0;
  color: var(--text);
  font-weight: 700;
  text-decoration: none;
  justify-content: center;
  transition: gap 0.15s ease;
}

.home-brand:hover {
  color: var(--text);
  text-decoration: none;
}

.home-brand-mark {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  background: var(--primary);
  color: var(--text-inverse);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 20px rgba(124, 94, 60, 0.25);
}

.home-brand-text {
  font-size: 0.95rem;
  letter-spacing: 0.02em;
}

.home-sidebar-toggle {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.home-sidebar-toggle:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(45, 40, 36, 0.12);
  border-color: var(--border-dark);
}

.home-create {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-hover) 100%);
  color: var(--text-inverse);
  font-weight: 600;
  border-radius: 14px;
  padding: 0.7rem;
  margin-bottom: 1rem;
  box-shadow: 0 12px 22px rgba(124, 94, 60, 0.25);
  text-decoration: none;
  transition: transform 0.15s ease, box-shadow 0.15s ease, gap 0.15s ease;
}

.home-create:hover {
  color: var(--text-inverse);
  text-decoration: none;
  transform: translateY(-1px);
  box-shadow: 0 16px 26px rgba(124, 94, 60, 0.3);
}

.home-nav {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.home-nav-link {
  display: flex;
  align-items: center;
  gap: 0;
  padding: 0.6rem;
  border-radius: 14px;
  color: var(--text);
  text-decoration: none;
  transition: background-color 0.15s ease, color 0.15s ease, transform 0.15s ease, gap 0.15s ease;
  justify-content: center;
}

.home-nav-link:hover {
  background: var(--bg-hover);
  color: var(--text);
  transform: translateX(0);
  text-decoration: none;
}

.home-nav-link.active {
  background: var(--primary-light);
  color: var(--primary);
  font-weight: 600;
}

.home-nav-icon {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: center;
  color: inherit;
}

.home-nav-link.active .home-nav-icon {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--text-inverse);
}

.home-brand-text,
.home-nav-label,
.home-create-label {
  opacity: 0;
  max-width: 0;
  overflow: hidden;
  white-space: nowrap;
  transition: opacity 0.2s ease, max-width 0.2s ease;
  display: inline-block;
}

.home-main {
  flex: 1;
  min-width: 0;
}

.home-content {
  width: min(100%, 1400px);
  margin: 0 auto;
  padding-inline: clamp(1rem, 2vw, 2rem);
}

.home-shell.is-hovered:not(.is-pinned) .home-sidebar {
  width: var(--home-sidebar-expanded);
  padding: 1rem;
  box-shadow: 0 22px 46px rgba(45, 40, 36, 0.12);
}

.home-shell.is-hovered:not(.is-pinned) .home-sidebar .home-brand,
.home-shell.is-hovered:not(.is-pinned) .home-sidebar .home-create,
.home-shell.is-hovered:not(.is-pinned) .home-sidebar .home-nav-link {
  gap: 0.75rem;
  justify-content: flex-start;
  padding: 0.6rem 0.75rem;
}

.home-shell.is-hovered:not(.is-pinned) .home-sidebar .home-brand-text,
.home-shell.is-hovered:not(.is-pinned) .home-sidebar .home-nav-label,
.home-shell.is-hovered:not(.is-pinned) .home-sidebar .home-create-label {
  opacity: 1;
  max-width: 200px;
}

.home-shell:not(.is-pinned) .home-sidebar:focus-within {
  width: var(--home-sidebar-expanded);
  padding: 1rem;
  box-shadow: 0 22px 46px rgba(45, 40, 36, 0.12);
}

.home-shell:not(.is-pinned) .home-sidebar:focus-within .home-brand,
.home-shell:not(.is-pinned) .home-sidebar:focus-within .home-create,
.home-shell:not(.is-pinned) .home-sidebar:focus-within .home-nav-link {
  gap: 0.75rem;
  justify-content: flex-start;
  padding: 0.6rem 0.75rem;
}

.home-shell:not(.is-pinned) .home-sidebar:focus-within .home-brand-text,
.home-shell:not(.is-pinned) .home-sidebar:focus-within .home-nav-label,
.home-shell:not(.is-pinned) .home-sidebar:focus-within .home-create-label {
  opacity: 1;
  max-width: 200px;
}

.home-shell.is-pinned .home-brand,
.home-shell.is-pinned .home-create,
.home-shell.is-pinned .home-nav-link {
  gap: 0.75rem;
  justify-content: flex-start;
  padding: 0.6rem 0.75rem;
}

.home-shell.is-pinned .home-brand-text,
.home-shell.is-pinned .home-nav-label,
.home-shell.is-pinned .home-create-label {
  opacity: 1;
  max-width: 200px;
}

/* Responsive layouts */
@media (max-width: 992px) {
  .sidebar {
    width: 240px;
  }
  
  .settings-layout {
    grid-template-columns: 1fr;
  }
  
  .form-grid {
    grid-template-columns: 1fr;
  }

  .home-shell {
    grid-template-columns: 1fr;
    gap: 1rem;
    padding: 1rem;
  }

  .home-sidebar {
    width: 100%;
    position: static;
    height: auto;
    min-height: 0;
    max-height: none;
    padding: 1rem;
  }

  .home-shell.is-pinned {
    grid-template-columns: 1fr;
  }

  .home-shell.is-pinned .home-sidebar {
    width: 100%;
  }

  .home-brand,
  .home-create,
  .home-nav-link {
    gap: 0.75rem;
    justify-content: flex-start;
    padding: 0.6rem 0.75rem;
  }

  .home-brand-text,
  .home-nav-label,
  .home-create-label {
    opacity: 1;
    max-width: none;
  }

  .home-sidebar-toggle {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .home-shell,
  .home-sidebar,
  .home-brand-text,
  .home-nav-label,
  .home-create-label,
  .home-nav-link {
    transition: none;
  }
}

@media (max-width: 768px) {
  .main-layout {
    flex-direction: column;
  }
  
  .sidebar {
    width: 100%;
    position: static;
    height: auto;
    border-right: none;
    border-bottom: 1px solid var(--color-gray-300, #ced4da);
    padding: 1rem;
  }
  
  .two-column-layout {
    flex-direction: column;
  }
}

@media (max-width: 576px) {
  .container {
    padding-right: 0.75rem;
    padding-left: 0.75rem;
  }
  
  .dashboard-layout {
    grid-template-columns: 1fr;
  }
} 
