/* Base styles */
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    background: linear-gradient(135deg, #fef9e7 0%, #fdf4dc 100%);
    min-height: 100vh;
}

/* Sidebar layout */
body.has-sidebar {
    max-width: none;
    margin: 0;
    padding: 0;
}

.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 240px;
    height: 100vh;
    background: #1e1e2e;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    z-index: 100;
}

.sidebar-top {
    padding: 24px 16px 16px;
}

.sidebar-brand {
    display: block;
    font-size: 20px;
    font-weight: 700;
    color: #fb923c;
    text-decoration: none;
    margin-bottom: 24px;
    padding: 0 8px;
}

.sidebar-brand:hover {
    color: #fdba74;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.sidebar-link {
    display: block;
    padding: 10px 12px;
    border-radius: 6px;
    color: #a1a1aa;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: background 0.15s, color 0.15s;
}

.sidebar-link:hover {
    background: #2a2a3c;
    color: #e4e4e7;
}

.sidebar-link.active {
    background: #2a2a3c;
    color: #fb923c;
    font-weight: 600;
}

.sidebar-bottom {
    padding: 16px;
    border-top: 1px solid #2a2a3c;
}

.sidebar-email {
    padding: 8px 12px;
    font-size: 13px;
    color: #71717a;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-bottom: 4px;
}

.main-content {
    margin-left: 240px;
    padding: 24px 32px;
    max-width: 1200px;
}

.sidebar-toggle {
    display: none;
    position: fixed;
    top: 12px;
    left: 12px;
    z-index: 200;
    background: white;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 8px;
    cursor: pointer;
    flex-direction: column;
    gap: 4px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.1);
}

.sidebar-toggle span {
    display: block;
    width: 20px;
    height: 2px;
    background: #555;
    border-radius: 1px;
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.2s ease;
    }

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

    .sidebar-toggle {
        display: flex;
    }

    .main-content {
        margin-left: 0;
        padding: 20px;
        padding-top: 52px;
    }
}

h1, h2, h3 {
    color: #333;
}

/* Card styles */
.card {
    background: white;
    border-radius: 8px;
    padding: 24px;
    margin-bottom: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* Form styles */
.form-group {
    margin-bottom: 16px;
}

label {
    display: block;
    margin-bottom: 4px;
    font-weight: 500;
    color: #555;
}

input[type="text"],
input[type="number"],
textarea,
select {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

input[type="radio"] {
    margin-right: 8px;
}

button, .btn {
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary {
    background: #ea580c;
    color: white;
}

.btn-primary:hover {
    background: #c2410c;
    color: white;
}

.btn-success {
    background: #10b981;
    color: white;
}

.btn-danger {
    background: #dc3545;
    color: white;
}

.btn-secondary {
    background: #64748b;
    color: white;
}

.btn-secondary:hover {
    background: #475569;
}

/* Taster grid */
.taster-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 12px;
    margin-top: 16px;
}

.taster-card {
    padding: 12px;
    border-radius: 4px;
    text-align: center;
    font-size: 14px;
}

.taster-card.completed {
    background: #d4edda;
    border: 2px solid #28a745;
}

.taster-card.finished {
    background: #d1f4e0;
    border: 2px solid #10b981;
}

.taster-card.connected {
    background: #fff3cd;
    border: 2px solid #ffc107;
}

.taster-card.waiting {
    background: #fff3cd;
    border: 2px solid #ffc107;
}

.taster-card.disconnected {
    background: #f8d7da;
    border: 2px solid #dc3545;
}

/* Progress bar */
.progress {
    background: #e9ecef;
    border-radius: 4px;
    height: 24px;
    margin: 16px 0;
    overflow: hidden;
}

.progress-bar {
    background: #007bff;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 500;
    transition: width 0.3s;
}

/* Question display */
.question-container {
    margin: 24px 0;
}

.comparison-header {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 2px solid #007bff;
}

.attribute-question {
    margin: 20px 0;
    padding: 16px;
    background: #f8f9fa;
    border-radius: 4px;
}

/* Waiting screen */
.waiting-screen {
    text-align: center;
    padding: 60px 20px;
}

.waiting-screen h2 {
    color: #6c757d;
    margin-bottom: 20px;
}

.spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #007bff;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 0 auto;
}

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

/* Survey list */
.survey-item {
    padding: 16px;
    margin-bottom: 12px;
    border-left: 4px solid #007bff;
    background: #f8f9fa;
}

.survey-item h3 {
    margin: 0 0 8px 0;
}

.survey-meta {
    color: #6c757d;
    font-size: 14px;
}

/* Status badges */
.badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
}

.badge-active {
    background: #d4edda;
    color: #155724;
}

.badge-draft {
    background: #fff3cd;
    color: #856404;
}

.badge-closed {
    background: #f8d7da;
    color: #721c24;
}

/* Info cards */
.info-card {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 6px;
    border: 1px solid #dee2e6;
}

.info-card h3 {
    margin: 0 0 8px 0;
    font-size: 14px;
    color: #6c757d;
    font-weight: 500;
}

.info-card p {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #333;
}

/* Status badges */
.status-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
}

.status-draft {
    background: #e9ecef;
    color: #495057;
}

.status-active {
    background: #ffedd5;
    color: #c2410c;
}

.status-closed {
    background: #fef3c7;
    color: #92400e;
}

.status-analysed {
    background: #d1f4e0;
    color: #065f46;
}

.status-running {
    background: #dbeafe;
    color: #1e40af;
    animation: pulse 2s ease-in-out infinite;
}

.status-pending {
    background: #f3f4f6;
    color: #6b7280;
}

.status-failed {
    background: #fee2e2;
    color: #991b1b;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

.analysis-spinner {
    width: 24px;
    height: 24px;
    border: 3px solid #bfdbfe;
    border-top-color: #1e40af;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Chat page layout */
.chat-page .main-content {
    padding: 0;
    max-width: none;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

.chat-new-btn {
    display: block;
    width: calc(100% - 32px);
    margin: 12px 16px;
    padding: 8px 12px;
    background: #ea580c;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
    font-weight: 500;
}
.chat-new-btn:hover { background: #c2410c; }

.chat-session-list {
    flex: 1;
    overflow-y: auto;
    padding: 0 8px 8px;
}

.chat-session-item {
    padding: 8px 10px;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 4px;
    margin-bottom: 2px;
}
.chat-session-item:hover { background: #2a2a3c; }
.chat-session-item.active { background: #2a2a3c; }

.chat-session-info { flex: 1; min-width: 0; }

.chat-session-title {
    font-size: 13px;
    color: #a1a1aa;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.chat-session-item.active .chat-session-title {
    color: #fb923c;
    font-weight: 600;
}

.chat-session-time {
    font-size: 11px;
    color: #52525b;
}

.chat-session-delete {
    background: none;
    border: none;
    color: #52525b;
    cursor: pointer;
    font-size: 14px;
    padding: 0 2px;
    line-height: 1;
    visibility: hidden;
    flex-shrink: 0;
}
.chat-session-item:hover .chat-session-delete { visibility: visible; }
.chat-session-delete:hover { color: #ef4444; }
