/* Observer PWA Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg-primary: #1a1a2e;
    --bg-secondary: #16213e;
    --bg-card: rgba(255, 255, 255, 0.05);
    --text-primary: #e0e0e0;
    --text-secondary: #888;
    --accent-starbug: #4fc3f7;
    --accent-cassidy: #f06292;
    --accent-primary: #667eea;
    --accent-warning: #fbbf24;
    --border-color: rgba(255, 255, 255, 0.1);
    --status-online: #4ade80;
    --status-offline: #f87171;
}

html, body {
    height: 100%;
    min-height: 100vh;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
    color: var(--text-primary);
    display: flex;
    flex-direction: column;
}

/* Header */
.header {
    background: rgba(0, 0, 0, 0.3);
    padding: 12px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border-color);
}

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

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo-icon {
    font-size: 24px;
}

.logo-text {
    font-size: 18px;
    font-weight: 600;
}

.status-indicators {
    display: flex;
    gap: 20px;
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: var(--bg-card);
    border-radius: 20px;
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--status-offline);
    transition: background 0.3s;
}

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

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

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 20px;
}

/* Setup Panel */
.setup-panel {
    max-width: 600px;
    margin: 0 auto;
    padding: 30px;
    background: var(--bg-card);
    border-radius: 16px;
    border: 1px solid var(--border-color);
}

.setup-panel h2 {
    font-size: 24px;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.subtitle {
    color: var(--text-secondary);
    margin-bottom: 24px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text-primary);
}

textarea {
    width: 100%;
    padding: 12px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 16px;
    resize: vertical;
    font-family: inherit;
}

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

textarea::placeholder {
    color: var(--text-secondary);
}

/* Radio Group */
.radio-group {
    display: flex;
    gap: 20px;
}

.radio-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.radio-label input[type="radio"] {
    display: none;
}

.radio-custom {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-color);
    border-radius: 50%;
    position: relative;
    transition: border-color 0.3s;
}

.radio-label input[type="radio"]:checked + .radio-custom {
    border-color: var(--accent-primary);
}

.radio-label input[type="radio"]:checked + .radio-custom::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 10px;
    height: 10px;
    background: var(--accent-primary);
    border-radius: 50%;
}

.radio-text {
    color: var(--text-primary);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent-primary) 0%, #764ba2 100%);
    color: white;
    width: 100%;
    margin-top: 10px;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

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

.btn-warning {
    background: var(--accent-warning);
    color: #1a1a2e;
}

.btn-warning:hover {
    background: #f59e0b;
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.2);
}

.btn-icon {
    font-size: 14px;
}

/* Transcripts Section */
.transcripts-section {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}

.transcripts-section h3 {
    font-size: 16px;
    margin-bottom: 15px;
    color: var(--text-secondary);
}

.transcripts-list {
    max-height: 200px;
    overflow-y: auto;
}

.transcript-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: background 0.3s;
}

.transcript-item:hover {
    background: rgba(0, 0, 0, 0.4);
}

.transcript-info {
    flex: 1;
}

.transcript-prompt {
    font-size: 14px;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.transcript-meta {
    font-size: 12px;
    color: var(--text-secondary);
}

.empty-state {
    color: var(--text-secondary);
    text-align: center;
    padding: 20px;
    font-style: italic;
}

/* Conversation Panel */
.conversation-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--bg-card);
    border-radius: 16px;
    border: 1px solid var(--border-color);
    overflow: hidden;
}

.conversation-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: rgba(0, 0, 0, 0.2);
    border-bottom: 1px solid var(--border-color);
}

.conversation-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.conversation-status {
    font-weight: 500;
    color: var(--status-online);
}

.turn-counter {
    font-size: 14px;
    color: var(--text-secondary);
}

/* Chat Messages */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.message {
    display: flex;
    flex-direction: column;
    max-width: 85%;
    animation: messageSlide 0.3s ease-out;
}

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

.message.starbug {
    align-self: flex-start;
}

.message.cassidy {
    align-self: flex-end;
}

.message-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}

.message.cassidy .message-header {
    justify-content: flex-end;
}

.message-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
}

.message.starbug .message-avatar {
    background: linear-gradient(135deg, var(--accent-starbug), #0288d1);
}

.message.cassidy .message-avatar {
    background: linear-gradient(135deg, var(--accent-cassidy), #c2185b);
}

.message-speaker {
    font-weight: 600;
    font-size: 14px;
}

.message.starbug .message-speaker {
    color: var(--accent-starbug);
}

.message.cassidy .message-speaker {
    color: var(--accent-cassidy);
}

.message-bubble {
    padding: 12px 16px;
    border-radius: 16px;
    line-height: 1.5;
}

.message.starbug .message-bubble {
    background: rgba(79, 195, 247, 0.15);
    border: 1px solid rgba(79, 195, 247, 0.3);
    border-top-left-radius: 4px;
}

.message.cassidy .message-bubble {
    background: rgba(240, 98, 146, 0.15);
    border: 1px solid rgba(240, 98, 146, 0.3);
    border-top-right-radius: 4px;
}

.message-time {
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 4px;
}

.message.cassidy .message-time {
    text-align: right;
}

/* Typing Indicator */
.typing-indicator {
    padding: 10px 20px;
    background: rgba(0, 0, 0, 0.2);
    border-top: 1px solid var(--border-color);
    font-style: italic;
    color: var(--text-secondary);
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: var(--bg-secondary);
    border-radius: 16px;
    max-width: 700px;
    width: 90%;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    border: 1px solid var(--border-color);
}

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

.modal-header h3 {
    font-size: 18px;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 24px;
    cursor: pointer;
    padding: 0 8px;
}

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

.modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.modal-footer {
    display: flex;
    gap: 10px;
    padding: 20px;
    border-top: 1px solid var(--border-color);
    justify-content: flex-end;
}

/* Footer */
.footer {
    padding: 12px 20px;
    text-align: center;
    font-size: 12px;
    color: var(--text-secondary);
    background: rgba(0, 0, 0, 0.2);
    border-top: 1px solid var(--border-color);
}

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

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

::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Responsive */
@media (max-width: 768px) {
    .header {
        flex-direction: column;
        gap: 10px;
    }

    .status-indicators {
        width: 100%;
        justify-content: center;
    }

    .setup-panel {
        padding: 20px;
    }

    .radio-group {
        flex-direction: column;
        gap: 10px;
    }

    .conversation-header {
        flex-direction: column;
        gap: 10px;
    }

    .message {
        max-width: 95%;
    }
}
