/**
 * Request Execution Page Layout Styles
 *
 * Three-column layout for optimal workflow monitoring:
 * - Section 1 (1/4): Project info + Progress
 * - Section 2 (2/4): Tabbed steps view
 * - Section 3 (1/4): Command execution history
 */

/* ==========================================================================
   Main Layout Container
   ========================================================================== */

.request-layout {
  display: flex;
  gap: 1rem;
  min-height: calc(100vh - 120px);
  max-height: calc(100vh - 120px);
}

/* ==========================================================================
   Section Columns
   ========================================================================== */

.request-layout__section {
  display: flex;
  flex-direction: column;
  border-radius: 0.5rem;
  overflow: hidden;
}

/* Section 1: Info Panel (1/4 width) */
.request-layout__info {
  flex: 0 0 25%;
  max-width: 25%;
  background-color: #f8fafc; /* slate-50 */
  border: 1px solid #e2e8f0; /* slate-200 */
}

/* Section 2: Steps Tabs (2/4 width) */
.request-layout__steps {
  flex: 0 0 50%;
  max-width: 50%;
  background-color: #ffffff;
  border: 1px solid #e5e7eb; /* gray-200 */
}

/* Section 3: Command History (1/4 width) */
.request-layout__history {
  flex: 0 0 25%;
  max-width: 25%;
  background-color: #f1f5f9; /* slate-100 */
  border: 1px solid #e2e8f0; /* slate-200 */
}

/* ==========================================================================
   Section Headers
   ========================================================================== */

.section-header {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid;
  font-weight: 600;
  font-size: 0.875rem;
}

.request-layout__info .section-header {
  background-color: #e2e8f0; /* slate-200 */
  border-color: #cbd5e1; /* slate-300 */
  color: #334155; /* slate-700 */
}

.request-layout__steps .section-header {
  background-color: #f3f4f6; /* gray-100 */
  border-color: #e5e7eb; /* gray-200 */
  color: #1f2937; /* gray-800 */
}

.request-layout__history .section-header {
  background-color: #e2e8f0; /* slate-200 */
  border-color: #cbd5e1; /* slate-300 */
  color: #334155; /* slate-700 */
}

/* ==========================================================================
   Section Content Areas
   ========================================================================== */

.section-content {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
}

/* Custom scrollbar for section content */
.section-content::-webkit-scrollbar {
  width: 6px;
}

.section-content::-webkit-scrollbar-track {
  background: transparent;
}

.section-content::-webkit-scrollbar-thumb {
  background-color: #cbd5e1;
  border-radius: 3px;
}

.section-content::-webkit-scrollbar-thumb:hover {
  background-color: #94a3b8;
}

/* ==========================================================================
   Info Panel Styles (Section 1)
   ========================================================================== */

.info-panel__title {
  font-size: 1.125rem;
  font-weight: 700;
  color: #1e293b; /* slate-800 */
  margin-bottom: 0.25rem;
  line-height: 1.3;
}

.info-panel__description {
  font-size: 0.8125rem;
  color: #64748b; /* slate-500 */
  margin-bottom: 1rem;
  line-height: 1.4;
}

.info-panel__badges {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.info-panel__meta {
  font-size: 0.75rem;
  color: #64748b;
  margin-bottom: 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid #e2e8f0;
}

.info-panel__meta-item {
  margin-bottom: 0.25rem;
}

.info-panel__meta-label {
  color: #94a3b8;
}

/* Progress section within info panel */
.info-panel__progress {
  background-color: #ffffff;
  border-radius: 0.375rem;
  padding: 0.75rem;
  margin-bottom: 1rem;
  border: 1px solid #e2e8f0;
}

.info-panel__progress-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.info-panel__progress-label {
  font-size: 0.75rem;
  font-weight: 500;
  color: #475569;
}

.info-panel__progress-value {
  font-size: 0.875rem;
  font-weight: 600;
  color: #1e293b;
}

.info-panel__progress-bar {
  height: 8px;
  background-color: #e2e8f0;
  border-radius: 4px;
  overflow: hidden;
}

.info-panel__progress-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.3s ease;
}

.info-panel__elapsed {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.75rem;
  color: #64748b;
  margin-top: 0.5rem;
}

/* Timeline in info panel */
.info-panel__timeline {
  background-color: #ffffff;
  border-radius: 0.375rem;
  padding: 0.75rem;
  border: 1px solid #e2e8f0;
}

.info-panel__timeline-title {
  font-size: 0.75rem;
  font-weight: 600;
  color: #475569;
  margin-bottom: 0.5rem;
}

.info-panel__timeline-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.info-panel__timeline-item {
  position: relative;
  padding: 0.375rem 0 0.375rem 1.5rem;
  font-size: 0.75rem;
}

.info-panel__timeline-item:not(:last-child)::before {
  content: '';
  position: absolute;
  left: 0.5rem;
  top: 1.25rem;
  bottom: -0.375rem;
  width: 1px;
  background-color: #e2e8f0;
}

.info-panel__timeline-icon {
  position: absolute;
  left: 0;
  top: 0.375rem;
  width: 1rem;
  height: 1rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.info-panel__timeline-icon svg {
  width: 0.625rem;
  height: 0.625rem;
}

.info-panel__timeline-name {
  color: #334155;
  font-weight: 500;
}

.info-panel__timeline-status {
  float: right;
  font-size: 0.625rem;
  padding: 0.125rem 0.375rem;
  border-radius: 9999px;
}

/* Action buttons in info panel */
.info-panel__actions {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid #e2e8f0;
}

/* ==========================================================================
   Tabs Component Styles (Section 2)
   ========================================================================== */

.steps-tabs {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.steps-tabs__nav {
  display: flex;
  overflow-x: auto;
  background-color: #f9fafb;
  border-bottom: 1px solid #e5e7eb;
  padding: 0.5rem 0.5rem 0;
  gap: 0.25rem;
  flex-shrink: 0;
}

.steps-tabs__nav::-webkit-scrollbar {
  height: 4px;
}

.steps-tabs__nav::-webkit-scrollbar-thumb {
  background-color: #d1d5db;
  border-radius: 2px;
}

.steps-tabs__tab {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 500;
  color: #6b7280;
  background-color: transparent;
  border: none;
  border-radius: 0.375rem 0.375rem 0 0;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 0.15s, color 0.15s;
  min-width: fit-content;
}

.steps-tabs__tab:hover:not(.steps-tabs__tab--active) {
  background-color: #e5e7eb;
  color: #374151;
}

.steps-tabs__tab--active {
  background-color: #ffffff;
  color: #1f2937;
  border: 1px solid #e5e7eb;
  border-bottom-color: #ffffff;
  margin-bottom: -1px;
}

.steps-tabs__tab-number {
  width: 1.25rem;
  height: 1.25rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.625rem;
  font-weight: 600;
}

.steps-tabs__tab--pending .steps-tabs__tab-number {
  background-color: #e5e7eb;
  color: #6b7280;
}

.steps-tabs__tab--running .steps-tabs__tab-number {
  background-color: #dbeafe;
  color: #2563eb;
}

.steps-tabs__tab--completed .steps-tabs__tab-number,
.steps-tabs__tab--approved .steps-tabs__tab-number {
  background-color: #dcfce7;
  color: #16a34a;
}

.steps-tabs__tab--failed .steps-tabs__tab-number,
.steps-tabs__tab--rejected .steps-tabs__tab-number {
  background-color: #fee2e2;
  color: #dc2626;
}

.steps-tabs__tab--awaiting_approval .steps-tabs__tab-number {
  background-color: #fef3c7;
  color: #d97706;
}

.steps-tabs__tab--skipped .steps-tabs__tab-number {
  background-color: #f3f4f6;
  color: #9ca3af;
}

.steps-tabs__tab-icon {
  width: 0.875rem;
  height: 0.875rem;
}

.steps-tabs__tab-icon--running {
  animation: spin 1s linear infinite;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* Tab Content */
.steps-tabs__content {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
}

.steps-tabs__panel {
  display: none;
}

.steps-tabs__panel--active {
  display: block;
}

/* Step content within tab */
.step-content {
  height: 100%;
  display: flex;
  flex-direction: column;
}

.step-content__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid #e5e7eb;
  margin-bottom: 1rem;
}

.step-content__title {
  font-size: 1rem;
  font-weight: 600;
  color: #1f2937;
}

.step-content__actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.step-content__body {
  flex: 1;
  overflow-y: auto;
}

/* Compact step output for tabs */
.steps-tabs .step-output__container {
  max-height: 300px;
}

/* ==========================================================================
   Command History Styles (Section 3)
   ========================================================================== */

.history-panel {
  height: 100%;
  display: flex;
  flex-direction: column;
}

.history-panel__actions {
  padding: 0.5rem 1rem;
  border-bottom: 1px solid #e2e8f0;
  background-color: #f8fafc;
}

.history-panel__list {
  flex: 1;
  overflow-y: auto;
}

.history-panel__item {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid #e2e8f0;
  transition: background-color 0.15s;
}

.history-panel__item:hover {
  background-color: #f8fafc;
}

.history-panel__item--failed {
  background-color: #fef2f2;
}

.history-panel__item--failed:hover {
  background-color: #fee2e2;
}

.history-panel__item-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.25rem;
}

.history-panel__item-step {
  font-size: 0.8125rem;
  font-weight: 500;
  color: #1e293b;
}

.history-panel__item-command {
  font-size: 0.6875rem;
  font-family: ui-monospace, monospace;
  color: #64748b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 0.25rem;
}

.history-panel__item-meta {
  display: flex;
  gap: 0.75rem;
  font-size: 0.625rem;
  color: #94a3b8;
}

.history-panel__item-error {
  margin-top: 0.5rem;
  padding: 0.5rem;
  background-color: #fee2e2;
  border-radius: 0.25rem;
  font-size: 0.6875rem;
  color: #991b1b;
}

.history-panel__empty {
  padding: 2rem 1rem;
  text-align: center;
  color: #94a3b8;
  font-size: 0.8125rem;
}

/* ==========================================================================
   Status Badge (compact version)
   ========================================================================== */

.badge-compact {
  padding: 0.125rem 0.375rem;
  font-size: 0.625rem;
  font-weight: 500;
  border-radius: 9999px;
}

/* ==========================================================================
   Responsive Adjustments
   ========================================================================== */

@media (max-width: 1280px) {
  .request-layout {
    flex-wrap: wrap;
    max-height: none;
  }

  .request-layout__info {
    flex: 0 0 100%;
    max-width: 100%;
    order: 1;
  }

  .request-layout__steps {
    flex: 0 0 65%;
    max-width: 65%;
    order: 2;
  }

  .request-layout__history {
    flex: 0 0 35%;
    max-width: 35%;
    order: 3;
  }
}

@media (max-width: 768px) {
  .request-layout {
    flex-direction: column;
  }

  .request-layout__info,
  .request-layout__steps,
  .request-layout__history {
    flex: 1 1 auto;
    max-width: 100%;
    max-height: 50vh;
  }
}
