/* Shell Mirror Dashboard - Dark Theme (Kraken Pro Style) */

:root {
    --bg-primary: #0a0b0d;
    --bg-secondary: #141519;
    --bg-tertiary: #1a1b20;
    --bg-hover: #22232a;
    --text-primary: #ffffff;
    --text-secondary: #8a8f98;
    --text-muted: #5a5f6a;
    --accent: #5d5fef;
    --accent-hover: #4a4cd6;
    --success: #00c853;
    --warning: #ff9800;
    --danger: #ef4444;
    --border: #2a2b30;
    --border-light: #3a3b40;
}

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

html {
    background: #0a0b0d;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    line-height: 1.5;
    color: var(--text-primary);
    background: var(--bg-primary) !important;
    min-height: 100vh;
}

/* Header - Minimal */
.dashboard-header {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    padding: 12px 0;
}

.header-content {
    max-width: 800px;
    margin: 0 auto;
    padding: 0 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo h1 {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-primary);
}

.logo .subtitle {
    display: none;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-section {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* User Dropdown */
.user-info {
    display: flex;
    align-items: center;
    gap: 8px;
}

.user-name {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.user-dropdown {
    position: relative;
}

.dropdown-btn {
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-secondary);
    padding: 6px 10px;
    cursor: pointer;
    transition: all 0.15s ease;
    font-size: 0.85rem;
}

.dropdown-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.dropdown-content {
    display: none;
    position: absolute;
    right: 0;
    top: calc(100% + 4px);
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    min-width: 140px;
    border-radius: 8px;
    overflow: hidden;
    z-index: 1000;
}

.dropdown-content a {
    color: var(--text-secondary);
    padding: 10px 14px;
    text-decoration: none;
    display: block;
    font-size: 0.85rem;
    transition: all 0.15s ease;
}

.dropdown-content a:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.user-dropdown:hover .dropdown-content {
    display: block;
}

/* Hide unnecessary header elements */
.dashboard-controls,
.help-button,
.refresh-btn,
.cleanup-btn-inline,
.btn-text-action {
    display: none !important;
}

/* Main Content */
.dashboard-main {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px 16px;
}

/* Hide Quick Actions completely */
.dashboard-grid {
    display: block;
}

/* Cards - Minimal */
.dashboard-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 16px;
}

.dashboard-card:hover {
    box-shadow: none;
}

.dashboard-card.full-width {
    display: block;
}

/* Card Header */
.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.card-title-section {
    display: flex;
    align-items: center;
    gap: 8px;
}

.card-header h2 {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.agent-count {
    display: none;
}

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

/* Hide header action buttons */
.agent-actions-header {
    display: none;
}

/* Agent Items */
.agent-item {
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
}

.agent-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.agent-item:first-child {
    padding-top: 0;
}

.agent-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.agent-info {
    flex: 1;
}

.agent-name-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 4px;
}

.agent-name {
    font-weight: 600;
    font-size: 1rem;
    color: var(--text-primary);
    flex: 1;
    min-width: 0;
}

/* Agent Menu Dropdown */
.agent-menu {
    position: relative;
    flex-shrink: 0;
    margin-left: 8px;
}

.btn-agent-menu {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.15s ease;
    line-height: 1;
}

.btn-agent-menu:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
}

.agent-menu-dropdown {
    display: none;
    position: absolute;
    right: -8px;
    top: calc(100% + 4px);
    background: var(--bg-primary);
    border: 1px solid var(--border-light);
    border-radius: 8px;
    min-width: 160px;
    z-index: 1000;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
}

.agent-menu-dropdown.show {
    display: block;
}

.agent-menu-dropdown button {
    width: 100%;
    padding: 10px 14px;
    background: none;
    border: none;
    color: var(--danger);
    text-align: left;
    cursor: pointer;
    font-size: 0.85rem;
    transition: background 0.15s ease;
}

.agent-menu-dropdown button:hover {
    background: var(--bg-hover);
}

.agent-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.agent-status.online {
    color: var(--text-secondary);
    background: none;
    padding: 0;
}

.agent-status.online::before {
    content: '';
    width: 8px;
    height: 8px;
    background: var(--success);
    border-radius: 50%;
}

.agent-status.recent {
    color: var(--text-secondary);
    background: none;
    padding: 0;
}

.agent-status.recent::before {
    content: '';
    width: 8px;
    height: 8px;
    background: var(--warning);
    border-radius: 50%;
}

.agent-status.offline {
    color: var(--text-secondary);
    background: none;
    padding: 0;
}

.agent-status.offline::before {
    content: '';
    width: 8px;
    height: 8px;
    background: var(--danger);
    border-radius: 50%;
}

.agent-session-count {
    color: var(--text-muted);
    font-weight: 400;
    font-size: 0.75rem;
}

.agent-last-seen {
    display: none;
}

/* Inline Sessions */
.agent-sessions-inline {
    margin-top: 12px;
    padding-top: 0;
    border-top: none;
}

.sessions-label {
    display: none;
}

.sessions-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 8px;
}

.inline-session-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: var(--bg-tertiary);
    border-radius: 6px;
    border: 1px solid var(--border);
    transition: all 0.15s ease;
}

.inline-session-item:hover {
    background: var(--bg-hover);
    border-color: var(--border-light);
}

.session-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.session-name {
    font-weight: 500;
    font-size: 0.9rem;
    flex: 1;
}

.session-activity {
    display: none;
}

.btn-session-connect {
    padding: 6px 14px;
    font-size: 0.8rem;
    font-weight: 500;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.15s ease;
    color: white;
}

.btn-session-connect:hover {
    transform: none;
    filter: brightness(1.1);
}

/* New Session Button - styled like session row */
.btn-new-session {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    border: 1px dashed var(--border-light);
    border-radius: 6px;
    padding: 12px 16px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    width: 100%;
    transition: all 0.15s ease;
}

.btn-new-session:hover {
    background: var(--bg-hover);
    border-color: var(--accent);
    border-style: solid;
    color: var(--accent);
}

.btn-new-session .plus-icon {
    font-size: 1.1rem;
    font-weight: 400;
}

/* Offline Agent */
.agent-item.agent-offline {
    opacity: 0.5;
}

.agent-offline-message {
    margin-top: 8px;
    padding: 8px;
    background: var(--bg-tertiary);
    border-radius: 4px;
    color: var(--text-muted);
    font-size: 0.8rem;
    text-align: center;
}

/* Primary Button */
.btn-primary {
    background: var(--accent);
    color: white;
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
    display: inline-flex;
    align-items: center;
    text-decoration: none;
    font-size: 0.9rem;
}

.btn-primary:hover {
    background: var(--accent-hover);
    transform: none;
}

.btn-primary.large {
    padding: 14px 28px;
    font-size: 1rem;
    border-radius: 8px;
}

/* Loading */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-primary);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.loading-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--border);
    border-top: 3px solid var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-bottom: 16px;
}

.loading-overlay p {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Login Overlay */
.login-button-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.centered-login {
    text-align: center;
}

/* Empty State */
.no-data {
    text-align: center;
    color: var(--text-muted);
    padding: 20px;
    font-size: 0.9rem;
}

.no-data a {
    color: var(--accent);
    text-decoration: none;
}

.no-data a:hover {
    text-decoration: underline;
}

/* Empty Agent State - Minimal */
.empty-agent-state {
    padding: 8px 0;
}

.empty-state-title {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 16px;
    text-align: center;
}

.empty-state-steps {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.command-step {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.step-label {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.command-box {
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 10px 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.command-box code {
    font-family: 'Monaco', 'Menlo', monospace;
    font-size: 0.85rem;
    color: var(--text-primary);
    flex: 1;
}

.copy-btn {
    background: var(--bg-hover);
    color: var(--text-secondary);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 4px 10px;
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.15s ease;
    min-width: 50px;
    text-align: center;
}

.copy-btn:hover {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
}

/* Empty state - additional content */
.empty-state-note {
    color: var(--text-muted);
    font-size: 0.75rem;
    margin: 16px 0;
    text-align: center;
}

.empty-state-troubleshooting {
    margin-top: 24px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

.troubleshooting-title {
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 500;
    display: block;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.empty-state-troubleshooting ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.empty-state-troubleshooting li {
    color: var(--text-muted);
    font-size: 0.75rem;
    padding: 4px 0;
    padding-left: 12px;
    position: relative;
}

.empty-state-troubleshooting li::before {
    content: '•';
    position: absolute;
    left: 0;
    color: var(--text-muted);
}

/* Collapsible help section */
.collapsible-help {
    margin-top: 32px;
    padding: 0 32px;
}

.help-toggle {
    width: 100%;
    background: transparent;
    border: none;
    padding: 12px 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: var(--text-muted);
    font-size: 0.8rem;
    cursor: pointer;
    transition: color 0.2s ease;
}

.help-toggle:hover {
    color: var(--text-secondary);
}

.help-arrow {
    transition: transform 0.2s ease;
    color: var(--text-muted);
}

.help-arrow.rotated {
    transform: rotate(180deg);
}

.help-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.help-content.expanded {
    max-height: 300px;
    padding: 16px 0;
}

.help-step {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 12px;
}

.help-step-label {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-muted);
}

.help-step code {
    background: var(--bg-tertiary);
    padding: 8px 12px;
    border-radius: 4px;
    font-family: 'Monaco', 'Menlo', monospace;
    font-size: 0.75rem;
    color: var(--text-muted);
    display: inline-block;
}

.help-note {
    color: var(--text-muted);
    font-size: 0.7rem;
    margin-top: 8px;
    font-style: italic;
}

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.modal {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 8px;
    max-width: 400px;
    width: 90%;
    max-height: 80vh;
    overflow: hidden;
}

.modal-header {
    padding: 16px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    color: var(--text-muted);
    padding: 4px;
    border-radius: 4px;
}

.modal-close:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.modal-body {
    padding: 16px;
}

/* Help Modal Content */
.help-modal-content {
    color: var(--text-secondary);
}

.help-intro {
    margin-bottom: 16px;
    font-size: 0.9rem;
}

.help-step {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
}

.help-step .step-number {
    width: 24px;
    height: 24px;
    background: var(--accent);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 600;
    flex-shrink: 0;
}

.help-step .step-content {
    flex: 1;
}

.help-step .step-content h4 {
    font-size: 0.9rem;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.help-step .command-box {
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 10px 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.help-step .command-box code {
    font-family: 'Monaco', 'Menlo', monospace;
    font-size: 0.85rem;
    color: var(--success);
}

.help-note {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 6px;
}

.help-troubleshooting {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

.help-troubleshooting h4 {
    font-size: 0.85rem;
    color: var(--text-primary);
    margin-bottom: 10px;
}

.help-troubleshooting ul {
    list-style: none;
    font-size: 0.85rem;
}

.help-troubleshooting li {
    padding: 4px 0;
    padding-left: 16px;
    position: relative;
}

.help-troubleshooting li::before {
    content: '•';
    position: absolute;
    left: 0;
    color: var(--text-muted);
}

/* Notifications */
.agent-notification {
    position: fixed;
    top: 60px;
    right: 16px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    color: var(--text-primary);
    padding: 10px 16px;
    border-radius: 6px;
    font-size: 0.85rem;
    z-index: 3000;
    animation: slideInRight 0.2s ease-out;
    border-left: 3px solid;
}

.agent-notification.connected {
    border-left-color: var(--success);
}

.agent-notification.disconnected {
    border-left-color: var(--danger);
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Animated Loading Dots */
.loading-dots {
    display: inline-flex;
    gap: 2px;
}

.loading-dots span {
    animation: loadingDot 1.2s infinite;
    opacity: 0.3;
}

.loading-dots span:nth-child(2) { animation-delay: 0.15s; }
.loading-dots span:nth-child(3) { animation-delay: 0.3s; }

@keyframes loadingDot {
    0%, 80%, 100% { opacity: 0.3; }
    40% { opacity: 1; }
}

/* Mobile Responsive - Touch-friendly */
@media (max-width: 768px) {
    .header-content {
        padding: 0 12px;
    }

    .logo h1 {
        font-size: 1.1rem;
    }

    .user-name {
        display: none;
    }

    .dropdown-btn {
        min-width: 44px;
        min-height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .dashboard-main {
        padding: 12px 8px;
        padding-bottom: 60px; /* Space for footer */
    }

    .dashboard-card {
        padding: 12px;
        border-radius: 6px;
        margin-bottom: 12px;
        border-left: none;
        border-right: none;
        border-radius: 0;
    }

    .card-header h2 {
        font-size: 0.85rem;
    }

    .agent-item {
        padding: 14px 0;
    }

    .agent-name-row {
        margin-bottom: 6px;
    }

    .agent-name {
        font-size: 1rem;
    }

    .btn-delete-agent {
        min-width: 44px;
        min-height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .inline-session-item {
        padding: 14px;
        min-height: 52px;
    }

    .btn-session-connect {
        padding: 10px 18px;
        min-height: 44px;
        font-size: 0.85rem;
    }

    .btn-new-session {
        padding: 14px 16px;
        min-height: 48px;
        font-size: 0.9rem;
    }

    /* Empty state mobile */
    .empty-agent-state {
        padding: 4px 0;
    }

    .command-box {
        padding: 12px;
    }

    .command-box code {
        font-size: 0.8rem;
    }

    .copy-btn {
        min-height: 36px;
        padding: 8px 12px;
    }

    /* Modal mobile */
    .modal {
        width: 95%;
        max-height: 90vh;
    }

    .modal-body {
        padding: 12px;
    }
}

/* Extra small screens */
@media (max-width: 375px) {
    .dashboard-main {
        padding: 8px 4px;
    }

    .dashboard-card {
        padding: 10px 8px;
    }

    .agent-name {
        font-size: 0.95rem;
    }

    .btn-session-connect {
        padding: 8px 12px;
        font-size: 0.8rem;
    }

    .session-name {
        font-size: 0.85rem;
    }
}

/* Hide these sections completely via CSS */
.dashboard-card:has(.action-buttons) {
    display: none !important;
}

/* Skeleton loading - dark theme */
.skeleton-content {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.skeleton-agent,
.skeleton-action,
.skeleton-session {
    height: 50px;
    background: linear-gradient(90deg, var(--bg-tertiary) 25%, var(--bg-hover) 50%, var(--bg-tertiary) 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
    border-radius: 6px;
}

@keyframes loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Blurred preview */
.dashboard-grid.blurred {
    filter: blur(2px);
    opacity: 0.5;
    pointer-events: none;
}

/* API Error */
.api-error {
    text-align: center;
    padding: 16px;
    background: var(--bg-tertiary);
    border: 1px solid var(--danger);
    border-radius: 6px;
    color: var(--danger);
}

/* Connection status */
.connection-status {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.connection-status.connected { color: var(--success); }
.connection-status.disconnected { color: var(--warning); }
.connection-status.error { color: var(--danger); }

/* Dashboard content wrapper */
.dashboard-content-wrapper {
    display: contents;
}

/* Usage Instructions - muted helper section (borderless, floating) */
.usage-instructions {
    margin-top: 48px;
    padding: 0 32px;
    color: var(--text-muted);
    font-size: 0.8rem;
}

.usage-step {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 12px;
}

.usage-step-num {
    width: 20px;
    height: 20px;
    background: var(--bg-tertiary);
    color: var(--text-muted);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 600;
    flex-shrink: 0;
}

.usage-step-content {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.usage-step-title {
    color: var(--text-secondary);
    font-size: 0.8rem;
}

.usage-instructions code {
    background: var(--bg-tertiary);
    padding: 4px 8px;
    border-radius: 4px;
    font-family: 'Monaco', 'Menlo', monospace;
    font-size: 0.75rem;
    color: var(--text-muted);
    display: inline-block;
}

.usage-note {
    color: var(--text-muted);
    font-size: 0.75rem;
    margin: 8px 0 16px 32px;
}

.usage-troubleshooting {
    margin-top: 16px;
}

.usage-trouble-title {
    color: var(--text-muted);
    font-size: 0.75rem;
    display: block;
    margin-bottom: 8px;
}

.usage-troubleshooting ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.usage-troubleshooting li {
    color: var(--text-muted);
    font-size: 0.75rem;
    padding: 3px 0;
    padding-left: 12px;
    position: relative;
}

.usage-troubleshooting li::before {
    content: '•';
    position: absolute;
    left: 0;
    color: var(--text-muted);
}
