:root {
    --bg: #fafbfc;
    --surface: #ffffff;
    --border: #e5e7eb;
    --text: #111827;
    --text-secondary: #6b7280;
    --text-muted: #9ca3af;
    --accent: #3b82f6;
    --accent-hover: #2563eb;
    --success: #10b981;
    --error: #ef4444;
    --error-hover: #b22222;
    --radius: 8px;
    --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --shadow-header: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
}

[data-theme="dark"] {
    --bg: #0f172a;
    --surface: #1e293b;
    --border: #334155;
    --text: #f8fafc;
    --text-secondary: #cbd5e1;
    --text-muted: #64748b;
    --accent: #3b82f6;
    --accent-hover: #2563eb;
    --success: #10b981;
    --error: #ef4444;
    --error-hover: #b22222;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    overflow: hidden;
    height: 100vh;
}

.app {
    display: grid;
    grid-template-rows: auto 1fr;
    height: 100vh;
}

/* Header */
.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-header); /* Ajout de l'ombre */
}

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

.brand h1 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text);
}

.brand-author {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 400;
    line-height: 1.2;
}

.status-pill {
    font-family: 'SF Mono', Monaco, 'Cascadia Code', monospace;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 20px;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 500;
    background: var(--bg);
    color: var(--text-muted);
    border: 1px solid var(--border);
}

.status-pill.connected {
    background: #ecfdf5;
    color: #059669;
    border-color: #a7f3d0;
}

[data-theme="dark"] .status-pill.connected {
    background: rgba(16, 185, 129, 0.1);
    color: #34d399;
    border-color: rgba(16, 185, 129, 0.3);
}

.status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}

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

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 16px;
    height: 36px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--text);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.btn:hover:not(:disabled) {
    border-color: var(--accent);
    color: var(--accent);
}

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

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

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

.btn.danger:hover:not(:disabled) {
    border-color: var(--error-hover);
    background: var(--error-hover);
    color: white;
}

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

select {
    height: 36px;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--text);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

select:focus {
    outline: none;
    border-color: var(--accent);
}

/* Main Content */
.main {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    position: relative;
}

.display-container {
    position: relative;
}

#display {
    border: 6px solid var(--border);
    border-radius: var(--radius);
    background: #fff;
    image-rendering: pixelated;
    box-shadow: var(--shadow-lg);
}

/* Notifications */
.notifications {
    position: fixed;
    top: 80px;
    right: 24px;
    z-index: 100;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.notification {
    padding: 12px 16px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 13px;
    box-shadow: var(--shadow-lg);
    max-width: 300px;
    animation: slideIn 0.3s ease;
}

.notification.success {
    border-left: 3px solid var(--success);
    color: var(--success);
}

.notification.error {
    border-left: 3px solid var(--error);
    color: var(--error);
}

.notification.info {
    border-left: 3px solid var(--accent);
    color: var(--accent);
}

@keyframes slideOut {
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

/* Modal */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
}

.modal.show {
    display: flex;
}

.modal-content {
    background: var(--surface);
    border-radius: 12px;
    max-width: 500px;
    width: 100%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
}

.modal-header {
    padding: 24px 24px 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-title {
    font-size: 18px;
    font-weight: 600;
}

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

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

.modal-body {
    padding: 24px;
}

.section {
    margin-bottom: 24px;
}

.section:last-child {
    margin-bottom: 0;
}

.section-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.shortcuts {
    display: grid;
    gap: 8px;
}

.shortcut {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 0;
}

.shortcut-key {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-family: 'SF Mono', Monaco, 'Cascadia Code', monospace;
    font-size: 12px;
    font-weight: 600;
    color: var(--text);
    background: var(--bg);
    padding: 4px 8px;
    border-radius: 4px;
    border: 1px solid var(--border);
}

.shortcut-desc {
    color: var(--text-secondary);
    font-size: 13px;
}

/* Responsive */
@media (max-width: 768px) {
    .header {
        flex-direction: column;
        gap: 16px;
        padding: 16px;
    }
    
    .controls {
        width: 100%;
        justify-content: center;
    }
    
    .main {
        padding: 20px;
    }
    
    .notifications {
        right: 16px;
        top: 120px;
    }
}