/* CSS Variables for theming */
:root {
    --bg-primary: #1a1a2e;
    --bg-secondary: #16213e;
    --bg-card: #0f3460;
    --text-primary: #eaeaea;
    --text-secondary: #a0a0a0;
    --accent-green: #4ade80;
    --accent-red: #f87171;
    --accent-yellow: #fbbf24;
    --accent-blue: #60a5fa;
    --border-radius: 12px;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
    --bottom-bar-height: 220px;
}

/* Reset and Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.5;
}

.container {
    max-width: 600px;
    margin: 0 auto;
    padding: 16px;
    padding-bottom: calc(var(--bottom-bar-height) + 20px); /* Space for fixed bottom bar */
}

/* Header Bar */
.header-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: var(--bg-secondary);
    border-radius: var(--border-radius);
    margin-bottom: 16px;
}

.app-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

.status-badge {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
}

.status-badge.connected {
    background: var(--accent-green);
    color: #000;
}

.status-badge.disconnected {
    background: var(--accent-red);
    color: #000;
}

/* Cards */
.card {
    background: var(--bg-card);
    border-radius: var(--border-radius);
    padding: 20px;
    margin-bottom: 16px;
    box-shadow: var(--shadow);
}

.card h2 {
    font-size: 16px;
    color: var(--text-secondary);
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Status Section */
.status-section {
    text-align: center;
}

.status-section .status-text {
    font-size: 16px;
    color: var(--text-secondary);
}

/* Pending Approval */
.pending-approval {
    border: 2px solid var(--accent-yellow);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(251, 191, 36, 0.4); }
    50% { box-shadow: 0 0 20px 10px rgba(251, 191, 36, 0.2); }
}

.tool-info {
    margin-bottom: 0;
}

.tool-name {
    display: inline-block;
    background: var(--accent-blue);
    color: #000;
    padding: 4px 12px;
    border-radius: 4px;
    font-weight: 600;
    margin-bottom: 12px;
}

.tool-input {
    background: var(--bg-primary);
    padding: 12px;
    border-radius: 8px;
    overflow-x: auto;
    font-family: 'Monaco', 'Consolas', monospace;
    font-size: 14px;
    white-space: pre-wrap;
    word-break: break-all;
    max-height: 200px;
    overflow-y: auto;
}

/* Completed Tasks */
.task-list {
    list-style: none;
    max-height: 300px;
    overflow-y: auto;
}

.task-list li {
    display: flex;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid var(--bg-secondary);
}

.task-list li:last-child {
    border-bottom: none;
}

.task-icon {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 12px;
    font-size: 14px;
    flex-shrink: 0;
}

.task-icon.approved {
    background: var(--accent-green);
    color: #000;
}

.task-icon.denied {
    background: var(--accent-red);
    color: #000;
}

.task-text {
    flex: 1;
    font-size: 14px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.task-time {
    font-size: 12px;
    color: var(--text-secondary);
    margin-left: 8px;
    flex-shrink: 0;
}

/* TODO List Styles */
.todo-list .todos {
    list-style: none;
    max-height: 300px;
    overflow-y: auto;
}

.todo-list .todos li {
    display: flex;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid var(--bg-secondary);
}

.todo-list .todos li:last-child {
    border-bottom: none;
}

.todo-icon {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 12px;
    font-size: 12px;
    flex-shrink: 0;
    border: 2px solid;
}

.todo-icon.pending {
    border-color: var(--text-secondary);
    color: var(--text-secondary);
}

.todo-icon.in_progress {
    border-color: var(--accent-yellow);
    background: var(--accent-yellow);
    color: #000;
    animation: spin 2s linear infinite;
}

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

.todo-icon.completed {
    border-color: var(--accent-green);
    background: var(--accent-green);
    color: #000;
}

.todo-text {
    flex: 1;
    font-size: 14px;
}

.todo-text.in_progress {
    color: var(--accent-yellow);
    font-weight: 600;
}

.todo-text.completed {
    color: var(--text-secondary);
    text-decoration: line-through;
}

/* Notifications Container */
.notifications-container {
    text-align: center;
    padding: 20px;
}

.enable-notifications-btn {
    display: inline-block;
    padding: 16px 32px;
    background: var(--accent-yellow);
    color: #000;
    border: none;
    border-radius: var(--border-radius);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.1s, opacity 0.2s;
}

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

.notifications-status {
    margin-top: 12px;
    color: var(--accent-green);
    font-size: 14px;
}

/* Fixed Bottom Bar */
.bottom-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bg-secondary);
    border-top: 1px solid var(--bg-card);
    padding: 12px 16px;
    padding-bottom: max(12px, env(safe-area-inset-bottom));
}

/* Action Buttons in Bottom Bar */
.bottom-bar .action-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    max-width: 600px;
    margin: 0 auto 12px;
}

.action-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 16px;
    border: none;
    border-radius: var(--border-radius);
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.1s, box-shadow 0.1s, opacity 0.2s;
    min-height: 70px;
}

.action-btn:active:not(:disabled) {
    transform: scale(0.95);
}

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

.action-btn .btn-icon {
    font-size: 24px;
    margin-bottom: 2px;
}

.action-btn.approve {
    background: var(--accent-green);
    color: #000;
}

.action-btn.approve:hover:not(:disabled) {
    box-shadow: 0 0 20px rgba(74, 222, 128, 0.5);
}

.action-btn.deny {
    background: var(--accent-red);
    color: #000;
}

.action-btn.deny:hover:not(:disabled) {
    box-shadow: 0 0 20px rgba(248, 113, 113, 0.5);
}

/* Stats Row */
.stats-row {
    display: flex;
    justify-content: center;
    gap: 40px;
    padding: 8px 0;
    max-width: 600px;
    margin: 0 auto;
    border-bottom: 1px solid var(--bg-card);
}

.stat {
    text-align: center;
}

.stat-value {
    display: block;
    font-size: 20px;
    font-weight: 700;
}

.stat-label {
    font-size: 11px;
    color: var(--text-secondary);
    text-transform: uppercase;
}

.stat.approved .stat-value {
    color: var(--accent-green);
}

.stat.denied .stat-value {
    color: var(--accent-red);
}

/* YOLO Row */
.yolo-row {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    padding-top: 10px;
    max-width: 600px;
    margin: 0 auto;
}

.yolo-label {
    font-size: 14px;
    color: var(--text-secondary);
    font-weight: 500;
}

.toggle-btn {
    padding: 6px 20px;
    border: none;
    border-radius: 20px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 14px;
}

.toggle-btn.off {
    background: var(--text-secondary);
    color: var(--bg-primary);
}

.toggle-btn.on {
    background: var(--accent-yellow);
    color: #000;
}

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

/* Mobile Optimizations */
@media (max-width: 480px) {
    .container {
        padding: 12px;
    }

    .header-bar {
        padding: 10px 12px;
    }

    .app-title {
        font-size: 16px;
    }

    .bottom-bar {
        padding: 10px 12px;
    }

    .action-btn {
        padding: 14px;
        min-height: 60px;
    }

    .action-btn .btn-icon {
        font-size: 22px;
    }

    .action-btn .btn-text {
        font-size: 14px;
    }

    .stats-row {
        gap: 24px;
    }

    .stat-value {
        font-size: 18px;
    }
}

/* Haptic feedback simulation for mobile */
@media (hover: none) {
    .action-btn:active:not(:disabled) {
        transform: scale(0.92);
    }
}
