/**
 * Page Layout Styles
 */

/* Main Layout */
.app-layout {
  display: flex;
  height: 100vh;
  overflow: hidden;
  background-color: var(--color-gray-50);
}

.app-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* macOS drag region for main content area */
.app-main__drag-region {
  height: var(--titlebar-height, 38px);
  min-height: var(--titlebar-height, 38px);
  -webkit-app-region: drag;
  flex-shrink: 0;
  background-color: var(--color-white);
  border-bottom: 1px solid var(--color-gray-100);
}

/* Page Container */
.page {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.page__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--spacing-4) var(--spacing-6);
  background-color: var(--color-white);
  border-bottom: 1px solid var(--color-gray-200);
  min-height: var(--header-height);
}

.page__header-left {
  display: flex;
  align-items: center;
  gap: var(--spacing-4);
}

.page__header-right {
  display: flex;
  align-items: center;
  gap: var(--spacing-3);
}

.page__title {
  font-size: var(--font-size-xl);
  font-weight: var(--font-weight-semibold);
  color: var(--color-gray-900);
  margin: 0;
}

.page__subtitle {
  font-size: var(--font-size-sm);
  color: var(--color-gray-500);
  margin: 0;
}

.page__content {
  flex: 1;
  overflow-y: auto;
  padding: var(--spacing-6);
}

.page__content--no-padding {
  padding: 0;
}

.page__content--centered {
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Page Sections */
.page-section {
  margin-bottom: var(--spacing-8);
}

.page-section__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--spacing-4);
}

.page-section__title {
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-semibold);
  color: var(--color-gray-900);
  margin: 0;
}

.page-section__description {
  font-size: var(--font-size-sm);
  color: var(--color-gray-500);
  margin-top: var(--spacing-1);
}

/* Empty State */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--spacing-12);
  text-align: center;
}

.empty-state__icon {
  width: 64px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--color-gray-100);
  border-radius: var(--radius-full);
  color: var(--color-gray-400);
  margin-bottom: var(--spacing-4);
}

.empty-state__title {
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-semibold);
  color: var(--color-gray-900);
  margin: 0 0 var(--spacing-2);
}

.empty-state__description {
  font-size: var(--font-size-sm);
  color: var(--color-gray-500);
  max-width: 400px;
  margin: 0 0 var(--spacing-6);
}

/* Grid Layouts */
.grid {
  display: grid;
  gap: var(--spacing-4);
}

.grid--2-cols {
  grid-template-columns: repeat(2, 1fr);
}

.grid--3-cols {
  grid-template-columns: repeat(3, 1fr);
}

.grid--4-cols {
  grid-template-columns: repeat(4, 1fr);
}

.grid--auto {
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
}

@media (max-width: 1200px) {
  .grid--4-cols {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 992px) {
  .grid--3-cols,
  .grid--4-cols {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .grid--2-cols,
  .grid--3-cols,
  .grid--4-cols {
    grid-template-columns: 1fr;
  }
}

/* Split View */
.split-view {
  display: flex;
  height: 100%;
  overflow: hidden;
}

.split-view__panel {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.split-view__panel--sidebar {
  width: 300px;
  min-width: 250px;
  max-width: 400px;
  border-right: 1px solid var(--color-gray-200);
  background-color: var(--color-white);
}

.split-view__panel--main {
  flex: 1;
}

.split-view__resize-handle {
  width: 4px;
  background-color: transparent;
  cursor: col-resize;
  transition: background-color var(--transition-fast);
}

.split-view__resize-handle:hover {
  background-color: var(--color-primary-light);
}

/* ============ Connections Page ============ */

.connections-section__title {
  font-size: 1rem;
  font-weight: var(--font-weight-semibold);
  color: var(--color-gray-900);
  margin-bottom: 0.25rem;
}

/* EverWorker card */
.connections-ew-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  background: var(--color-white);
  border: 1px solid var(--color-gray-200);
  border-radius: var(--radius-lg);
  gap: 1rem;
}

.connections-ew-card__left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.connections-ew-card__icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, var(--color-primary), var(--color-primary-hover));
  color: var(--color-white);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.connections-ew-card__name {
  font-size: 1rem;
  font-weight: var(--font-weight-semibold);
  color: var(--color-gray-900);
}

.connections-ew-card__status {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.8125rem;
}

.connections-ew-card__status--connected {
  color: var(--color-success, #22c55e);
}

.connections-ew-card__status--disconnected {
  color: var(--color-gray-500);
}

.connections-ew-card__url {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.75rem;
  color: var(--color-gray-500);
  margin-top: 0.125rem;
}

.connections-url-override {
  padding: 0.5rem 0.75rem;
  background: var(--color-gray-50);
  border-radius: var(--radius-md);
}

/* Service cards grid */
.connections-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 1rem;
}

.connections-service-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 1.25rem 1rem;
  background: var(--color-white);
  border: 1px solid var(--color-gray-200);
  border-radius: var(--radius-lg);
  text-align: center;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.connections-service-card:hover {
  border-color: var(--color-gray-300);
  box-shadow: var(--shadow-sm);
}

.connections-service-card--connected {
  border-color: var(--color-success, #22c55e);
  background: rgba(34, 197, 94, 0.03);
}

.connections-service-card__logo {
  margin-bottom: 0.75rem;
}

.connections-service-card__name {
  font-size: 0.875rem;
  font-weight: var(--font-weight-semibold);
  color: var(--color-gray-900);
  margin-bottom: 0.375rem;
}

.connections-service-card__status {
  font-size: 0.75rem;
  margin-bottom: 0.75rem;
}

.connections-status--connected {
  color: var(--color-success, #22c55e);
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.connections-status--disconnected {
  color: var(--color-gray-500);
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.connections-service-card__action {
  width: 100%;
}
