/* public/style.css */

:root {
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --bg-color: #f8fafc;
    --card-bg: #ffffff;
    --text-color: #1e293b;
    --text-muted: #64748b;
    --border-color: #e2e8f0;
    --success-color: #22c55e;
    --warning-color: #f59e0b;
    --error-color: #ef4444;
    --stereo-color: #8b5cf6;
    --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --radius: 12px;
}

[data-theme="green"] {
    --bg-color: #f0fdf4; /* Pastel green */
    --card-bg: #ffffff;
    --primary-color: #16a34a; /* Acid green / healthy green */
    --primary-hover: #15803d;
    --text-color: #064e3b;
    --border-color: #bbf7d0;
    --shadow: 0 10px 15px -3px rgba(22, 163, 74, 0.1);
}

[data-theme="dark"] {
    --bg-color: #0f172a;
    --card-bg: #1e293b;
    --text-color: #f1f5f9;
    --text-muted: #94a3b8;
    --border-color: #334155;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem;
}

/* Header & Typography */
h1, h2, h3 {
    font-weight: 700;
    margin-bottom: 1rem;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

/* Cards */
.card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
    margin-bottom: 1.5rem;
}

/* Grid Layouts */
.grid-4 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    font-size: 0.875rem;
    gap: 0.5rem;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
}

.btn-primary { background: var(--primary-color); color: white; }
.btn-primary:hover { background: var(--primary-hover); }

.btn-outline { background: transparent; border: 1px solid var(--border-color); color: var(--text-color); }
.btn-outline:hover { background: var(--bg-color); }

.btn-talk {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: var(--error-color);
    color: white;
    font-size: 1.25rem;
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7);
}

.btn-talk.active {
    animation: pulse-red 2s infinite;
}

@keyframes pulse-red {
    0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7); }
    70% { transform: scale(1); box-shadow: 0 0 0 15px rgba(239, 68, 68, 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

/* Patching Grid */
.patching-matrix {
    display: grid;
    grid-template-columns: 120px repeat(4, 1fr);
    gap: 4px;
    background: var(--border-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    overflow: hidden;
}

.patch-cell {
    background: var(--card-bg);
    padding: 1rem;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
}

.patch-header { background: var(--bg-color); font-weight: 700; font-size: 0.75rem; color: var(--text-muted); text-transform: uppercase; }

.patch-node {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 2px solid var(--border-color);
    cursor: pointer;
    transition: all 0.2s;
}

.patch-node.active { background: var(--primary-color); border-color: var(--primary-color); }
.patch-node.stereo { background: var(--stereo-color); border-color: var(--stereo-color); }

/* Level Meters */
.meter-container {
    height: 8px;
    background: #e2e8f0;
    border-radius: 4px;
    overflow: hidden;
    margin: 8px 0;
}

.meter-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #22c55e 0%, #eab308 80%, #ef4444 100%);
    transition: width 0.1s ease;
}

/* Chat UI */
.chat-container {
    display: flex;
    flex-direction: column;
    height: 400px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    background: var(--card-bg);
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.message {
    padding: 0.5rem 1rem;
    border-radius: 12px;
    max-width: 80%;
    font-size: 0.875rem;
}

.message.sent { align-self: flex-end; background: var(--primary-color); color: white; }
.message.received { align-self: flex-start; background: var(--bg-color); border: 1px solid var(--border-color); }

.chat-input {
    padding: 1rem;
    display: flex;
    gap: 0.5rem;
    border-top: 1px solid var(--border-color);
}

.chat-input input {
    flex: 1;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    outline: none;
}

/* Responsive Overrides */
@media (max-width: 768px) {
    .container { padding: 0.5rem; }
    .page-header { flex-direction: column; align-items: flex-start; gap: 1rem; }
    .patching-matrix { grid-template-columns: 80px repeat(4, 1fr); font-size: 0.75rem; }
}
