/* CLAW - Command Center */
/* Mobile-first dark theme */

:root {
    --bg-primary: #0d1117;
    --bg-secondary: #161b22;
    --bg-tertiary: #21262d;
    --text-primary: #e6edf3;
    --text-secondary: #8b949e;
    --text-muted: #6e7681;
    --border-color: #30363d;
    --accent-blue: #58a6ff;
    --accent-green: #3fb950;
    --accent-yellow: #d29922;
    --accent-red: #f85149;
    --accent-purple: #a371f7;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.5;
    min-height: 100vh;
    padding-bottom: env(safe-area-inset-bottom);
}

/* Header - Compact on mobile */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.logo-img {
    height: 32px;
    width: auto;
}

.tagline {
    color: var(--text-secondary);
    font-size: 0.75rem;
    font-weight: 600;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
}

.status-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

.status-connected { background: var(--accent-green); }
.status-disconnected { background: var(--accent-red); }

/* Buttons - Touch-friendly */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.625rem 1rem;
    min-height: 44px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.15s;
    -webkit-tap-highlight-color: transparent;
}

.btn:active {
    transform: scale(0.98);
}

.btn-primary {
    background: var(--accent-blue);
    border-color: var(--accent-blue);
    color: white;
}

.btn-small {
    padding: 0.375rem 0.75rem;
    min-height: 36px;
    font-size: 0.75rem;
}

.select {
    padding: 0.5rem 0.75rem;
    min-height: 44px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    font-size: 0.875rem;
}

.filter-group {
    display: flex;
    gap: 0.5rem;
}

.filter-group .select {
    min-height: 36px;
    padding: 0.375rem 0.5rem;
    font-size: 0.75rem;
}

/* Quick Actions */
.quick-actions {
    display: flex;
    gap: 0.5rem;
    padding: 1rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.quick-actions .btn {
    flex-shrink: 0;
}

/* Main Content */
.main {
    padding: 0 1rem 1rem;
}

.section {
    margin-bottom: 1.5rem;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
    padding: 0.5rem 0;
}

h2 {
    font-size: 1rem;
    font-weight: 600;
}

.badge {
    background: var(--accent-yellow);
    color: #000;
    padding: 0.125rem 0.5rem;
    border-radius: 10px;
    font-size: 0.75rem;
    font-weight: 600;
    margin-left: 0.5rem;
}

/* Questions Section - High visibility */
.questions-section {
    background: var(--bg-secondary);
    border: 2px solid var(--accent-yellow);
    border-radius: 12px;
    padding: 1rem;
    margin: 1rem;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { border-color: var(--accent-yellow); }
    50% { border-color: var(--accent-red); }
}

.questions-section h2 {
    color: var(--accent-yellow);
}

.question-card {
    background: var(--bg-tertiary);
    border-radius: 8px;
    padding: 1rem;
    margin-top: 0.75rem;
}

.question-text {
    font-size: 1rem;
    margin-bottom: 0.5rem;
}

.question-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
}

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

.question-actions .btn {
    flex: 1;
}

/* Agents Grid - Cards stack on mobile */
.agents-grid {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.agent-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1rem;
}

.agent-card.selected {
    border-color: var(--accent-blue);
}

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

.agent-title {
    font-weight: 600;
    font-size: 0.9375rem;
}

.agent-ticket {
    font-size: 0.8125rem;
    color: var(--accent-blue);
    font-weight: 500;
}

.agent-status {
    padding: 0.25rem 0.625rem;
    border-radius: 12px;
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    flex-shrink: 0;
}

.status-running {
    background: rgba(63, 185, 80, 0.2);
    color: var(--accent-green);
}

.status-completed {
    background: rgba(88, 166, 255, 0.2);
    color: var(--accent-blue);
}

.status-failed, .status-token_limit {
    background: rgba(248, 81, 73, 0.2);
    color: var(--accent-red);
}

.status-abandoned {
    background: rgba(110, 118, 129, 0.2);
    color: var(--text-muted);
}

.status-paused {
    background: rgba(210, 153, 34, 0.2);
    color: var(--accent-yellow);
}

.agent-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.5rem;
}

.agent-updates {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border-color);
    max-height: 120px;
    overflow-y: auto;
}

.agent-update {
    font-size: 0.75rem;
    color: var(--text-secondary);
    padding: 0.25rem 0;
}

.update-type {
    display: inline-block;
    padding: 0.125rem 0.375rem;
    background: var(--bg-primary);
    border-radius: 4px;
    font-size: 0.625rem;
    text-transform: uppercase;
    margin-right: 0.375rem;
}

/* User messages stand out */
.agent-update.user-message {
    background: rgba(88, 166, 255, 0.1);
    border-left: 2px solid var(--accent-blue);
    padding-left: 0.5rem;
    margin: 0.25rem 0;
}

.agent-update.user-message .update-type {
    background: var(--accent-blue);
    color: white;
}

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

.agent-message-input input {
    flex: 1;
    padding: 0.625rem;
    min-height: 44px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    font-size: 1rem;
}

.agent-message-input input:focus {
    outline: none;
    border-color: var(--accent-blue);
}

/* Activity Feed */
.activity-feed {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    max-height: 300px;
    overflow-y: auto;
}

.activity-feed.collapsed {
    max-height: 0;
    overflow: hidden;
    border: none;
}

.activity-item {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-color);
}

.activity-item:last-child {
    border-bottom: none;
}

.activity-time {
    font-size: 0.6875rem;
    color: var(--text-muted);
}

.activity-action {
    font-weight: 500;
    font-size: 0.875rem;
}

.activity-details {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

/* Modal - Full screen on mobile */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    align-items: flex-end;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 16px 16px 0 0;
    padding: 1.5rem;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-content h3 {
    font-size: 1.125rem;
    margin-bottom: 1rem;
}

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 0.375rem;
}

.full-width {
    width: 100%;
}

textarea.full-width {
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    font-size: 1rem;
    resize: vertical;
}

.modal-options {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.modal-option {
    padding: 1rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s;
    font-size: 1rem;
}

.modal-option:active, .modal-option.selected {
    border-color: var(--accent-blue);
    background: rgba(88, 166, 255, 0.15);
}

.modal-custom input {
    width: 100%;
    padding: 1rem;
    min-height: 44px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    font-size: 1rem;
}

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

.modal-actions .btn {
    flex: 1;
}

/* Command Bar */
.command-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 1rem;
    padding-bottom: calc(1rem + env(safe-area-inset-bottom));
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 0.5rem;
    z-index: 200;
}

.command-bar input {
    flex: 1;
    padding: 0.75rem;
    min-height: 44px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    font-size: 1rem;
}

/* Utilities */
.hidden {
    display: none !important;
}

.hide-mobile {
    display: none;
}

.loading {
    color: var(--text-muted);
    font-style: italic;
    padding: 2rem;
    text-align: center;
}

/* Tablet and up */
@media (min-width: 768px) {
    .header {
        padding: 1rem 2rem;
    }

    .logo-img {
        height: 40px;
    }

    .tagline {
        font-size: 0.875rem;
    }

    .hide-mobile {
        display: inline;
    }

    .main {
        max-width: 1200px;
        margin: 0 auto;
        padding: 1rem 2rem;
    }

    .quick-actions {
        padding: 1rem 0;
    }

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

    .modal {
        align-items: center;
    }

    .modal-content {
        border-radius: 16px;
        max-width: 500px;
    }

    h2 {
        font-size: 1.25rem;
    }
}
