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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #2196f3 0%, #1976d2 100%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
}

.container-wide {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
}

/* Login Page Styles */
.login-card {
    background: white;
    border-radius: 12px;
    padding: 40px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    margin-top: 10vh;
}

.login-card h1 {
    color: #333;
    margin-bottom: 10px;
    text-align: center;
}

.subtitle {
    color: #666;
    text-align: center;
    margin-bottom: 30px;
}

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

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

.form-group input {
    width: 100%;
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.3s;
}

.form-group input:focus {
    outline: none;
    border-color: #2196f3;
}

.error-message {
    color: #e74c3c;
    font-size: 14px;
    margin-top: 5px;
    display: block;
    min-height: 20px;
}

.btn-primary {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, #2196f3 0%, #1976d2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(33, 150, 243, 0.4);
}

.btn-primary:active {
    transform: translateY(0);
}

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

.btn-secondary {
    padding: 10px 20px;
    background: #e0e0e0;
    color: #333;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.2s;
}

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

.btn-toggle {
    width: 100%;
    padding: 10px;
    background: #f5f5f5;
    color: #333;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    text-align: left;
    transition: background 0.2s;
}

.btn-toggle:hover {
    background: #e8e8e8;
}

/* Queue Page Styles */
.queue-container {
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    padding: 30px;
}

.queue-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid #e0e0e0;
}

.queue-header h1 {
    color: #333;
    font-size: 28px;
}

.header-actions {
    display: flex;
    gap: 10px;
}

.loading-message,
.empty-message {
    text-align: center;
    padding: 40px;
    color: #666;
    font-size: 18px;
}

.empty-message.hidden,
.queue-table.hidden {
    display: none;
}

.queue-table table {
    width: 100%;
    border-collapse: collapse;
}

.queue-table th {
    background: #f5f5f5;
    padding: 15px;
    text-align: left;
    font-weight: 600;
    color: #333;
    border-bottom: 2px solid #e0e0e0;
}

.queue-table td {
    padding: 15px;
    border-bottom: 1px solid #e0e0e0;
    color: #333;
}

.queue-table tbody tr {
    cursor: pointer;
    transition: background 0.2s;
}

.queue-table tbody tr:hover {
    background: #f9f9f9;
}

.risk-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
}

.risk-badge.critical {
    background: #ffebee;
    color: #c62828;
}

.risk-badge.high {
    background: #fff3e0;
    color: #e65100;
}

.risk-badge.medium {
    background: #fff9c4;
    color: #f57f17;
}

.risk-badge.low {
    background: #e8f5e9;
    color: #2e7d32;
}

.risk-badge.none {
    background: #f5f5f5;
    color: #666;
}

/* Conversation Page Styles */
.conversation-container {
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    padding: 30px;
}

.conversation-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid #e0e0e0;
}

.conversation-header h1 {
    color: #333;
    font-size: 24px;
}

.conversation-layout {
    display: grid;
    grid-template-columns: 1fr 400px;
    gap: 30px;
}

.messages-panel,
.analysis-panel {
    display: flex;
    flex-direction: column;
}

.panel-header {
    margin-bottom: 20px;
}

.panel-header h2 {
    color: #333;
    font-size: 20px;
    margin-bottom: 10px;
}

.user-info {
    color: #666;
    font-size: 14px;
}

.message-list {
    flex: 1;
    max-height: 500px;
    overflow-y: auto;
    padding: 20px;
    background: #f9f9f9;
    border-radius: 8px;
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.message {
    max-width: 80%;
    padding: 12px 16px;
    border-radius: 12px;
    word-wrap: break-word;
}

.message.user {
    align-self: flex-end;
    background: #e3f2fd;
    color: #333;
    border-bottom-right-radius: 4px;
}

.message.ai {
    align-self: flex-start;
    background: #f5f5f5;
    color: #333;
    border-bottom-left-radius: 4px;
}

.message.therapist {
    align-self: flex-start;
    background: #c8e6c9;
    color: #333;
    border-bottom-left-radius: 4px;
    border-left: 4px solid #4caf50;
}

.message-sender {
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 4px;
    opacity: 0.8;
}

.message-content {
    line-height: 1.5;
    white-space: pre-wrap;
}

.message-time {
    font-size: 11px;
    margin-top: 4px;
    opacity: 0.7;
}

.sentiment-indicator {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    margin-top: 5px;
    font-size: 11px;
    padding: 3px 8px;
    border-radius: 10px;
    background: rgba(0, 0, 0, 0.05);
}

.response-container {
    background: #f9f9f9;
    padding: 20px;
    border-radius: 8px;
}

.response-container h3 {
    color: #333;
    font-size: 16px;
    margin-bottom: 10px;
}

.response-container textarea {
    width: 100%;
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 16px;
    font-family: inherit;
    resize: vertical;
    margin-bottom: 10px;
    transition: border-color 0.3s;
}

.response-container textarea:focus {
    outline: none;
    border-color: #2196f3;
}

.risk-level-card {
    background: #f9f9f9;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.risk-level-card h3 {
    color: #333;
    font-size: 16px;
    margin-bottom: 15px;
}

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

.risk-icon {
    font-size: 32px;
}

.risk-text {
    font-size: 18px;
    font-weight: 600;
    color: #333;
}

.therapy-suggestions {
    background: #f9f9f9;
    padding: 20px;
    border-radius: 8px;
}

.therapy-suggestions h3 {
    color: #333;
    font-size: 16px;
    margin-bottom: 10px;
}

.suggestions-content {
    margin-top: 15px;
    max-height: 400px;
    overflow-y: auto;
}

.suggestions-content.collapsed {
    display: none;
}

.suggestions-content pre {
    white-space: pre-wrap;
    word-wrap: break-word;
    font-family: inherit;
    font-size: 14px;
    line-height: 1.6;
    color: #333;
}

/* Scrollbar Styles */
.message-list::-webkit-scrollbar,
.suggestions-content::-webkit-scrollbar {
    width: 8px;
}

.message-list::-webkit-scrollbar-track,
.suggestions-content::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.message-list::-webkit-scrollbar-thumb,
.suggestions-content::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

.message-list::-webkit-scrollbar-thumb:hover,
.suggestions-content::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Responsive Design */
@media (max-width: 1200px) {
    .conversation-layout {
        grid-template-columns: 1fr;
    }
    
    .analysis-panel {
        order: -1;
    }
}

@media (max-width: 768px) {
    .queue-header {
        flex-direction: column;
        gap: 15px;
        align-items: flex-start;
    }
    
    .header-actions {
        width: 100%;
        justify-content: space-between;
    }
    
    .queue-table {
        overflow-x: auto;
    }
    
    .conversation-header {
        flex-direction: column;
        gap: 10px;
        align-items: flex-start;
    }
}

/* Status indicator styles */
.status-indicator {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    margin-left: 12px;
}

.status-active {
    background-color: #e3f2fd;
    color: #1976d2;
}

.status-evaluating {
    background-color: #fff3e0;
    color: #f57c00;
}

.status-complete {
    background-color: #e8f5e9;
    color: #388e3c;
}

/* View-only message */
.view-only-message {
    background-color: #fff3cd;
    border: 1px solid #ffc107;
    padding: 12px;
    border-radius: 4px;
    margin-bottom: 16px;
    color: #856404;
}

/* Evaluating message */
.evaluating-message {
    background-color: #e3f2fd;
    padding: 12px;
    border-radius: 4px;
    color: #1976d2;
    font-style: italic;
}

/* Typing Indicator (Animated Ellipsis) */
.typing-indicator {
    align-self: flex-start;
    background: #f5f5f5;
    color: #333;
    padding: 12px 16px;
    border-radius: 12px;
    border-bottom-left-radius: 4px;
    display: flex;
    gap: 4px;
    align-items: center;
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    background: #999;
    border-radius: 50%;
    animation: typing 1.4s infinite;
}

.typing-indicator span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-indicator span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.7;
    }
    30% {
        transform: translateY(-10px);
        opacity: 1;
    }
}

/* Sentiment Evolution Chart */
.sentiment-chart-card {
    background: #f9f9f9;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.sentiment-chart-card h3 {
    color: #333;
    font-size: 16px;
    margin-bottom: 10px;
}

.sentiment-chart-legend {
    display: flex;
    gap: 16px;
    margin-bottom: 12px;
    font-size: 12px;
    color: #666;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 4px;
}

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

.legend-dot.positive { background: #4caf50; }
.legend-dot.neutral { background: #ff9800; }
.legend-dot.negative { background: #f44336; }

.sentiment-chart-container {
    position: relative;
    width: 100%;
    overflow-x: auto;
}

.sentiment-chart-container svg {
    display: block;
    width: 100%;
    height: auto;
}

.sentiment-chart-container svg .chart-line {
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.sentiment-chart-container svg .chart-area {
    opacity: 0.15;
}

.sentiment-chart-container svg .chart-dot {
    cursor: pointer;
    transition: r 0.2s;
}

.sentiment-chart-container svg .chart-dot:hover {
    r: 6;
}

.sentiment-chart-container svg .chart-label {
    font-size: 10px;
    fill: #999;
}

.sentiment-chart-container svg .grid-line {
    stroke: #e0e0e0;
    stroke-width: 1;
    stroke-dasharray: 4 4;
}

.sentiment-tooltip {
    position: absolute;
    background: #333;
    color: white;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 12px;
    pointer-events: none;
    white-space: nowrap;
    z-index: 10;
    transform: translate(-50%, -100%);
    margin-top: -8px;
}

.sentiment-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: #333;
}

/* Response header with button */
.response-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.response-header h3 {
    margin: 0;
}

.btn-load-suggested {
    font-size: 12px;
    padding: 6px 12px;
    white-space: nowrap;
}

.btn-load-suggested:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* Modal overlay */
.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;
    border-radius: 12px;
    padding: 40px;
    max-width: 420px;
    width: 90%;
    text-align: center;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

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

.modal-message {
    color: #333;
    font-size: 16px;
    line-height: 1.5;
    margin-bottom: 24px;
}

.modal-btn {
    max-width: 200px;
    margin: 0 auto;
}

/* Video Session Styles */
.video-button-container {
    padding: 12px 20px;
    text-align: center;
}

.btn-video {
    width: 100%;
    padding: 16px;
    background: linear-gradient(135deg, #4caf50 0%, #2e7d32 100%);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.btn-video:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(76, 175, 80, 0.4);
}

.btn-video:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.video-session-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #1a1a2e;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 900;
}

.waiting-screen {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1;
    color: white;
    text-align: center;
}

.waiting-content p {
    font-size: 18px;
    margin: 20px 0;
    color: #e0e0e0;
}

.waiting-animation {
    display: flex;
    gap: 8px;
    justify-content: center;
}

.waiting-animation span {
    width: 12px;
    height: 12px;
    background: #4caf50;
    border-radius: 50%;
    animation: waitingPulse 1.4s infinite;
}

.waiting-animation span:nth-child(2) {
    animation-delay: 0.2s;
}

.waiting-animation span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes waitingPulse {
    0%, 60%, 100% {
        transform: scale(1);
        opacity: 0.5;
    }
    30% {
        transform: scale(1.3);
        opacity: 1;
    }
}

.video-area {
    flex: 1;
    position: relative;
    background: #000;
}

.remote-video-container {
    width: 100%;
    height: 100%;
}

.remote-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    background: #222;
}

.local-video-container {
    position: absolute;
    bottom: 16px;
    right: 16px;
    width: 160px;
    height: 120px;
    border-radius: 8px;
    overflow: hidden;
    border: 2px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.local-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    background: #333;
}

.video-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 16px;
    padding: 16px;
    background: rgba(0, 0, 0, 0.8);
}

.btn-control {
    padding: 12px 20px;
    border: none;
    border-radius: 50px;
    font-size: 16px;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
}

.btn-control:hover {
    transform: scale(1.05);
}

.btn-mic-on, .btn-camera-on {
    background: #444;
    color: white;
}

.btn-mic-off, .btn-camera-off {
    background: #e74c3c;
    color: white;
}

.btn-end-session {
    background: #e74c3c;
    color: white;
    padding: 12px 24px;
}

.btn-end-session:hover {
    background: #c0392b;
}

.video-status-message {
    text-align: center;
    padding: 12px;
    color: #ffc107;
    background: rgba(0, 0, 0, 0.6);
    font-size: 14px;
}

@media (max-width: 600px) {
    .local-video-container {
        width: 100px;
        height: 75px;
        bottom: 8px;
        right: 8px;
    }

    .video-controls {
        gap: 10px;
        padding: 12px;
    }

    .btn-control {
        padding: 10px 14px;
        font-size: 14px;
    }
}

/* Transaction cards */
.transaction-card {
    background: #f9f9f9;
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    padding: 14px 16px;
    margin-bottom: 10px;
    transition: background 0.2s;
}

.transaction-card:hover {
    background: #f0f0f0;
}

.tx-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.tx-provider { font-weight: 600; color: #333; font-size: 15px; }
.tx-status { font-size: 13px; }
.tx-details { display: flex; justify-content: space-between; font-size: 14px; color: #555; margin-bottom: 6px; }
.tx-amount { font-weight: 700; color: #333; }
.tx-footer { display: flex; gap: 12px; font-size: 12px; color: #888; }

.slots-loading {
    display: flex;
    align-items: center;
    gap: 12px;
    color: #666;
}

/* My Patients page */
.patients-list {
    padding: 0 20px 20px;
}

.patients-day-header {
    font-size: 15px;
    font-weight: 600;
    color: #333;
    text-transform: capitalize;
    padding: 16px 0 8px;
    border-bottom: 1px solid #e0e0e0;
    margin-top: 8px;
}

.patient-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px 16px;
    background: #f9f9f9;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    margin-top: 8px;
    transition: background 0.2s, border-color 0.2s;
}

.patient-card[style*="cursor: pointer"]:hover {
    background: #f0f0ff;
    border-color: #667eea;
}

.patient-time {
    font-size: 14px;
    font-weight: 600;
    color: #333;
    min-width: 100px;
}

.patient-name {
    font-size: 15px;
    color: #333;
    flex: 1;
}

.patient-service {
    font-size: 12px;
    color: #888;
}

.patient-id {
    font-size: 11px;
    color: #999;
}

.patient-no-id {
    color: #c00;
    font-style: italic;
}

.patient-actions {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-left: auto;
}
