/**
 * Claude Code Orchestrator - Styles
 */

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

:root {
    --primary-color: #2563eb;
    --success-color: #059669;
    --warning-color: #d97706;
    --danger-color: #dc2626;
    --bg-primary: #ffffff;
    --bg-secondary: #f9fafb;
    --bg-tertiary: #f3f4f6;
    --text-primary: #111827;
    --text-secondary: #6b7280;
    --border-color: #e5e7eb;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica', 'Arial', sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: var(--text-primary);
    background: var(--bg-secondary);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    /* Disable pull-to-refresh on mobile */
    overscroll-behavior-y: contain;
}

/* Improve touch interactions */
button, a, input, textarea, select {
    -webkit-tap-highlight-color: rgba(37, 99, 235, 0.3);
}

/* Prevent text selection on buttons */
button {
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}

/* Container */
.container {
    height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
.header {
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 1.5rem;
    /* Safe area support for notched devices */
    padding-top: max(1rem, env(safe-area-inset-top));
    padding-left: max(1.5rem, env(safe-area-inset-left));
    padding-right: max(1.5rem, env(safe-area-inset-right));
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header h1 {
    font-size: 1.5rem;
    font-weight: 600;
}

.connection-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

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

.status-indicator.online {
    background: var(--success-color);
}

.status-indicator.offline {
    background: var(--text-secondary);
}

/* Mobile menu button (hidden on desktop) */
.mobile-menu-btn {
    display: none;
    flex-direction: column;
    justify-content: space-around;
    width: 30px;
    height: 24px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    z-index: 1001;
}

.mobile-menu-btn span {
    width: 100%;
    height: 3px;
    background-color: var(--text-primary);
    border-radius: 2px;
    transition: all 0.3s ease;
}

.mobile-menu-btn.active span:nth-child(1) {
    transform: rotate(45deg) translate(8px, 8px);
}

.mobile-menu-btn.active span:nth-child(2) {
    opacity: 0;
}

.mobile-menu-btn.active span:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -7px);
}

/* Mobile menu overlay */
.mobile-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.mobile-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

/* Main content */
.main-content {
    flex: 1;
    display: flex;
    overflow: hidden;
}

/* Sidebar */
.sidebar {
    width: 320px;
    background: var(--bg-primary);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.sidebar-section {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-section h3 {
    font-size: 0.875rem;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.repo-select {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 0.375rem;
    font-size: 0.875rem;
    margin-bottom: 1rem;
}

.mode-toggle {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.mode-option {
    display: block;
    padding: 0.75rem;
    border: 2px solid var(--border-color);
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.2s;
}

.mode-option:hover {
    border-color: var(--primary-color);
    background: var(--bg-secondary);
}

.mode-option input[type="radio"] {
    margin-right: 0.5rem;
}

.mode-option input[type="radio"]:checked + span {
    font-weight: 600;
    color: var(--primary-color);
}

.mode-description {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-left: 1.5rem;
    margin-top: 0.25rem;
}

.session-info {
    font-size: 0.875rem;
}

.session-info p {
    margin-bottom: 0.5rem;
}

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

/* Chat container */
.chat-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--bg-primary);
}

/* Messages */
.messages {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.welcome-message {
    text-align: center;
    padding: 3rem 2rem;
    color: var(--text-secondary);
}

.welcome-message h2 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.message {
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    max-width: 80%;
    animation: fadeIn 0.2s;
}

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

.message-user {
    align-self: flex-end;
    background: var(--primary-color);
    color: white;
}

.message-assistant {
    align-self: flex-start;
    background: var(--bg-tertiary);
}

.message-system {
    align-self: center;
    background: var(--bg-secondary);
    color: var(--text-secondary);
    font-size: 0.875rem;
    max-width: 90%;
}

.message-progress {
    align-self: flex-start;
    background: #fef3c7;
    color: #92400e;
    border-left: 3px solid var(--warning-color);
}

.message-error {
    align-self: center;
    background: #fee2e2;
    color: #991b1b;
    border-left: 3px solid var(--danger-color);
}

.message-typing {
    align-self: flex-start;
    background: var(--bg-tertiary);
    padding: 1rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.typing-indicator {
    display: flex;
    gap: 0.375rem;
    align-items: center;
}

.typing-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-secondary);
    animation: typing 1.4s infinite;
}

.typing-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.7;
    }
    30% {
        transform: translateY(-10px);
        opacity: 1;
    }
}

.message-time {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

/* Message content formatting */
.message h1 {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0.75rem 0 0.5rem 0;
}

.message h2 {
    font-size: 1.125rem;
    font-weight: 600;
    margin: 0.75rem 0 0.5rem 0;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.25rem;
}

.message h3 {
    font-size: 1rem;
    font-weight: 600;
    margin: 0.625rem 0 0.375rem 0;
}

.message h1:first-child,
.message h2:first-child,
.message h3:first-child {
    margin-top: 0;
}

.message strong {
    font-weight: 600;
    color: var(--text-primary);
}

.message em {
    font-style: italic;
}

.message code {
    background: rgba(0, 0, 0, 0.05);
    padding: 0.125rem 0.375rem;
    border-radius: 0.25rem;
    font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Courier New', monospace;
    font-size: 0.875em;
    color: #c7254e;
}

.message pre {
    background: rgba(0, 0, 0, 0.05);
    padding: 0.75rem;
    border-radius: 0.375rem;
    overflow-x: auto;
    margin: 0.5rem 0;
}

.message pre code {
    background: none;
    padding: 0;
    color: inherit;
    font-size: 0.875rem;
}

.message ul,
.message ol {
    margin: 0.5rem 0;
    padding-left: 1.5rem;
}

.message li {
    margin: 0.25rem 0;
}

.message a {
    color: var(--primary-color);
    text-decoration: underline;
}

.message a:hover {
    text-decoration: none;
}

/* Special styling for progress messages */
.message-progress code {
    background: rgba(0, 0, 0, 0.1);
    color: #92400e;
}

.message-progress pre {
    background: rgba(0, 0, 0, 0.1);
}

/* Plan approval */
.plan-approval {
    border-top: 2px solid var(--primary-color);
    background: var(--bg-secondary);
    padding: 1.5rem;
    margin: 0 1.5rem 1.5rem;
    border-radius: 0.5rem;
}

.plan-header h3 {
    font-size: 1.125rem;
    margin-bottom: 1rem;
}

.plan-content {
    background: var(--bg-primary);
    padding: 1rem;
    border-radius: 0.375rem;
    margin-bottom: 1rem;
    white-space: pre-wrap;
    font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Courier New', monospace;
    font-size: 0.875rem;
    max-height: 300px;
    overflow-y: auto;
}

.plan-files {
    margin-bottom: 1rem;
}

.plan-files-header {
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.file-list {
    list-style: none;
    background: var(--bg-primary);
    border-radius: 0.375rem;
    padding: 0.5rem;
}

.file-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem;
    border-radius: 0.25rem;
    margin-bottom: 0.25rem;
}

.file-item:last-child {
    margin-bottom: 0;
}

.file-modified {
    background: #fef3c7;
}

.file-added {
    background: #d1fae5;
}

.file-deleted {
    background: #fee2e2;
}

.file-path {
    font-family: 'SF Mono', Monaco, monospace;
    font-size: 0.875rem;
}

.file-stats {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.plan-actions {
    display: flex;
    gap: 0.75rem;
}

/* Changed files panel */
.changed-files-panel {
    border-top: 1px solid var(--border-color);
    background: var(--bg-secondary);
    padding: 1.5rem;
    margin: 0 1.5rem 1.5rem;
    border-radius: 0.5rem;
}

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

.panel-header h3 {
    font-size: 1rem;
}

.btn-icon {
    background: none;
    border: none;
    font-size: 1.25rem;
    cursor: pointer;
    color: var(--text-secondary);
    padding: 0.25rem;
}

.btn-icon:hover {
    color: var(--text-primary);
}

.changed-files-list {
    margin-bottom: 1rem;
}

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

.file-status {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.125rem 0.5rem;
    border-radius: 0.25rem;
    background: var(--bg-secondary);
}

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

/* Input container */
.input-container {
    border-top: 1px solid var(--border-color);
    padding: 1rem 1.5rem;
    /* Safe area support for home indicator */
    padding-bottom: max(1rem, env(safe-area-inset-bottom));
    padding-left: max(1.5rem, env(safe-area-inset-left));
    padding-right: max(1.5rem, env(safe-area-inset-right));
    background: var(--bg-primary);
}

.chat-input-group {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.input-mode-toggle {
    display: flex;
    gap: 0.5rem;
    background: var(--bg-tertiary);
    padding: 0.25rem;
    border-radius: 0.5rem;
    width: fit-content;
}

.mode-toggle-btn {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    background: transparent;
    color: var(--text-secondary);
    transition: all 0.2s;
    white-space: nowrap;
}

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

.mode-toggle-btn.active {
    background: var(--primary-color);
    color: white;
    box-shadow: var(--shadow-sm);
}

.mode-toggle-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.message-input {
    flex: 1;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 0.375rem;
    font-family: inherit;
    font-size: 0.875rem;
    resize: vertical;
    transition: border-color 0.2s, opacity 0.2s;
}

.message-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.message-input:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    background: var(--bg-secondary);
}

.commit-container,
.modify-container {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

.commit-input {
    flex: 1;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 0.375rem;
    font-size: 0.875rem;
}

.modify-textarea {
    flex: 1;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 0.375rem;
    font-family: inherit;
    font-size: 0.875rem;
    min-height: 80px;
    resize: vertical;
}

/* Buttons */
.btn {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

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

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

.btn-primary:not(:disabled):hover {
    background: #1d4ed8;
}

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

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

.btn-success {
    background: var(--success-color);
    color: white;
}

.btn-success:not(:disabled):hover {
    background: #047857;
}

.btn-warning {
    background: var(--warning-color);
    color: white;
}

.btn-warning:not(:disabled):hover {
    background: #b45309;
}

.btn-danger {
    background: var(--danger-color);
    color: white;
}

.btn-danger:not(:disabled):hover {
    background: #b91c1c;
}

.sidebar .btn {
    width: 100%;
    margin-bottom: 0.5rem;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

/* ========================================
   New Feature Styles
   ======================================== */

/* Modal Styles */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 1rem;
    backdrop-filter: blur(2px);
}

.modal-content {
    background: var(--bg-primary);
    border-radius: 0.75rem;
    max-width: 600px;
    width: 100%;
    max-height: 80vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-lg);
    animation: modalSlideIn 0.3s ease-out;
}

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

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

.modal-header h2 {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    line-height: 1;
    transition: color 0.2s;
}

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

.modal-body {
    padding: 1.5rem;
    overflow-y: auto;
}

/* Session Cards */
.sessions-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.session-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    padding: 1rem;
    transition: box-shadow 0.2s, border-color 0.2s;
}

.session-card:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--primary-color);
}

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

.session-header strong {
    font-size: 1rem;
    color: var(--text-primary);
}

.session-status {
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
}

.session-status.active {
    background: rgba(5, 150, 105, 0.1);
    color: var(--success-color);
}

.session-status.completed {
    background: rgba(37, 99, 235, 0.1);
    color: var(--primary-color);
}

.session-status.abandoned {
    background: rgba(107, 114, 128, 0.1);
    color: var(--text-secondary);
}

.session-details {
    margin-bottom: 0.75rem;
}

.session-summary {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    line-height: 1.5;
}

.session-meta {
    display: flex;
    gap: 1rem;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.session-card .btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.875rem;
    width: 100%;
}

/* Thinking Toggle */
.thinking-toggle {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0;
}

.thinking-toggle input[type="checkbox"] {
    position: relative;
    width: 44px;
    height: 24px;
    appearance: none;
    background: var(--text-secondary);
    border-radius: 12px;
    cursor: pointer;
    transition: background 0.3s;
}

.thinking-toggle input[type="checkbox"]:checked {
    background: var(--primary-color);
}

.thinking-toggle input[type="checkbox"]::before {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: white;
    top: 2px;
    left: 2px;
    transition: transform 0.3s;
}

.thinking-toggle input[type="checkbox"]:checked::before {
    transform: translateX(20px);
}

.toggle-label {
    font-size: 0.875rem;
    color: var(--text-primary);
    user-select: none;
}

.thinking-tokens-input {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 0.375rem;
    font-size: 0.875rem;
    margin-top: 0.25rem;
}

.thinking-tokens-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* Tool Execution Details */
.tool-details {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.5rem;
    padding: 0.5rem;
    background: var(--bg-secondary);
    border-radius: 0.375rem;
    font-size: 0.75rem;
}

.tool-status {
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    font-weight: 500;
    text-transform: uppercase;
}

.tool-status.pending {
    background: rgba(217, 119, 6, 0.1);
    color: var(--warning-color);
}

.tool-status.success {
    background: rgba(5, 150, 105, 0.1);
    color: var(--success-color);
}

.tool-status.error {
    background: rgba(220, 38, 38, 0.1);
    color: var(--danger-color);
}

.tool-duration {
    color: var(--text-secondary);
    font-weight: 500;
}

/* Metadata Display */
.metadata {
    margin-top: 0.5rem;
    padding: 0.5rem;
    background: var(--bg-tertiary);
    border-left: 3px solid var(--primary-color);
    font-size: 0.75rem;
    color: var(--text-secondary);
    border-radius: 0.25rem;
}

/* Enhanced Message Styles for Tool Execution */
.message.tool {
    background: rgba(37, 99, 235, 0.05);
    border-left: 3px solid var(--primary-color);
}

.message.thinking {
    background: rgba(139, 92, 246, 0.05);
    border-left: 3px solid #8b5cf6;
}

/* Mobile Responsive Design */
@media (max-width: 768px) {
    /* Header adjustments */
    .header {
        padding: 0.75rem 1rem;
        flex-wrap: wrap;
        gap: 0.75rem;
    }

    .header h1 {
        font-size: 1.125rem;
        flex: 1;
        margin: 0;
    }

    .connection-status {
        font-size: 0.75rem;
        margin-left: auto;
    }

    /* Show mobile menu button */
    .mobile-menu-btn {
        display: flex;
    }

    /* Show overlay when sidebar is open */
    .mobile-overlay {
        display: block;
    }

    /* Sidebar becomes collapsible panel */
    .sidebar {
        width: 100%;
        max-height: none;
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 1000;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .sidebar-section {
        padding: 1rem;
    }

    .sidebar-section h3 {
        font-size: 0.75rem;
    }

    /* Main content fills screen on mobile */
    .main-content {
        flex-direction: column;
        position: relative;
    }

    /* Messages take full width */
    .messages {
        padding: 1rem;
    }

    .message {
        max-width: 90%;
        font-size: 0.875rem;
    }

    .message-system,
    .message-progress,
    .message-error {
        max-width: 95%;
    }

    /* Larger touch targets for buttons */
    .btn {
        padding: 0.75rem 1rem;
        font-size: 1rem;
        min-height: 44px;  /* iOS recommended touch target */
    }

    /* Plan approval on mobile */
    .plan-approval {
        margin: 0 0.5rem 0.5rem;
        padding: 1rem;
    }

    .plan-header h3 {
        font-size: 1rem;
    }

    .plan-content {
        font-size: 0.75rem;
        max-height: 200px;
        padding: 0.75rem;
    }

    .plan-actions {
        flex-direction: column;
        gap: 0.5rem;
    }

    .plan-actions .btn {
        width: 100%;
    }

    /* Changed files panel */
    .changed-files-panel {
        margin: 0 0.5rem 0.5rem;
        padding: 1rem;
    }

    .panel-header {
        flex-wrap: wrap;
    }

    .file-actions {
        flex-direction: column;
        gap: 0.5rem;
    }

    .file-actions .btn {
        width: 100%;
    }

    /* File items wrap text */
    .file-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.25rem;
    }

    .file-path {
        font-size: 0.75rem;
        word-break: break-all;
    }

    /* Input area adjustments */
    .input-container {
        padding: 0.75rem 1rem;
    }

    .chat-input-group {
        flex-direction: column;
        gap: 0.5rem;
    }

    .input-mode-toggle {
        width: 100%;
        justify-content: center;
    }

    .mode-toggle-btn {
        flex: 1;
        padding: 0.625rem 0.875rem;
        font-size: 0.8125rem;
    }

    .message-input {
        font-size: 1rem;  /* Prevents iOS zoom on focus */
        min-height: 44px;
    }

    .commit-container,
    .modify-container {
        flex-direction: column;
        gap: 0.5rem;
    }

    .commit-input,
    .modify-textarea {
        font-size: 1rem;  /* Prevents iOS zoom on focus */
    }

    /* Mode toggle stacks vertically */
    .mode-toggle {
        gap: 0.5rem;
    }

    .mode-option {
        padding: 0.625rem;
        font-size: 0.875rem;
    }

    .mode-description {
        font-size: 0.6875rem;
        margin-left: 1.25rem;
    }

    /* Repository select */
    .repo-select {
        font-size: 1rem;  /* Prevents iOS zoom on focus */
    }

    /* Welcome message */
    .welcome-message {
        padding: 2rem 1rem;
    }

    .welcome-message h2 {
        font-size: 1.25rem;
    }

    /* Session info more compact */
    .session-info {
        font-size: 0.8125rem;
    }

    .session-info p {
        margin-bottom: 0.375rem;
    }

    /* New feature responsive styles */
    .modal {
        padding: 0.5rem;
    }

    .modal-content {
        max-height: 90vh;
        border-radius: 0.5rem;
    }

    .modal-header,
    .modal-body {
        padding: 1rem;
    }

    .session-card {
        padding: 0.875rem;
    }

    .session-meta {
        flex-direction: column;
        gap: 0.25rem;
    }

    .thinking-toggle {
        flex-wrap: wrap;
    }

    .tool-details {
        flex-wrap: wrap;
        font-size: 0.6875rem;
    }

    .metadata {
        font-size: 0.6875rem;
    }
}

/* Tablet-specific adjustments */
@media (min-width: 769px) and (max-width: 1024px) {
    .sidebar {
        width: 280px;
    }

    .message {
        max-width: 85%;
    }

    .plan-actions {
        flex-wrap: wrap;
    }
}

/* Small mobile devices (< 375px) */
@media (max-width: 374px) {
    .header h1 {
        font-size: 1rem;
    }

    .btn {
        font-size: 0.875rem;
        padding: 0.625rem 0.875rem;
    }

    .message {
        font-size: 0.8125rem;
        padding: 0.625rem 0.875rem;
    }

    .plan-content {
        font-size: 0.6875rem;
    }
}

/* Landscape mobile adjustments */
@media (max-height: 500px) and (orientation: landscape) {
    .messages {
        padding: 0.75rem;
    }

    .sidebar-section {
        padding: 0.75rem;
    }

    .plan-approval,
    .changed-files-panel {
        margin: 0 0.5rem 0.5rem;
        padding: 0.75rem;
    }
}
