/* AgentMindMCP Styles - MCPCIO Design System */

:root {
    /* Charcoal Gradient System */
    --charcoal-primary: #1a1a1a;
    --charcoal-secondary: #2d2d2d;
    --charcoal-tertiary: #3a3a3a;
    --charcoal-gradient: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 50%, #3a3a3a 100%);

    /* Gold Accent System */
    --gold-primary: #f59e0b;
    --gold-secondary: #d97706;
    --gold-tertiary: #fcd34d;
    --gold-gradient: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);

    /* Interactive States */
    --surface-hover: rgba(255, 255, 255, 0.05);
    --surface-active: rgba(255, 255, 255, 0.1);
    --accent-hover: rgba(245, 158, 11, 0.8);
    --accent-active: rgba(245, 158, 11, 0.9);

    /* Text */
    --text-primary: #e5e5e5;
    --text-secondary: #a0a0a0;

    /* Borders */
    --border-color: #404040;

    /* Status Colors */
    --error-color: #ef4444;
    --success-color: #22c55e;
    --info-color: #3b82f6;
    --warning-color: #f59e0b;

    /* Typography */
    --font-display: 'Inter', system-ui, -apple-system, sans-serif;
    --font-body: 'Inter', system-ui, -apple-system, sans-serif;
}

/* Reset & Base */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-body);
    background: var(--charcoal-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.main-content {
    flex: 1;
    padding-top: 1rem;
    padding-bottom: 3rem;
}

/* ============================================================
   Hero Section
   ============================================================ */

.hero-section {
    text-align: center;
    padding: 3rem 1.5rem 2rem;
    max-width: 800px;
    margin: 0 auto;
}

.hero-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.hero-title {
    font-family: var(--font-display);
    font-size: 3rem;
    font-weight: 700;
    color: #fff;
    margin-bottom: 0.5rem;
    letter-spacing: -0.02em;
}

.hero-subtitle-primary {
    font-size: 1.5rem;
    font-weight: 600;
    background: var(--gold-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.75rem;
}

.hero-subtitle {
    font-size: 1.125rem;
    color: var(--text-secondary);
    max-width: 600px;
    margin: 0 auto;
}

/* ============================================================
   Container
   ============================================================ */

.agent-container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

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

.section-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.section-header h2 {
    font-size: 1.5rem;
    font-weight: 600;
    color: #fff;
}

.section-header i {
    font-size: 1.25rem;
}

/* ============================================================
   Cards (shared)
   ============================================================ */

.elegant-card {
    background: var(--charcoal-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
    transition: border-color 0.2s ease;
}

.elegant-card:hover {
    border-color: rgba(245, 158, 11, 0.3);
}

.card-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-header h2,
.card-header h3 {
    font-size: 1.125rem;
    font-weight: 600;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.card-body {
    padding: 1.5rem;
}

/* ============================================================
   Compose Section
   ============================================================ */

.compose-section {
    margin-bottom: 2rem;
}

.compose-input-group {
    position: relative;
}

.compose-textarea {
    width: 100%;
    min-height: 120px;
    padding: 1rem;
    background: var(--charcoal-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 1rem;
    line-height: 1.6;
    resize: vertical;
    transition: border-color 0.2s ease;
}

.compose-textarea:focus {
    outline: none;
    border-color: var(--gold-primary);
}

.compose-textarea::placeholder {
    color: var(--text-secondary);
}

.compose-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 1rem;
    flex-wrap: wrap;
}

/* ============================================================
   Template Gallery
   ============================================================ */

.template-gallery {
    margin-top: 2rem;
}

.template-gallery h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 1rem;
}

.template-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
}

.template-card {
    background: var(--charcoal-secondary);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 1.25rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.template-card:hover {
    border-color: var(--gold-primary);
    transform: translateY(-2px);
}

.template-card-icon {
    font-size: 1.5rem;
    margin-bottom: 0.75rem;
}

.template-card-name {
    font-size: 1rem;
    font-weight: 600;
    color: #fff;
    margin-bottom: 0.5rem;
}

.template-card-desc {
    font-size: 0.875rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* ============================================================
   Compose Preview (Step Cards)
   ============================================================ */

.compose-preview {
    margin-top: 2rem;
}

.step-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.step-card {
    background: var(--charcoal-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1rem 1.25rem;
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    transition: border-color 0.2s ease;
}

.step-card.step-running {
    border-color: var(--info-color);
}

.step-card.step-success {
    border-color: var(--success-color);
}

.step-card.step-failed {
    border-color: var(--error-color);
}

.step-card.step-skipped {
    opacity: 0.5;
}

.step-number {
    width: 32px;
    height: 32px;
    min-width: 32px;
    border-radius: 50%;
    background: var(--charcoal-tertiary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.step-running .step-number {
    background: rgba(59, 130, 246, 0.15);
    color: var(--info-color);
}

.step-success .step-number {
    background: rgba(34, 197, 94, 0.15);
    color: var(--success-color);
}

.step-failed .step-number {
    background: rgba(239, 68, 68, 0.15);
    color: var(--error-color);
}

.step-content {
    flex: 1;
    min-width: 0;
}

.step-tool {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--gold-primary);
    margin-bottom: 0.25rem;
}

.step-label {
    font-size: 0.9375rem;
    color: #fff;
    margin-bottom: 0.25rem;
}

.step-params {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    word-break: break-word;
}

.step-status-icon {
    font-size: 1rem;
    min-width: 20px;
    text-align: center;
}

.step-output {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border-color);
    font-size: 0.875rem;
    color: var(--text-secondary);
    line-height: 1.5;
    white-space: pre-wrap;
    max-height: 200px;
    overflow-y: auto;
}

/* Refine section */
.refine-section {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
}

.refine-textarea {
    width: 100%;
    min-height: 80px;
    padding: 0.75rem;
    background: var(--charcoal-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 0.9375rem;
    resize: vertical;
    transition: border-color 0.2s ease;
}

.refine-textarea:focus {
    outline: none;
    border-color: var(--gold-primary);
}

.refine-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 0.75rem;
}

/* Delivery options */
.delivery-options {
    display: flex;
    gap: 1.5rem;
    margin-top: 1rem;
    padding: 1rem;
    background: var(--charcoal-primary);
    border-radius: 8px;
}

.delivery-option {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-size: 0.9375rem;
    color: var(--text-primary);
}

.delivery-option input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--gold-primary);
}

.activate-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 1.5rem;
}

/* ============================================================
   Agent List
   ============================================================ */

.agent-list-section {
    margin-top: 2.5rem;
}

.agent-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1rem;
}

.agent-card {
    background: var(--charcoal-secondary);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    transition: border-color 0.2s ease;
}

.agent-card:hover {
    border-color: rgba(245, 158, 11, 0.3);
}

.agent-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
}

.agent-card-name {
    font-size: 1.0625rem;
    font-weight: 600;
    color: #fff;
}

.agent-card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    font-size: 0.8125rem;
    color: var(--text-secondary);
}

.agent-card-meta span {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.agent-card-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-top: auto;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border-color);
}

/* ============================================================
   Status Badges
   ============================================================ */

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.2rem 0.6rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.status-badge-active {
    background: rgba(34, 197, 94, 0.15);
    color: var(--success-color);
}

.status-badge-paused {
    background: rgba(245, 158, 11, 0.15);
    color: var(--warning-color);
}

.status-badge-draft {
    background: rgba(160, 160, 160, 0.15);
    color: var(--text-secondary);
}

.status-badge-running {
    background: rgba(59, 130, 246, 0.15);
    color: var(--info-color);
}

.status-badge-failed {
    background: rgba(239, 68, 68, 0.15);
    color: var(--error-color);
}

/* ============================================================
   Buttons
   ============================================================ */

.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    border-radius: 8px;
    font-family: var(--font-body);
    font-size: 0.9375rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.2s ease;
    text-decoration: none;
    white-space: nowrap;
    min-height: 44px;
}

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

.btn-primary {
    background: var(--gold-gradient);
    color: #000;
}

.btn-primary:hover:not(:disabled) {
    opacity: 0.9;
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--charcoal-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--border-color);
}

.btn-danger {
    background: rgba(239, 68, 68, 0.15);
    color: var(--error-color);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.btn-danger:hover:not(:disabled) {
    background: rgba(239, 68, 68, 0.25);
}

.btn-sm {
    padding: 0.4rem 0.85rem;
    font-size: 0.8125rem;
    min-height: 36px;
}

.btn-icon {
    padding: 0.4rem 0.6rem;
    min-height: 36px;
}

/* ============================================================
   Run View (Progress)
   ============================================================ */

.run-view {
    margin-top: 2rem;
}

.run-progress-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.run-progress-header h3 {
    font-size: 1.125rem;
    font-weight: 600;
    color: #fff;
}

.run-summary {
    display: flex;
    gap: 1.5rem;
    padding: 1rem 1.25rem;
    background: var(--charcoal-primary);
    border-radius: 8px;
    margin-top: 1rem;
    flex-wrap: wrap;
}

.run-summary-stat {
    text-align: center;
}

.run-summary-stat .stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: #fff;
}

.run-summary-stat .stat-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.run-completion-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 1.5rem;
}

/* ============================================================
   Status Banner
   ============================================================ */

.status-banner {
    padding: 0.75rem 1.25rem;
    border-radius: 8px;
    font-size: 0.9375rem;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.status-banner.status-error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: var(--error-color);
}

.status-banner.status-success {
    background: rgba(34, 197, 94, 0.1);
    border: 1px solid rgba(34, 197, 94, 0.3);
    color: var(--success-color);
}

.status-banner.status-info {
    background: rgba(59, 130, 246, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.3);
    color: var(--info-color);
}

.status-banner.status-warning {
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid rgba(245, 158, 11, 0.3);
    color: var(--warning-color);
}

/* ============================================================
   Empty State
   ============================================================ */

.empty-state {
    text-align: center;
    padding: 3rem 1.5rem;
    color: var(--text-secondary);
}

.empty-state i {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    opacity: 0.4;
}

.empty-state h3 {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.empty-state p {
    font-size: 0.9375rem;
    max-width: 400px;
    margin: 0 auto;
}

/* ============================================================
   Spinner
   ============================================================ */

.spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid var(--border-color);
    border-top-color: var(--info-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* ============================================================
   Confirm Dialog
   ============================================================ */

.confirm-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.confirm-dialog {
    background: var(--charcoal-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 2rem;
    max-width: 400px;
    width: 90%;
}

.confirm-dialog h3 {
    font-size: 1.125rem;
    font-weight: 600;
    color: #fff;
    margin-bottom: 0.75rem;
}

.confirm-dialog p {
    font-size: 0.9375rem;
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

.confirm-dialog-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
}

/* ============================================================
   Delivery Page
   ============================================================ */

.delivery-page {
    max-width: 900px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
}

.delivery-header {
    text-align: center;
    margin-bottom: 2rem;
}

.delivery-header h1 {
    font-size: 1.75rem;
    font-weight: 700;
    color: #fff;
    margin-bottom: 0.5rem;
}

.delivery-meta {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.delivery-steps {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 2rem;
}

.delivery-step-card {
    background: var(--charcoal-secondary);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    overflow: hidden;
}

.delivery-step-header {
    padding: 1rem 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    border-bottom: 1px solid var(--border-color);
}

.delivery-step-header .step-number {
    width: 28px;
    height: 28px;
    min-width: 28px;
    font-size: 0.8125rem;
}

.delivery-step-header .step-tool {
    margin-bottom: 0;
}

.delivery-step-body {
    padding: 1.25rem;
    font-size: 0.9375rem;
    color: var(--text-primary);
    line-height: 1.6;
    white-space: pre-wrap;
    max-height: 400px;
    overflow-y: auto;
}

.delivery-actions {
    text-align: center;
    margin-top: 2rem;
}

.delivery-notice {
    text-align: center;
    margin-top: 1.5rem;
    font-size: 0.8125rem;
    color: var(--text-secondary);
}

.delivery-notice i {
    margin-right: 0.35rem;
}

.delivery-footer {
    text-align: center;
    padding: 2rem 1rem;
    margin-top: 3rem;
    border-top: 1px solid var(--border-color);
    font-size: 0.8125rem;
    color: var(--text-secondary);
}

/* ============================================================
   Tier Upgrade Message
   ============================================================ */

.tier-upgrade {
    text-align: center;
    padding: 3rem 1.5rem;
}

.tier-upgrade i {
    font-size: 2.5rem;
    color: var(--gold-primary);
    margin-bottom: 1rem;
}

.tier-upgrade h2 {
    font-size: 1.5rem;
    font-weight: 600;
    color: #fff;
    margin-bottom: 0.75rem;
}

.tier-upgrade p {
    font-size: 1rem;
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
}

/* ============================================================
   Loading
   ============================================================ */

.loading-placeholder {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 2rem;
    justify-content: center;
    color: var(--text-secondary);
}

/* ============================================================
   Hidden utility
   ============================================================ */

.hidden {
    display: none !important;
}

/* ============================================================
   Responsive: Tablet (<=768px)
   ============================================================ */

@media (max-width: 768px) {
    .hero-title {
        font-size: 2rem;
    }

    .hero-subtitle-primary {
        font-size: 1.25rem;
    }

    .hero-section {
        padding: 2rem 1rem 1.5rem;
    }

    .agent-container {
        padding: 0 1rem;
    }

    .template-grid {
        grid-template-columns: 1fr;
    }

    .agent-grid {
        grid-template-columns: 1fr;
    }

    .compose-actions {
        flex-direction: column;
    }

    .compose-actions .btn {
        width: 100%;
        justify-content: center;
    }

    .delivery-options {
        flex-direction: column;
        gap: 0.75rem;
    }

    .activate-actions {
        flex-direction: column;
    }

    .activate-actions .btn {
        width: 100%;
        justify-content: center;
    }

    .run-summary {
        justify-content: center;
    }

    .run-completion-actions {
        flex-direction: column;
    }

    .run-completion-actions .btn {
        width: 100%;
        justify-content: center;
    }

    .agent-card-actions {
        flex-direction: column;
    }

    .agent-card-actions .btn {
        width: 100%;
        justify-content: center;
    }

    .step-card {
        flex-direction: column;
        gap: 0.5rem;
    }

    .confirm-dialog {
        width: 95%;
        padding: 1.5rem;
    }
}

/* ============================================================
   Responsive: Phone (<=480px)
   ============================================================ */

@media (max-width: 480px) {
    .hero-title {
        font-size: 1.75rem;
    }

    .hero-subtitle-primary {
        font-size: 1.125rem;
    }

    .hero-subtitle {
        font-size: 1rem;
    }

    .section-header h2 {
        font-size: 1.25rem;
    }

    .agent-card-meta {
        flex-direction: column;
        gap: 0.35rem;
    }
}
