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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: #f8f9fa;
    color: #333;
    line-height: 1.6;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

/* Header */
header {
    background: white;
    padding: 15px 25px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 28px;
    font-weight: 700;
    color: #1a73e8;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 20px;
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
}

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

.status-dot.connected {
    background: #27ae60;
    box-shadow: 0 0 8px rgba(39, 174, 96, 0.5);
}

.status-dot.disconnected {
    background: #e74c3c;
}

/* Main Layout */
.main-content {
    display: grid;
    grid-template-columns: 1fr 350px;
    gap: 20px;
    align-items: start;
}

/* Form Panel */
.form-panel {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    padding: 30px;
}

.form-title {
    font-size: 24px;
    font-weight: 600;
    color: #1a73e8;
    margin-bottom: 20px;
}

/* Section Progress */
.section-progress {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 25px;
    padding: 15px;
    background: #f0f4f8;
    border-radius: 8px;
}

.progress-text {
    font-size: 14px;
    color: #666;
}

.progress-dots {
    display: flex;
    gap: 8px;
}

.progress-dots .dot {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #e0e0e0;
    color: #666;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.progress-dots .dot.active {
    background: #1a73e8;
    color: white;
}

.progress-dots .dot.completed {
    background: #27ae60;
    color: white;
}

.progress-dots .dot:hover {
    transform: scale(1.1);
}

/* Form Sections */
.form-section {
    margin-bottom: 15px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
}

.section-header {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px 20px;
    background: #f8f9fa;
    cursor: pointer;
    transition: background 0.2s;
}

.section-header:hover {
    background: #f0f4f8;
}

.section-header h2 {
    flex: 1;
    font-size: 16px;
    font-weight: 600;
    color: #333;
}

.section-progress-count {
    font-size: 13px;
    color: #666;
    background: #e0e0e0;
    padding: 4px 10px;
    border-radius: 12px;
}

.section-toggle {
    font-size: 12px;
    color: #666;
}

.section-content {
    padding: 20px;
    border-top: 1px solid #e0e0e0;
}

/* Form Groups */
.form-group {
    margin-bottom: 20px;
    position: relative;
}

.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: #333;
    margin-bottom: 8px;
}

.form-group input[type="text"],
.form-group textarea {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-group input[type="text"]:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #1a73e8;
    box-shadow: 0 0 0 3px rgba(26, 115, 232, 0.1);
}

.form-group textarea {
    resize: vertical;
    min-height: 80px;
}

.field-help {
    font-size: 12px;
    color: #666;
    margin-bottom: 8px;
    display: block;
}

.char-count {
    font-size: 12px;
    color: #999;
    text-align: right;
    margin-top: 5px;
}

/* Radio Options */
.radio-group {
    margin-bottom: 20px;
}

.radio-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.radio-option {
    display: flex;
    align-items: center;
    padding: 12px 15px;
    background: #f8f9fa;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.radio-option:hover {
    background: #f0f4f8;
    border-color: #1a73e8;
}

.radio-option input[type="radio"],
.radio-option input[type="checkbox"] {
    margin-right: 12px;
    width: 18px;
    height: 18px;
    accent-color: #1a73e8;
}

.radio-option span {
    font-size: 14px;
    color: #333;
}

.radio-option.selected {
    background: #e8f0fe;
    border-color: #1a73e8;
}

.radio-option.warning {
    border-color: #ff9800;
}

.radio-option.warning:hover {
    background: #fff3e0;
}

.radio-option.safe {
    border-color: #27ae60;
}

.radio-option.safe:hover {
    background: #e8f5e9;
}

.warning-note {
    font-size: 12px;
    color: #e65100;
    background: #fff3e0;
    padding: 10px 15px;
    border-radius: 6px;
    margin-top: 10px;
    border-left: 3px solid #ff9800;
}

.warning-field label {
    color: #e65100;
}

/* Subsection Title */
.subsection-title {
    font-size: 15px;
    font-weight: 600;
    color: #1a73e8;
    margin: 25px 0 15px 0;
    padding-bottom: 8px;
    border-bottom: 2px solid #e8f0fe;
}

/* Field Indicators */
.field-indicator {
    position: absolute;
    right: 10px;
    top: 35px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.field-indicator.updated {
    background: #27ae60;
    animation: pulse 0.5s;
}

.field-indicator.pending {
    background: #f39c12;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.5); }
    100% { transform: scale(1); }
}

/* Form Actions */
.form-actions {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #e0e0e0;
}

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

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

.btn-primary:hover {
    background: #1557b0;
}

.btn-secondary {
    background: #f0f4f8;
    color: #333;
    border: 1px solid #ddd;
}

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

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

.btn-new {
    background: #ff9800;
    color: white;
}

.btn-new:hover {
    background: #e68900;
}

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

.btn-danger:hover {
    background: #c0392b;
}

/* AI Analysis Section */
.ai-analysis-section {
    margin-top: 30px;
    padding: 25px;
    background: #f8f9fa;
    border-radius: 12px;
    border: 1px solid #e0e0e0;
}

.ai-analysis-section h3 {
    font-size: 18px;
    font-weight: 600;
    color: #333;
    margin-bottom: 15px;
}

.ai-analysis-content {
    min-height: 150px;
    background: white;
    border-radius: 8px;
    padding: 20px;
    border: 1px solid #e0e0e0;
}

.ai-placeholder {
    text-align: center;
    color: #999;
}

.ai-icon {
    font-size: 48px;
    display: block;
    margin-bottom: 10px;
}

.ai-hint {
    font-size: 13px;
    color: #bbb;
    margin-top: 5px;
}

.ai-actions {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

/* AI Analysis Panel */
.analysis-panel {
    position: sticky;
    top: 20px;
}

.analysis-section {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    padding: 20px;
    max-height: calc(100vh - 120px);
    display: flex;
    flex-direction: column;
}

.analysis-section h2 {
    font-size: 18px;
    font-weight: 600;
    color: #1a73e8;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid #e8f0fe;
}

.analysis-container {
    flex: 1;
    overflow-y: auto;
    max-height: 400px;
}

.analysis-placeholder {
    text-align: center;
    color: #999;
    padding: 40px 20px;
}

.analysis-placeholder .analysis-icon {
    font-size: 48px;
    display: block;
    margin-bottom: 15px;
}

.analysis-entry {
    padding: 15px;
    margin-bottom: 12px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e8f0fe 100%);
    border-radius: 10px;
    border-left: 4px solid #1a73e8;
}

.analysis-entry .analysis-time {
    font-size: 11px;
    color: #666;
    margin-bottom: 8px;
}

.analysis-entry .analysis-text {
    font-size: 14px;
    color: #333;
    line-height: 1.6;
    white-space: pre-line;
}

.analysis-entry .analysis-text ul {
    margin: 8px 0;
    padding-left: 20px;
}

.analysis-entry .analysis-text li {
    margin-bottom: 4px;
}

/* Confidence Legend */
.confidence-legend {
    margin-top: 20px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
}

.confidence-legend h4 {
    font-size: 13px;
    font-weight: 600;
    color: #666;
    margin-bottom: 10px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: #666;
    margin-bottom: 6px;
}

.legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.legend-dot.high {
    background: #27ae60;
}

.legend-dot.medium {
    background: #1a73e8;
}

.legend-dot.low {
    background: #f39c12;
}

/* Keep transcript styles for compatibility */
.transcript-section h2 {
    font-size: 18px;
    font-weight: 600;
    color: #333;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #e0e0e0;
}

.transcript-container {
    flex: 1;
    overflow-y: auto;
    max-height: 500px;
}

.transcript-placeholder {
    color: #999;
    font-style: italic;
    text-align: center;
    padding: 40px 20px;
}

.transcript-entry {
    padding: 12px;
    margin-bottom: 10px;
    border-radius: 8px;
    border-left: 3px solid transparent;
    cursor: pointer;
    transition: all 0.2s;
}

.transcript-entry:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.transcript-entry:hover::after {
    content: "Click to swap speaker";
    position: absolute;
    top: 5px;
    right: 5px;
    font-size: 10px;
    color: #999;
    background: white;
    padding: 2px 6px;
    border-radius: 4px;
}

.transcript-entry.patient {
    background: #e8f5e9;
    border-left-color: #27ae60;
}

.transcript-entry.doctor {
    background: #e3f2fd;
    border-left-color: #1a73e8;
}

.transcript-entry.unknown {
    background: #f5f5f5;
    border-left-color: #999;
}

.transcript-speaker {
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    margin-bottom: 4px;
}

.transcript-text {
    font-size: 14px;
    color: #333;
}

.transcript-time {
    font-size: 11px;
    color: #999;
    margin-top: 4px;
}

/* Transcribing Indicator */
.transcribing-indicator {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 12px 16px;
    background: linear-gradient(135deg, #1a73e8 0%, #6d28d9 100%);
    border-radius: 20px;
    margin-top: 15px;
    width: fit-content;
}

.transcribing-indicator .dot {
    width: 8px;
    height: 8px;
    background: white;
    border-radius: 50%;
    animation: bounce 1.4s infinite ease-in-out both;
}

.transcribing-indicator .dot:nth-child(1) {
    animation-delay: -0.32s;
}

.transcribing-indicator .dot:nth-child(2) {
    animation-delay: -0.16s;
}

.transcribing-indicator .dot:nth-child(3) {
    animation-delay: 0s;
}

.transcribing-indicator .transcribing-text {
    color: white;
    font-size: 13px;
    font-weight: 500;
    margin-left: 8px;
}

@keyframes bounce {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}

/* Saved Indicator */
.saved-indicator {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: #27ae60;
    color: white;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    opacity: 0;
    transition: opacity 0.3s;
}

.saved-indicator.show {
    opacity: 1;
}

/* Toast */
.toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 14px;
    color: white;
    opacity: 0;
    transition: opacity 0.3s;
    z-index: 1000;
}

.toast.show {
    opacity: 1;
}

.toast.success {
    background: #27ae60;
}

.toast.error {
    background: #e74c3c;
}

.toast.warning {
    background: #f39c12;
}

/* Modal */
.modal-overlay {
    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;
}

.modal-content {
    background: white;
    padding: 30px;
    border-radius: 12px;
    max-width: 400px;
    text-align: center;
}

.modal-icon {
    font-size: 48px;
    margin-bottom: 15px;
}

.modal-content h3 {
    font-size: 20px;
    margin-bottom: 10px;
}

.modal-warning {
    color: #e74c3c;
    margin-top: 10px;
}

.modal-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: 20px;
}

/* Lock Button */
.lock-btn {
    position: absolute;
    right: -35px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    opacity: 0.5;
    transition: opacity 0.2s;
}

.lock-btn:hover {
    opacity: 1;
}

.lock-btn.locked {
    opacity: 1;
}

.form-group.locked input,
.form-group.locked textarea {
    background: #f5f5f5;
    border-color: #27ae60;
}

/* Auto-locked fields (90%+ confidence) */
.form-group.auto-locked {
    position: relative;
}

.form-group.auto-locked::before {
    content: '';
    position: absolute;
    top: 0;
    left: -8px;
    width: 4px;
    height: 100%;
    background: linear-gradient(180deg, #27ae60, #2ecc71);
    border-radius: 2px;
}

.form-group.auto-locked .radio-option.selected {
    background: #e8f5e9;
    border-color: #27ae60;
}

.auto-lock-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: linear-gradient(135deg, #27ae60, #2ecc71);
    color: white;
    font-size: 11px;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 12px;
    margin-left: 8px;
    animation: lockPulse 0.5s ease-out;
}

@keyframes lockPulse {
    0% { transform: scale(0.8); opacity: 0; }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); opacity: 1; }
}

/* Responsive */
@media (max-width: 900px) {
    .main-content {
        grid-template-columns: 1fr;
    }
    
    .analysis-panel {
        position: static;
    }
    
    .analysis-section {
        max-height: 400px;
    }
}
