/* Paruna Dashboard — Dark Cat Theme */
:root {
    --bg-primary: #0a0a0f;
    --bg-secondary: #12121a;
    --bg-card: #1a1a2e;
    --bg-hover: #22223a;
    --accent-yellow: #FFD700;
    --accent-purple: #9b59b6;
    --accent-pink: #FF6B9D;
    --accent-green: #2ecc71;
    --accent-red: #e74c3c;
    --accent-blue: #3498db;
    --text-primary: #e8e8e8;
    --text-secondary: #888;
    --border: #2a2a3e;
    --safe-top: env(safe-area-inset-top, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-tap-highlight-color: transparent;
}

#app {
    max-width: 480px;
    margin: 0 auto;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    padding-top: var(--safe-top);
    padding-bottom: calc(60px + var(--safe-bottom));
}

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

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo h1 {
    font-size: 20px;
    font-weight: 700;
    background: linear-gradient(135deg, var(--accent-yellow), var(--accent-purple));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.cat-icon {
    filter: drop-shadow(0 0 6px rgba(255, 215, 0, 0.4));
    animation: catPulse 3s ease-in-out infinite;
}

@keyframes catPulse {
    0%, 100% { filter: drop-shadow(0 0 6px rgba(255, 215, 0, 0.4)); }
    50% { filter: drop-shadow(0 0 12px rgba(255, 215, 0, 0.7)); }
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--accent-red);
    transition: background 0.3s, box-shadow 0.3s;
}

.status-dot.connected {
    background: var(--accent-green);
    box-shadow: 0 0 8px rgba(46, 204, 113, 0.5);
    animation: dotPulse 2s infinite;
}

@keyframes dotPulse {
    0%, 100% { box-shadow: 0 0 8px rgba(46, 204, 113, 0.5); }
    50% { box-shadow: 0 0 16px rgba(46, 204, 113, 0.8); }
}

/* Tabs */
.tabs {
    display: flex;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 56px;
    z-index: 99;
}

.tab {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 8px 4px;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 11px;
    cursor: pointer;
    transition: all 0.3s;
    position: relative;
}

.tab::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 20%;
    width: 60%;
    height: 2px;
    background: transparent;
    border-radius: 1px;
    transition: all 0.3s;
}

.tab.active {
    color: var(--accent-yellow);
}

.tab.active::after {
    background: var(--accent-yellow);
    box-shadow: 0 0 8px rgba(255, 215, 0, 0.5);
}

.tab svg { opacity: 0.6; transition: opacity 0.3s; }
.tab.active svg { opacity: 1; }

/* Content */
.content {
    flex: 1;
    padding: 16px;
    overflow-y: auto;
}

.tab-content { display: none; animation: fadeIn 0.3s ease; }
.tab-content.active { display: block; }

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Task Card */
.task-card {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 16px;
    margin-bottom: 16px;
    border: 1px solid var(--border);
    animation: slideIn 0.4s ease;
}

@keyframes slideIn {
    from { opacity: 0; transform: translateY(-12px); }
    to { opacity: 1; transform: translateY(0); }
}

.task-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.pulse-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent-yellow);
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(1.3); }
}

.task-name {
    font-size: 14px;
    font-weight: 600;
}

.progress-bar {
    height: 6px;
    background: var(--bg-primary);
    border-radius: 3px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-yellow), var(--accent-purple));
    border-radius: 3px;
    transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    width: 0%;
}

.progress-text {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 6px;
    display: block;
}

/* Live Log */
.log-container {
    background: var(--bg-card);
    border-radius: 16px;
    border: 1px solid var(--border);
    overflow: hidden;
}

.log-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
    font-weight: 600;
    color: var(--accent-yellow);
}

.log-entries {
    max-height: 60vh;
    overflow-y: auto;
    padding: 8px 0;
    scroll-behavior: smooth;
}

.log-entry {
    display: flex;
    gap: 10px;
    padding: 6px 16px;
    font-size: 12px;
    font-family: 'SF Mono', 'Fira Code', monospace;
    animation: logSlide 0.3s ease;
}

@keyframes logSlide {
    from { opacity: 0; transform: translateX(-8px); }
    to { opacity: 1; transform: translateX(0); }
}

.log-time {
    color: var(--text-secondary);
    white-space: nowrap;
    min-width: 50px;
}

.log-msg { flex: 1; word-break: break-word; }

.log-entry.search .log-msg { color: var(--accent-blue); }
.log-entry.success .log-msg { color: var(--accent-green); }
.log-entry.warning .log-msg { color: var(--accent-yellow); }
.log-entry.error .log-msg { color: var(--accent-red); }
.log-entry.agent .log-msg { color: var(--accent-purple); }
.log-entry.system .log-msg { color: var(--text-secondary); font-style: italic; }

/* Files */
.breadcrumb {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    padding: 10px 0;
    font-size: 13px;
}

.crumb {
    color: var(--text-secondary);
    cursor: pointer;
    transition: color 0.2s;
}

.crumb:hover, .crumb.active { color: var(--accent-yellow); }

.crumb::after { content: ' ›'; color: var(--border); }
.crumb:last-child::after { content: ''; }

.file-list { display: flex; flex-direction: column; gap: 2px; }

.file-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--bg-card);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid transparent;
}

.file-item:hover, .file-item:active {
    background: var(--bg-hover);
    border-color: var(--border);
}

.file-item.loading {
    justify-content: center;
    color: var(--text-secondary);
    cursor: default;
}

.file-icon {
    font-size: 20px;
    min-width: 24px;
    text-align: center;
}

.file-info { flex: 1; min-width: 0; }
.file-name { font-size: 14px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-meta { font-size: 11px; color: var(--text-secondary); }

.file-viewer {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: var(--bg-primary);
    z-index: 200;
    display: flex;
    flex-direction: column;
}

.file-viewer pre {
    flex: 1;
    overflow: auto;
    padding: 16px;
    font-size: 12px;
    font-family: 'SF Mono', 'Fira Code', monospace;
    color: var(--accent-green);
    background: var(--bg-primary);
    white-space: pre-wrap;
    word-break: break-word;
}

.close-viewer {
    background: var(--bg-card);
    border: none;
    color: var(--text-primary);
    font-size: 18px;
    padding: 12px 20px;
    cursor: pointer;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

/* VPS */
.vps-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.vps-card {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 16px;
    border: 1px solid var(--border);
    animation: fadeScale 0.4s ease;
}

.vps-card.wide { grid-column: 1 / -1; }

@keyframes fadeScale {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

.vps-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.vps-value {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 8px;
}

.vps-bar {
    height: 4px;
    background: var(--bg-primary);
    border-radius: 2px;
    overflow: hidden;
}

.vps-bar-fill {
    height: 100%;
    border-radius: 2px;
    transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
    width: 0%;
}

.vps-card:nth-child(1) .vps-bar-fill { background: var(--accent-blue); }
.vps-card:nth-child(2) .vps-bar-fill { background: var(--accent-purple); }
.vps-card:nth-child(3) .vps-bar-fill { background: var(--accent-yellow); }

.container-list {
    font-size: 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 8px;
}

.container-item {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    border-bottom: 1px solid var(--border);
}

.container-status {
    display: flex;
    align-items: center;
    gap: 6px;
}

.container-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
}

.container-dot.running { background: var(--accent-green); box-shadow: 0 0 4px rgba(46,204,113,0.5); }
.container-dot.stopped { background: var(--accent-red); }

/* Agents */
.agents-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.agent-empty {
    text-align: center;
    color: var(--text-secondary);
    padding: 40px 20px;
    font-size: 14px;
}

.agent-card {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 16px;
    border: 1px solid var(--accent-purple);
    border-left: 3px solid var(--accent-purple);
    animation: slideIn 0.4s ease;
    transition: border-color 0.3s, box-shadow 0.3s;
}

.agent-card.agent-running {
    border-color: var(--accent-blue);
    border-left-color: var(--accent-blue);
    box-shadow: 0 0 12px rgba(52, 152, 219, 0.15);
    animation: slideIn 0.4s ease, pulse 2s infinite;
}

.agent-card.agent-done {
    border-color: var(--accent-green);
    border-left-color: var(--accent-green);
    box-shadow: none;
}

.agent-card.agent-error {
    border-color: var(--accent-red);
    border-left-color: var(--accent-red);
    box-shadow: none;
}

@keyframes pulse {
    0%, 100% { box-shadow: 0 0 12px rgba(52, 152, 219, 0.15); }
    50% { box-shadow: 0 0 20px rgba(52, 152, 219, 0.3); }
}

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

.agent-name {
    font-weight: 600;
    font-size: 14px;
    color: var(--accent-purple);
}

.agent-status {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 10px;
    background: rgba(155, 89, 182, 0.2);
    color: var(--accent-purple);
}

.agent-task {
    font-size: 12px;
    color: var(--text-secondary);
}

.agent-meta {
    display: flex;
    gap: 12px;
    font-size: 11px;
    margin-bottom: 4px;
}

.agent-type {
    color: var(--accent-blue);
    background: rgba(52, 152, 219, 0.15);
    padding: 1px 8px;
    border-radius: 8px;
}

.agent-model {
    color: var(--text-secondary);
}

.model-banner {
    background: linear-gradient(135deg, rgba(155, 89, 182, 0.15), rgba(52, 152, 219, 0.15));
    border: 1px solid var(--accent-purple);
    border-radius: 16px;
    padding: 16px 20px;
    margin-bottom: 16px;
    text-align: center;
    transition: all 0.3s ease;
}

.model-banner.model-changed {
    animation: modelFlash 1s ease;
    box-shadow: 0 0 20px rgba(155, 89, 182, 0.3);
}

@keyframes modelFlash {
    0% { box-shadow: 0 0 0px rgba(155, 89, 182, 0); }
    50% { box-shadow: 0 0 30px rgba(155, 89, 182, 0.5); }
    100% { box-shadow: 0 0 20px rgba(155, 89, 182, 0.3); }
}

.model-label {
    font-size: 11px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 4px;
}

.model-name {
    font-size: 20px;
    font-weight: 700;
    color: var(--accent-purple);
    letter-spacing: 0.5px;
}

.model-changed {
    font-size: 10px;
    color: var(--text-secondary);
    margin-top: 2px;
}
}

/* Scrollbar */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

/* Jobs Tab */
.jobs-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.jobs-title {
    font-size: 16px;
    font-weight: 600;
}

.jobs-count {
    font-size: 12px;
    background: var(--bg-card);
    color: var(--accent-yellow);
    padding: 4px 10px;
    border-radius: 12px;
    font-weight: 600;
}

.jobs-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.job-empty {
    text-align: center;
    color: var(--text-secondary);
    padding: 40px 20px;
    font-size: 14px;
}

.job-card {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 16px;
    border: 1px solid var(--border);
    border-left: 3px solid var(--accent-yellow);
    animation: slideIn 0.4s ease;
}

.job-card.disabled {
    opacity: 0.5;
    border-left-color: var(--text-secondary);
}

.job-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.job-name {
    font-weight: 600;
    font-size: 14px;
    color: var(--accent-yellow);
}

.job-status {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 10px;
}

.job-status.active {
    background: rgba(255, 215, 0, 0.15);
    color: var(--accent-yellow);
}

.job-status.paused {
    background: rgba(136, 136, 136, 0.15);
    color: var(--text-secondary);
}

.job-schedule {
    font-size: 12px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 6px;
}

.job-next {
    font-size: 11px;
    color: var(--accent-purple);
}

.job-last-run {
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 4px;
}