/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #0a0a0a;
    color: #ffffff;
    line-height: 1.6;
    overflow-x: hidden;
    overflow-y: auto;
    height: 100vh;
}

/* App Container */
.app-container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    background: linear-gradient(135deg, #0a0a0a 0%, #1a1a2e 100%);
    overflow-y: auto;
}

/* Header */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    background: rgba(0, 0, 0, 0.8);
    border-bottom: 2px solid #2d2d3a;
    backdrop-filter: blur(10px);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.back-link {
    color: #ccc;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.back-link:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
    border-color: #444;
}

.header h1 {
    font-size: 2.2rem;
    font-weight: 300;
    color: #ff4444;
    text-shadow: 0 0 10px rgba(255, 68, 68, 0.3);
    letter-spacing: 3px;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    color: #888;
}

.ai-status {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    margin-left: 1rem;
    padding: 0.25rem 0.5rem;
    background: rgba(0, 255, 136, 0.1);
    border: 1px solid #00ff88;
    border-radius: 4px;
    font-size: 0.8rem;
}

.ai-indicator {
    font-size: 0.9rem;
}

.ai-status.ollama {
    background: rgba(255, 107, 107, 0.1);
    border-color: #ff6b6b;
    color: #ff6b6b;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #666;
    transition: all 0.3s ease;
}

.status-dot.active {
    background: #00ff88;
    box-shadow: 0 0 10px rgba(0, 255, 136, 0.5);
}

.status-dot.recording {
    background: #ff4444;
    box-shadow: 0 0 10px rgba(255, 68, 68, 0.5);
    animation: pulse 1s infinite;
}

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

.header-right {
    display: flex;
    gap: 1rem;
}

/* Buttons */
.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn-primary {
    background: linear-gradient(135deg, #00ff88, #00cc6a);
    color: #000;
    box-shadow: 0 4px 15px rgba(0, 255, 136, 0.3);
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 255, 136, 0.4);
}

.btn-secondary {
    background: #2d2d3a;
    color: #fff;
    border: 1px solid #444;
}

.btn-secondary:hover:not(:disabled) {
    background: #3d3d4a;
    transform: translateY(-1px);
}

.btn-pause {
    background: #ff6b35;
    color: white;
    border: 1px solid #ff6b35;
    font-weight: 600;
}

.btn-pause:hover:not(:disabled) {
    background: #ff8c5a;
    border-color: #ff8c5a;
    transform: translateY(-1px);
}

.btn-pause:disabled {
    background: #444;
    border-color: #444;
    color: #888;
    cursor: not-allowed;
}

.btn-pause.resume {
    background: #28a745;
    border-color: #28a745;
}

.btn-pause.resume:hover:not(:disabled) {
    background: #34ce57;
    border-color: #34ce57;
}

.btn-export {
    background: linear-gradient(135deg, #ff6b6b, #ee5a52);
    color: #fff;
    width: 100%;
    margin-bottom: 1rem;
}

.btn-export:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 107, 107, 0.4);
}

.btn-small {
    padding: 0.4rem 0.8rem;
    font-size: 0.8rem;
    background: #2d2d3a;
    color: #fff;
    border: 1px solid #444;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-small:hover {
    background: #3d3d4a;
}

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

/* Main Content */
.main-content {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 1rem;
    padding: 1rem;
    flex: 1;
    overflow: hidden;
}

/* Panels */
.left-panel, .center-panel, .right-panel {
    background: rgba(20, 20, 30, 0.8);
    border-radius: 12px;
    border: 1px solid #2d2d3a;
    backdrop-filter: blur(10px);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background: rgba(0, 0, 0, 0.3);
    border-bottom: 1px solid #2d2d3a;
}

.panel-header h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: #fff;
}

.transcript-controls {
    display: flex;
    gap: 0.5rem;
}

/* Transcript Container */
.transcript-container {
    flex: 1;
    padding: 1rem;
    overflow-y: auto;
    max-height: calc(100vh - 200px);
}

.transcript-placeholder {
    color: #666;
    font-style: italic;
    text-align: center;
    padding: 2rem;
}

.transcript-entry {
    margin-bottom: 1rem;
    padding: 0.75rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    border-left: 3px solid #00ff88;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.transcript-timestamp {
    font-size: 0.8rem;
    color: #888;
    margin-bottom: 0.25rem;
}

.transcript-text {
    font-size: 0.95rem;
    line-height: 1.5;
}

/* Urgent Brief */
.urgent-brief {
    background: rgba(255, 68, 68, 0.1);
    border: 2px solid #ff4444;
    border-radius: 8px;
    margin-bottom: 1rem;
    padding: 1rem;
}

.brief-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.brief-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.ai-processing {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8rem;
    color: #00ff88;
}

.ai-processing .loading {
    width: 12px;
    height: 12px;
    border: 2px solid #2d2d3a;
    border-radius: 50%;
    border-top-color: #00ff88;
    animation: spin 1s ease-in-out infinite;
}

.dispatch-timer {
    display: flex;
    align-items: center;
    background: #1a1a1a;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    border: 1px solid #ff4444;
    margin-left: 1rem;
}

.timer-label {
    font-size: 0.8rem;
    color: #ccc;
    margin-right: 0.5rem;
}

.timer-value {
    font-size: 1rem;
    font-weight: bold;
    color: #ff4444;
    font-family: 'Courier New', monospace;
}

.route-section {
    margin-top: 1rem;
    text-align: center;
}

.btn-route {
    background: #ff4444;
    color: white;
    border: none;
    padding: 0.75rem 2rem;
    border-radius: 25px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.btn-route:hover:not(:disabled) {
    background: #ff6666;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 68, 68, 0.3);
}

.btn-route:disabled {
    background: #666;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.brief-header h3 {
    color: #ff4444;
    font-size: 1rem;
    font-weight: 600;
}

.priority-badge {
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.priority-badge.high {
    background: #ff4444;
    color: #fff;
}

.priority-badge.medium {
    background: #ffaa00;
    color: #000;
}

.priority-badge.low {
    background: #00ff88;
    color: #000;
}

.brief-content {
    font-size: 0.9rem;
    line-height: 1.4;
    color: #fff;
}

/* Bullet Summary */
.bullet-summary {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1rem;
}

/* Routing Suggestions in Center Panel */
.center-panel .routing-suggestions {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1rem;
}

.center-panel .routing-suggestions h3 {
    color: #fff;
    margin-bottom: 0.75rem;
    font-size: 1rem;
    font-weight: 600;
}

.center-panel .routing-content {
    color: #ccc;
    font-size: 0.9rem;
    line-height: 1.4;
}

/* Export Controls in Center Panel */
.center-panel .export-controls {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1rem;
}

.center-panel .export-controls .btn-export {
    background: linear-gradient(135deg, #ff6b6b, #ee5a52);
    color: #fff;
    width: 100%;
    margin-bottom: 1rem;
}

.center-panel .export-options {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

.center-panel .export-options label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #ccc;
    font-size: 0.9rem;
    cursor: pointer;
}

.bullet-summary h3 {
    margin-bottom: 1rem;
    color: #fff;
    font-size: 1rem;
}

.summary-grid {
    display: grid;
    gap: 0.75rem;
}

.summary-item {
    display: flex;
    gap: 0.5rem;
}

.summary-label {
    font-weight: 600;
    color: #888;
    min-width: 60px;
    font-size: 0.9rem;
}

.summary-value {
    color: #fff;
    font-size: 0.9rem;
    flex: 1;
}

/* Suggested Script */
.suggested-script {
    padding: 1rem;
    border-bottom: 1px solid #2d2d3a;
}

.suggested-script h3 {
    margin-bottom: 1rem;
    color: #fff;
    font-size: 1rem;
}

.script-container {
    position: relative;
}

.script-textbox {
    width: 100%;
    height: 200px;
    background: #0a0a0a;
    border: 1px solid #444;
    border-radius: 6px;
    padding: 0.75rem;
    color: #fff;
    font-family: 'Courier New', monospace;
    font-size: 0.85rem;
    line-height: 1.4;
    resize: none;
    outline: none;
    overflow-y: auto;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.script-textbox:focus {
    border-color: #ff4444;
    box-shadow: 0 0 0 2px rgba(255, 68, 68, 0.2);
}

.script-textbox::-webkit-scrollbar {
    width: 6px;
}

.script-textbox::-webkit-scrollbar-track {
    background: #1a1a1a;
    border-radius: 3px;
}

.script-textbox::-webkit-scrollbar-thumb {
    background: #444;
    border-radius: 3px;
}

.script-textbox::-webkit-scrollbar-thumb:hover {
    background: #666;
}

.script-textbox::placeholder {
    color: #666;
    font-style: italic;
}

/* Incident Classification */
.incident-classification {
    padding: 1rem;
    border-bottom: 1px solid #2d2d3a;
}

.incident-classification h3 {
    margin-bottom: 1rem;
    color: #fff;
    font-size: 1rem;
}

.classification-content {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.category-section, .priority-section {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.category-section label, .priority-section label {
    font-size: 0.9rem;
    color: #888;
    font-weight: 500;
}

.category-badges {
    display: flex;
    gap: 0.5rem;
}

.category-badge {
    padding: 0.4rem 0.8rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    background: #2d2d3a;
    color: #888;
    border: 1px solid #444;
    transition: all 0.3s ease;
}

.category-badge.active {
    background: #00ff88;
    color: #000;
    border-color: #00ff88;
}

.priority-indicator {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.priority-level {
    font-weight: 600;
    font-size: 0.9rem;
    min-width: 50px;
}

.confidence-bar {
    flex: 1;
    height: 8px;
    background: #2d2d3a;
    border-radius: 4px;
    overflow: hidden;
}

.confidence-fill {
    height: 100%;
    background: linear-gradient(90deg, #ff4444, #ffaa00, #00ff88);
    width: 0%;
    transition: width 0.5s ease;
}

.confidence-text {
    font-size: 0.8rem;
    color: #888;
    min-width: 35px;
}

.data-source-section, .nena-code-section {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.data-source-section label, .nena-code-section label {
    font-size: 0.9rem;
    color: #888;
    font-weight: 500;
}

.data-source, .nena-code {
    font-size: 0.8rem;
    color: #00ff88;
    background: rgba(0, 255, 136, 0.1);
    border: 1px solid #00ff88;
    border-radius: 4px;
    padding: 0.25rem 0.5rem;
    text-align: center;
    font-weight: 600;
}

.nena-code {
    color: #ff6b6b;
    background: rgba(255, 107, 107, 0.1);
    border-color: #ff6b6b;
}

/* Routing Suggestions */
.routing-suggestions {
    padding: 1rem;
    border-bottom: 1px solid #2d2d3a;
}

.routing-suggestions h3 {
    margin-bottom: 1rem;
    color: #fff;
    font-size: 1rem;
}

.routing-content {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.routing-unit {
    padding: 0.5rem 0.75rem;
    background: rgba(0, 255, 136, 0.1);
    border: 1px solid #00ff88;
    border-radius: 6px;
    font-size: 0.8rem;
    color: #00ff88;
}

/* Export Controls */
.export-controls {
    padding: 1rem;
}

.export-options {
    display: flex;
    gap: 1rem;
    margin-top: 0.5rem;
}

.export-options label {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.9rem;
    color: #888;
    cursor: pointer;
}

/* Footer */
.footer {
    padding: 1rem 2rem;
    background: rgba(0, 0, 0, 0.8);
    border-top: 1px solid #2d2d3a;
    backdrop-filter: blur(10px);
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.3);
}

.privacy-controls {
    display: flex;
    gap: 2rem;
    align-items: center;
    flex-wrap: wrap;
}

.privacy-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.privacy-item label {
    font-size: 0.9rem;
    color: #888;
    cursor: pointer;
}

.privacy-item input[type="checkbox"] {
    accent-color: #00ff88;
}

.privacy-item select {
    background: #2d2d3a;
    color: #fff;
    border: 1px solid #444;
    border-radius: 4px;
    padding: 0.25rem 0.5rem;
    font-size: 0.9rem;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 1000;
    backdrop-filter: blur(5px);
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: #1a1a2e;
    border-radius: 12px;
    border: 1px solid #2d2d3a;
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    overflow: hidden;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background: rgba(0, 0, 0, 0.3);
    border-bottom: 1px solid #2d2d3a;
}

.modal-header h3 {
    color: #fff;
    font-size: 1.2rem;
}

.modal-close {
    background: none;
    border: none;
    color: #888;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.25rem;
    line-height: 1;
}

.modal-close:hover {
    color: #fff;
}

.modal-body {
    padding: 1rem;
    max-height: 60vh;
    overflow-y: auto;
}

.radio-input {
    margin-bottom: 1rem;
}

.radio-input textarea {
    width: 100%;
    height: 100px;
    background: #2d2d3a;
    color: #fff;
    border: 1px solid #444;
    border-radius: 6px;
    padding: 0.75rem;
    font-family: inherit;
    resize: vertical;
    margin-bottom: 0.5rem;
}

.radio-log {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 6px;
    padding: 1rem;
    min-height: 200px;
}

/* Responsive Design */
@media (max-width: 1200px) {
    .main-content {
        grid-template-columns: 1fr 1fr;
        grid-template-rows: 1fr 1fr;
    }
    
    .right-panel {
        grid-column: 1 / -1;
        grid-row: 2;
    }
}

@media (max-width: 768px) {
    .main-content {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto auto;
    }
    
    .header {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }
    
    .privacy-controls {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
}

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

::-webkit-scrollbar-track {
    background: #2d2d3a;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: #555;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #666;
}

/* Loading Animation */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #2d2d3a;
    border-radius: 50%;
    border-top-color: #00ff88;
    animation: spin 1s ease-in-out infinite;
}

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

/* Notification Toast */
.notification-toast {
    position: fixed;
    top: 20px;
    right: 20px;
    background: rgba(0, 0, 0, 0.9);
    border: 1px solid #2d2d3a;
    border-radius: 8px;
    padding: 1rem;
    color: #fff;
    z-index: 1001;
    transform: translateX(400px);
    transition: transform 0.3s ease;
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    max-width: 300px;
}

.notification-toast.show {
    transform: translateX(0);
}

.notification-content {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.notification-text {
    flex: 1;
    font-size: 0.9rem;
}

.notification-close {
    background: none;
    border: none;
    color: #888;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

.notification-close:hover {
    color: #fff;
}
