/* ============================================================
   COMPONENTS.CSS - Reusable Component Patterns
   ============================================================ */

/* ============================================================
   NAVIGATION & LINKS
   ============================================================ */

/* Back link */
.back-link {
    color: var(--text-secondary);
    text-decoration: none;
}

.back-link:hover {
    color: var(--text-primary);
}

/* Logout link */
.logout-link {
    color: var(--orange-primary);
}

.logout-link:hover {
    opacity: 0.8;
}

/* ============================================================
   HEADERS & SECTIONS
   ============================================================ */

/* Section header (two-column layout with title and actions) */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.section-header h2 {
    margin: 0;
}

/* Section title with no bottom margin */
.section-title {
    margin: 0;
}

/* ============================================================
   SEARCH & FILTERS
   ============================================================ */

/* Filter container */
.filter-container {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

/* Search input */
.search-input {
    padding: 0.5rem 1rem;
    border-radius: 8px;
    border: 1px solid rgba(139, 92, 246, 0.3);
    background: var(--bg-dark);
    color: var(--text-primary);
    font-family: inherit;
    width: 250px;
}

.search-input:focus {
    outline: 2px solid var(--purple-primary);
    outline-offset: 2px;
}

/* ============================================================
   BANNERS & ALERTS
   ============================================================ */

/* Info banner content */
.info-banner-content {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
}

.info-banner-icon {
    margin-top: 2px;
}

/* Legacy code warning */
.legacy-code-warning {
    background: var(--warning-bg, #fef3c7);
    border: 1px solid var(--warning-border, #fbbf24);
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
}

.legacy-code-warning p {
    margin: 0.5rem 0 0 0;
    color: var(--text-secondary);
}

/* ============================================================
   CODE VIEWERS
   ============================================================ */

/* Legacy code viewer */
.legacy-code-viewer {
    margin-top: 1rem;
}

.legacy-code-viewer pre {
    background: var(--bg-dark);
    padding: 1.5rem;
    border-radius: 8px;
    overflow-x: auto;
    max-height: 600px;
}

/* ============================================================
   LOADING STATES
   ============================================================ */

/* Loading text with spinner */
.loading-text {
    margin-right: 6px;
}

/* Loading container */
.loading-container {
    text-align: center;
    padding: 2rem;
}

.loading-executions {
    text-align: center;
    padding: 2rem;
}

.loading-schedule {
    text-align: center;
    padding: 3rem;
}

/* ============================================================
   GRIDS & LAYOUTS
   ============================================================ */

/* Detail grid for key-value pairs */
.detail-grid {
    display: flex;
    gap: 0.5rem;
}

/* Content container with margin */
.content-section {
    margin-bottom: 2rem;
}

/* Flex container with standard gap */
.flex-container {
    display: flex;
    gap: 1rem;
    align-items: center;
}

/* Flex container with small gap */
.flex-container-sm {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

/* Split layout (space-between) */
.split-layout {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 0;
}

/* ============================================================
   TEXT ELEMENTS
   ============================================================ */

/* Info text (small, secondary) */
.info-text {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: 0.5rem;
}

/* Small secondary text */
.text-small-secondary {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

/* Detail value (monospace) */
.detail-value {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.875rem;
}

/* Very small text */
.text-very-small {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

/* ============================================================
   EXECUTION COMPONENTS
   ============================================================ */

/* Execution steps container */
.execution-steps {
    margin-top: 1.5rem;
}

/* Empty state message */
.empty-state {
    color: var(--text-secondary);
    text-align: center;
    padding: 2rem;
}

/* ============================================================
   FORM ELEMENTS
   ============================================================ */

/* Form group with top margin */
.form-group-spaced {
    margin-top: 1.5rem;
}

/* Form helper text */
.form-helper {
    color: var(--text-secondary);
    display: block;
    margin-top: 0.5rem;
    font-size: 0.9rem;
}

/* ============================================================
   BUTTONS & ACTIONS
   ============================================================ */

/* Button link (styled as link but full width) */
.btn-link-full {
    width: 100%;
    text-align: left;
}

/* ============================================================
   INFO BOXES
   ============================================================ */

/* Info box wrapper */
.info-box {
    margin-top: 1.5rem;
}

/* Sidebar section */
.sidebar-section {
    margin-bottom: 0.5rem;
}

/* ============================================================
   STATUS INDICATORS
   ============================================================ */

/* Success status */
.status-success {
    color: hsl(120, 60%, 50%);
}

/* Error status */
.status-error {
    color: hsl(0, 70%, 60%);
}

/* Warning status */
.status-warning {
    color: hsl(45, 100%, 51%);
}

/* Running status (animated) */
.status-running {
    background: linear-gradient(
        90deg,
        var(--yellow-accent) 0%,
        var(--yellow-accent) 30%,
        var(--orange-primary) 50%,
        var(--yellow-accent) 70%,
        var(--yellow-accent) 100%
    );
    background-size: 200% auto;
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: shimmer 2s linear infinite;
}

/* Creating status (animated) */
.status-creating {
    background: linear-gradient(
        90deg,
        var(--purple-primary) 0%,
        var(--purple-primary) 30%,
        var(--orange-primary) 50%,
        var(--purple-primary) 70%,
        var(--purple-primary) 100%
    );
    background-size: 200% auto;
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: shimmer 2s linear infinite;
}

/* Draft status */
.status-draft {
    background: hsl(0, 0%, 30%);
}

/* Active status */
.status-active {
    background: hsl(120, 60%, 40%);
}

/* ============================================================
   INPUT COMPONENTS
   ============================================================ */

/* Input list */
.input-list {
    list-style: none;
    margin: 0.75rem 0;
}

.input-list li {
    padding: 0.5rem;
    background: var(--bg-dark);
    margin-bottom: 0.5rem;
    border-radius: 6px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9rem;
}

/* File upload area */
.file-upload-area {
    border: 2px dashed rgba(139, 92, 246, 0.5);
    border-radius: 8px;
    padding: 1.5rem;
    text-align: center;
    margin: 1rem 0;
    cursor: pointer;
    transition: all 0.3s;
}

.file-upload-area:hover {
    border-color: var(--purple-primary);
    background: rgba(139, 92, 246, 0.05);
}

/* Field badges */
.field-badge {
    display: inline-block;
    padding: 0.200rem 0.500rem;
    background: rgba(139, 92, 246, 0.1);
    border: 1px solid rgba(139, 92, 246, 0.3);
    color: var(--purple-primary);
    border-radius: 6px;
    font-size: 0.80rem;
    font-weight: 500;
    font-family: 'JetBrains Mono', monospace;
    transition: all 0.2s;
}

.field-badge:hover {
    background: rgba(139, 92, 246, 0.2);
    border-color: var(--purple-primary);
}

/* Checkbox group */
.checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin: 0.75rem 0;
}

.checkbox-group label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    color: var(--text-secondary);
}

/* Checkbox label */
.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--text-secondary);
    white-space: nowrap;
}

.checkbox-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: var(--purple-primary);
}

.checkbox-label:hover {
    color: var(--text-primary);
}

/* ============================================================
   RUN SECTION
   ============================================================ */

/* Run section */
.run-section {
    margin-bottom: 2rem;
}

/* Run button container */
.run-button-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 2rem;
    background: var(--bg-card);
    padding: 1.5rem;
    border-radius: 12px;
    border: 2px solid rgba(139, 92, 246, 0.3);
}

/* Run button */
.btn-run {
    background: linear-gradient(135deg, var(--purple-primary), var(--orange-primary));
    color: white;
    padding: 1rem 3rem;
    border: none;
    border-radius: 8px;
    font-size: 1.2rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s;
    font-family: inherit;
}

.btn-run:hover:not(:disabled) {
    transform: translateY(-2px);
}

.btn-run:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Status display */
.status-display {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.1rem;
    flex: 1;
    justify-content: center;
    font-weight: 500;
}

/* Email notification option */
.email-notification-option {
    display: flex;
    align-items: center;
    padding: 0.5rem 1rem;
    background: rgba(139, 92, 246, 0.05);
    border-radius: 6px;
    border: 1px solid rgba(139, 92, 246, 0.15);
}

/* ============================================================
   INFO BANNER (Enhanced)
   ============================================================ */

/* Info banner */
.info-banner {
    background: rgba(139, 92, 246, 0.1);
    border: 1px solid rgba(139, 92, 246, 0.3);
    border-radius: 8px;
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.info-banner-icon {
    font-size: 1.25rem;
    flex-shrink: 0;
}

/* ============================================================
   PROCESSING INDICATOR
   ============================================================ */

/* Processing indicator (animated dots) */
.processing-indicator {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.5rem 1rem;
    margin-top: 0.5rem;
    color: var(--purple-primary);
    font-weight: 600;
}

.processing-indicator .dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--purple-primary);
    animation: pulse-dot 1.4s infinite;
}

.processing-indicator .dot:nth-child(2) {
    animation-delay: 0.2s;
}

.processing-indicator .dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes pulse-dot {
    0%, 60%, 100% {
        opacity: 0.3;
        transform: scale(0.8);
    }
    30% {
        opacity: 1;
        transform: scale(1.2);
    }
}

/* ============================================================
   ANIMATIONS
   ============================================================ */

/* Shimmer animation for loading states */
@keyframes shimmer {
    0% {
        background-position: -200% center;
    }
    100% {
        background-position: 200% center;
    }
}

/* Loading text */
.loading-text {
    background: linear-gradient(
        90deg,
        var(--text-primary) 0%,
        var(--text-primary) 30%,
        var(--purple-primary) 50%,
        var(--text-primary) 70%,
        var(--text-primary) 100%
    );
    background-size: 200% auto;
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: shimmer 2s linear infinite;
}

/* Chat input highlight animation */
@keyframes highlightPulse {
    0% {
        box-shadow: 0 0 0 0 rgba(139, 92, 246, 0.7);
        border-color: var(--purple-primary);
    }
    50% {
        box-shadow: 0 0 0 10px rgba(139, 92, 246, 0);
        border-color: var(--orange-primary);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(139, 92, 246, 0);
        border-color: rgba(139, 92, 246, 0.3);
    }
}

.chat-input.highlight-input {
    animation: highlightPulse 2s ease-out;
}

/* ============================================================
   RESPONSIVE UTILITIES
   ============================================================ */

@media (max-width: 768px) {
    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .filter-container {
        width: 100%;
        flex-wrap: wrap;
    }

    .search-input {
        width: 100%;
    }

    .split-layout {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
}
