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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    color: #333;
    background: linear-gradient(135deg, #00A8E1 0%, #73CFEF 100%);
    min-height: 100vh;
}

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

.auth-header {
    text-align: center;
    color: white;
    margin-bottom: 40px;
}

.auth-header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
}

.auth-header p {
    font-size: 1.2rem;
    opacity: 0.9;
}

/* Auth Section */
.auth-section {
    background: white;
    border-radius: 12px;
    padding: 30px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    margin-bottom: 20px;
}

.auth-tabs {
    display: flex;
    margin-bottom: 20px;
    border-bottom: 1px solid #eee;
}

.tab-button {
    flex: 1;
    padding: 12px;
    border: none;
    background: none;
    cursor: pointer;
    font-size: 1rem;
    color: #666;
    border-bottom: 2px solid transparent;
    transition: all 0.3s;
}

.tab-button.active {
    color: #00A8E1;
    border-bottom-color: #00A8E1;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

.auth-form {
    max-width: 400px;
    margin: 0 auto;
}

.auth-form h2 {
    margin-bottom: 20px;
    text-align: center;
    color: #333;
}

.auth-form input {
    width: 100%;
    padding: 12px;
    margin-bottom: 15px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 1rem;
}

.auth-form button {
    width: 100%;
    padding: 12px;
    background: #00A8E1;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    cursor: pointer;
    transition: background 0.3s;
}

.auth-form button:hover {
    background: #0096CC;
}

/* App Section */
.app-section {
    background: white;
    border-radius: 12px;
    padding: 30px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    min-height: 600px;
}

.nav-bar {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    padding: 15px 20px;
    width: 100%;
    box-sizing: border-box;
    position: relative;
}

.user-profile {
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
}

.profile-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: #6bb6db;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    color: white;
    transition: background-color 0.2s;
}

.profile-btn:hover {
    background: #5aa5ca;
}

.dropdown-arrow {
    font-size: 12px;
    transition: transform 0.2s;
}

.profile-btn.active .dropdown-arrow {
    transform: rotate(180deg);
}

.profile-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 4px;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    padding: 12px;
    min-width: 200px;
    z-index: 1000;
}

.dropdown-section {
    padding: 8px 0;
}

.dropdown-section:not(:last-child) {
    border-bottom: 1px solid #e2e8f0;
}

.dropdown-section label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: #4a5568;
    margin-bottom: 8px;
}

.dropdown-section .language-toggle {
    width: fit-content;
}

.language-toggle {
    display: flex;
    gap: 4px;
    background: #f7fafc;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 2px;
}

.lang-btn {
    padding: 6px 12px;
    border: none;
    background: transparent;
    color: #4a5568;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.lang-btn:hover {
    background: rgba(0, 168, 225, 0.1);
    color: #00A8E1;
}

.lang-btn.active {
    background: #00A8E1;
    color: white;
    box-shadow: 0 1px 3px rgba(0, 168, 225, 0.3);
}

#logout-btn {
    padding: 8px 16px;
    background: #99DCF3;
    color: #00A8E1;
    border: 1px solid #73CFEF;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.3s;
}

#logout-btn:hover {
    background: #73CFEF;
    color: white;
}

.app-tabs {
    display: flex;
    margin-bottom: 30px;
    border-bottom: 1px solid #eee;
}

.app-tab-button {
    padding: 15px 25px;
    border: none;
    background: none;
    cursor: pointer;
    font-size: 1.1rem;
    color: #666;
    border-bottom: 3px solid transparent;
    transition: all 0.3s;
}

.app-tab-button.active {
    color: #00A8E1;
    border-bottom-color: #00A8E1;
}

.app-tab-content {
    display: none;
}

.app-tab-content.active {
    display: block;
}

/* Scenarios */
.scenario-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 20px;
    padding: 0 5px;
}

.filter-btn {
    padding: 8px 16px;
    border: 1px solid #e2e8f0;
    border-radius: 20px;
    background: white;
    color: #4a5568;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.filter-btn:hover {
    border-color: #00a8e1;
    color: #00a8e1;
}

.filter-btn.active {
    background: #00a8e1;
    color: white;
    border-color: #00a8e1;
}

.scenarios-list {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
}

.scenario-card {
    flex: 0 0 calc(50% - 10px);
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 20px;
    cursor: pointer;
    transition: all 0.3s;
}

.scenario-card:hover {
    border-color: #00A8E1;
    box-shadow: 0 4px 12px rgba(0, 168, 225, 0.15);
    transform: translateY(-2px);
}

.scenario-card h3 {
    color: #00A8E1;
    margin-bottom: 10px;
}

.scenario-card .category {
    display: inline-block;
    padding: 4px 8px;
    background: #00A8E1;
    color: white;
    border-radius: 4px;
    font-size: 0.8rem;
    margin-bottom: 10px;
}

.scenario-card .difficulty {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
    margin-left: 5px;
}

.difficulty.easy { background: #48bb78; color: white; }
.difficulty.medium { background: #ed8936; color: white; }
.difficulty.hard { background: #f56565; color: white; }

/* Session Interface */
.session-interface {
    max-width: 600px;
    margin: 0 auto;
}

.session-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding: 20px;
    background: linear-gradient(135deg, #E5F6FC 0%, #BFE9F8 100%);
    border-radius: 8px;
    border-left: 4px solid #00A8E1;
}

.scenario-info {
    text-align: center;
    flex: 1;
}

.turn-counter {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 140px;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.7);
    border-radius: 8px;
    border: 1px solid rgba(0, 168, 225, 0.2);
}

.turn-display {
    font-size: 1.1em;
    color: #2d3748;
    margin-bottom: 4px;
}


@media (max-width: 768px) {
    .session-header {
        flex-direction: column;
        gap: 15px;
    }
    
    .scenario-info {
        order: 1;
    }
    
    .turn-counter {
        order: 2;
        min-width: auto;
        width: 100%;
    }
}

.conversation-area {
    border: 1px solid #BFE9F8;
    border-radius: 8px;
    height: 400px;
    overflow-y: auto;
    padding: 20px;
    margin-bottom: 20px;
    background: #E5F6FC;
}

.message-bubble {
    margin-bottom: 15px;
    padding: 12px 16px;
    border-radius: 18px;
    max-width: 80%;
}

.message-bubble.user {
    background: #00A8E1;
    color: white;
    margin-left: auto;
}

.message-bubble.character {
    background: white;
    border: 1px solid #BFE9F8;
    box-shadow: 0 2px 4px rgba(0, 168, 225, 0.1);
}

.message-bubble.system-message {
    max-width: 95%;
    margin: 20px auto;
    padding: 0;
    background: transparent;
    border: none;
}


.message-input {
    display: flex;
    gap: 10px;
}

.message-input input {
    flex: 1;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 1rem;
}

.message-input button {
    padding: 12px 20px;
    background: #00A8E1;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.3s;
}

.message-input button:hover {
    background: #0096CC;
}

/* Google Sign-In */
.auth-divider {
    margin: 20px 0;
    text-align: center;
    position: relative;
}

.auth-divider::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: #ddd;
}

.auth-divider span {
    background: white;
    padding: 0 15px;
    color: #666;
    font-size: 0.9rem;
}

.google-signin-btn {
    margin-top: 15px;
    display: flex;
    justify-content: center;
}

/* Messages - Floating Overlay */
.message {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 9999;
    padding: 20px 30px;
    border-radius: 12px;
    text-align: center;
    font-weight: 500;
    font-size: 1.1em;
    min-width: 200px;
    max-width: 400px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    display: none;
    animation: messageSlideIn 0.3s ease-out;
}

.message.success {
    background: rgba(191, 233, 248, 0.95);
    color: #00A8E1;
    border: 1px solid rgba(115, 207, 239, 0.3);
}

.message.error {
    background: rgba(254, 215, 215, 0.95);
    color: #c53030;
    border: 1px solid rgba(254, 178, 178, 0.3);
}

.message.info {
    background: rgba(255, 255, 255, 0.95);
    color: #2d3748;
    border: 1px solid rgba(0, 168, 225, 0.3);
}

/* Loading spinner animation */
.message.info::before {
    content: '';
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid #00A8E1;
    border-radius: 50%;
    border-top-color: transparent;
    animation: spin 1s linear infinite;
    margin-right: 10px;
    vertical-align: middle;
}

@keyframes messageSlideIn {
    from {
        opacity: 0;
        transform: translate(-50%, -60%);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%);
    }
}

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

@keyframes messageSlideOut {
    from {
        opacity: 1;
        transform: translate(-50%, -50%);
    }
    to {
        opacity: 0;
        transform: translate(-50%, -40%);
    }
}

/* Mobile responsive adjustments for message overlay */
@media (max-width: 768px) {
    .message {
        margin: 0 20px;
        min-width: unset;
        max-width: calc(100vw - 40px);
        padding: 16px 20px;
        font-size: 1rem;
    }
    
    .message.info::before {
        width: 16px;
        height: 16px;
        margin-right: 8px;
    }
}

.loading {
    text-align: center;
    color: #666;
    font-style: italic;
}

/* Role selection styling */
.role-selection {
  max-width: 800px;
  margin: 0 auto;
  padding: 20px;
}

.role-selection-header {
  text-align: center;
  margin-bottom: 30px;
}

.role-selection-header h3 {
  color: #2d3748;
  margin-bottom: 10px;
}

.role-selection-header p {
  color: #4a5568;
  font-size: 1.1em;
}

.scenario-description {
  background: #f7fafc;
  border-left: 4px solid #00a8e1;
  padding: 12px 16px;
  margin: 15px 0;
  border-radius: 4px;
  font-style: italic;
  color: #2d3748 !important;
}

.roles-container {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
  margin-bottom: 30px;
}

@media (max-width: 768px) {
  .roles-container {
    grid-template-columns: 1fr;
  }
}

.role-card {
  border: 2px solid #e2e8f0;
  border-radius: 12px;
  padding: 20px;
  background: white;
  transition: all 0.2s ease;
}

.role-card:hover {
  border-color: #3182ce;
  box-shadow: 0 4px 12px rgba(49, 130, 206, 0.1);
}

.role-card.selectable {
  cursor: pointer;
}

.role-card.selected {
  border-color: #00A8E1;
  background: rgba(0, 168, 225, 0.05);
  box-shadow: 0 4px 12px rgba(0, 168, 225, 0.15);
}

.role-card.selected h4 {
  color: #00A8E1;
}

.role-card h4 {
  color: #2d3748;
  margin-bottom: 12px;
  font-size: 1.2em;
}

.role-description {
  color: #4a5568;
  margin-bottom: 15px;
  line-height: 1.5;
}

.role-preview {
  background-color: #f7fafc;
  padding: 12px;
  border-radius: 8px;
  margin-bottom: 15px;
  border-left: 3px solid #3182ce;
}

.role-preview strong {
  color: #2d3748;
}

.role-preview em {
  color: #4a5568;
  font-style: italic;
  display: block;
  margin-top: 5px;
}


.role-selection-actions {
  text-align: center;
}

.role-selection-actions button {
  background-color: #e2e8f0;
  color: #4a5568;
  border: none;
  padding: 10px 20px;
  border-radius: 6px;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.role-selection-actions button:hover {
  background-color: #cbd5e0;
}

/* Connection Type Selection */
.connection-type-section {
  margin: 30px 0;
  padding: 20px;
  background: #f7fafc;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
}

.connection-type-section h4 {
  color: #2d3748;
  margin-bottom: 8px;
  font-size: 1.1em;
}

.connection-type-section p {
  color: #4a5568;
  margin-bottom: 15px;
  font-size: 0.95em;
}

.connection-type-options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

.connection-type-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 15px 12px;
  background: white;
  border: 2px solid #e2e8f0;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
}

.connection-type-btn:hover {
  border-color: #00A8E1;
  box-shadow: 0 2px 8px rgba(0, 168, 225, 0.1);
}

.connection-type-btn.active {
  border-color: #00A8E1;
  background: rgba(0, 168, 225, 0.05);
  box-shadow: 0 2px 8px rgba(0, 168, 225, 0.15);
}

.connection-type-btn strong {
  color: #2d3748;
  font-size: 0.95em;
  margin-bottom: 4px;
}

.connection-type-btn span {
  color: #4a5568;
  font-size: 0.85em;
}

.connection-type-btn.active strong {
  color: #00A8E1;
}

@media (max-width: 600px) {
  .connection-type-options {
    grid-template-columns: 1fr;
  }
  
  .connection-type-section {
    margin: 20px 0;
    padding: 15px;
  }
}

/* Start Session Button */
.start-session-container {
  margin: 30px 0 20px 0;
  text-align: center;
}

.start-session-btn {
  background: #00A8E1;
  color: white;
  border: none;
  padding: 16px 32px;
  border-radius: 8px;
  font-size: 1.1em;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  min-width: 200px;
}

.start-session-btn:hover:not(:disabled) {
  background: #0096CC;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 168, 225, 0.3);
}

.start-session-btn:disabled {
  background: #cbd5e0;
  color: #4a5568;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* Session rows */
.session-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  margin-bottom: 8px;
  background: white;
  cursor: pointer;
  transition: all 0.2s ease;
}

.session-row:hover {
  border-color: #00A8E1;
  box-shadow: 0 2px 8px rgba(0, 168, 225, 0.1);
  transform: translateY(-1px);
}

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

.session-scenario {
  font-weight: 600;
  color: #2d3748;
  font-size: 1.1em;
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.session-role {
  color: #4a5568;
  font-size: 0.9em;
}

.session-right {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-shrink: 0;
}

.session-score .score {
  font-weight: 600;
  font-size: 1.1em;
}

.session-score .score.positive {
  color: #38a169;
}

.session-score .score.negative {
  color: #e53e3e;
}

.session-turns {
  color: #4a5568;
  font-size: 0.9em;
  min-width: 60px;
  text-align: center;
}

.session-date {
  color: #718096;
  font-size: 0.85em;
  min-width: 80px;
  text-align: right;
}

.empty-sessions {
  text-align: center;
  padding: 60px 20px;
  color: #4a5568;
}

.empty-sessions h3 {
  margin-bottom: 10px;
  color: #2d3748;
}

.empty-sessions p {
  margin-bottom: 20px;
}

.start-practicing-btn {
  background: #00A8E1;
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: 6px;
  font-size: 1rem;
  cursor: pointer;
  transition: background 0.3s;
}

.start-practicing-btn:hover {
  background: #0096CC;
}

/* Session detail styles */
.session-detail {
  max-width: 800px;
  margin: 0 auto;
}

.session-detail-header {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 30px;
  padding-bottom: 20px;
  border-bottom: 1px solid #e2e8f0;
}

.back-btn {
  background: #e2e8f0;
  color: #4a5568;
  border: none;
  padding: 10px 16px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
}

.back-btn:hover {
  background: #cbd5e0;
}

.session-detail-header h3 {
  flex: 1;
  color: #2d3748;
  margin: 0;
}

.session-status {
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 0.8em;
  font-weight: 600;
  text-transform: uppercase;
}

.session-status.completed {
  background: #c6f6d5;
  color: #22543d;
}

.session-status.abandoned {
  background: #fed7d7;
  color: #742a2a;
}

.session-status.active {
  background: #bee3f8;
  color: #1a365d;
}

.session-summary {
  display: grid;
  grid-template-columns: 1fr 3fr 1fr;
  gap: 20px;
  margin-bottom: 40px;
  padding: 20px;
  background: #f7fafc;
  border-radius: 8px;
  align-items: start;
}

.summary-item {
  color: #4a5568;
}

.summary-item strong {
  color: #2d3748;
}

.conversation-history h4 {
  margin-bottom: 20px;
  color: #2d3748;
}

.conversation-turns {
  padding: 20px;
  background: white;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
}

.message-bubble.user-message {
  background: #00A8E1;
  color: white;
  margin-bottom: 15px;
  margin-left: auto;
  margin-right: 0;
  max-width: 80%;
  padding: 12px 16px;
  border-radius: 18px;
  display: block;
}

.message-bubble.ai-message {
  background: #f7fafc;
  border: 1px solid #e2e8f0;
  margin-bottom: 15px;
  margin-left: 0;
  margin-right: auto;
  max-width: 80%;
  padding: 12px 16px;
  border-radius: 18px;
  display: block;
}

.turn-score {
  text-align: center;
  padding: 10px;
  background: #f7fafc;
  border-radius: 6px;
  font-size: 0.9em;
}

.rationale {
  margin-top: 8px;
  color: #4a5568;
}

/* Responsive */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
    
    .auth-header h1 {
        font-size: 2rem;
    }
    
    .auth-section, .app-section {
        padding: 20px;
    }
    
    .scenarios-list {
        flex-direction: column;
    }
    
    .scenario-card {
        flex: 1 1 100%;
    }
    
    .session-right {
        gap: 12px;
    }
    
    .session-turns,
    .session-date {
        font-size: 0.8em;
        min-width: auto;
    }
    
    .session-detail-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .session-summary {
        grid-template-columns: 1fr 1fr;
        gap: 15px;
        padding: 15px;
    }
}

/* Session Action Buttons */
.session-actions {
    margin-top: 20px;
    text-align: center;
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

.session-btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 0.95em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 140px;
}

.end-session-btn {
    background: #e53e3e;
    color: white;
}

.end-session-btn:hover {
    background: #c53030;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(229, 62, 62, 0.3);
}

.analytics-btn {
    background: #00A8E1;
    color: white;
}

.analytics-btn:hover {
    background: #0088b8;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 168, 225, 0.3);
}

@media (max-width: 480px) {
    .session-actions {
        flex-direction: column;
        align-items: center;
    }
    
    .session-btn {
        width: 100%;
        max-width: 200px;
    }
}

/* Connection Score Bar */
.connection-score-container {
    margin: 15px 0;
    padding: 15px;
    background: #f7fafc;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}

.score-title {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}

.score-title strong {
    color: #2d3748;
    font-size: 0.95em;
}

.score-bar-wrapper {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.score-bar {
    position: relative;
    width: 100%;
    height: 12px;
    background: #e2e8f0;
    border-radius: 6px;
    overflow: hidden;
}

.score-fill {
    height: 100%;
    background: #718096;
    border-radius: 6px;
    transition: width 0.8s ease, background-color 0.6s ease;
    position: relative;
}

.score-center-line {
    position: absolute;
    left: 50%;
    top: 0;
    width: 2px;
    height: 100%;
    background: #4a5568;
    transform: translateX(-50%);
    z-index: 1;
}

.score-labels {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.8em;
    color: #4a5568;
}

.score-current {
    font-weight: 600;
    font-size: 0.95em;
    padding: 4px 8px;
    background: white;
    border-radius: 6px;
    border: 1px solid #cbd5e0;
    min-width: 32px;
    text-align: center;
    transition: color 0.6s ease, transform 0.3s ease;
}

.score-current.score-updating {
    transform: scale(1.1);
    animation: score-pulse 0.6s ease;
}

@keyframes score-pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(0, 168, 225, 0.4);
    }
    50% {
        box-shadow: 0 0 0 8px rgba(0, 168, 225, 0.1);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(0, 168, 225, 0);
    }
}

@keyframes score-pulse-positive {
    0% {
        box-shadow: 0 0 0 0 rgba(56, 161, 105, 0.4);
    }
    50% {
        box-shadow: 0 0 0 8px rgba(56, 161, 105, 0.1);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(56, 161, 105, 0);
    }
}

@keyframes score-pulse-negative {
    0% {
        box-shadow: 0 0 0 0 rgba(229, 62, 62, 0.4);
    }
    50% {
        box-shadow: 0 0 0 8px rgba(229, 62, 62, 0.1);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(229, 62, 62, 0);
    }
}

.score-current.score-updating-positive {
    transform: scale(1.1);
    animation: score-pulse-positive 0.6s ease;
}

.score-current.score-updating-negative {
    transform: scale(1.1);
    animation: score-pulse-negative 0.6s ease;
}

@media (max-width: 480px) {
    .connection-score-container {
        margin: 12px 0;
        padding: 12px;
    }
    
    .score-bar {
        height: 10px;
    }
    
    .score-labels {
        font-size: 0.75em;
    }
}

/* Typing Indicator Animation */
.typing-indicator {
    opacity: 0.8;
}

.typing-animation {
    display: inline-flex;
    align-items: center;
    margin-left: 10px;
    gap: 3px;
}

.typing-dot {
    width: 6px;
    height: 6px;
    background: #718096;
    border-radius: 50%;
    animation: typing-bounce 1.4s infinite ease-in-out;
}

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

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

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

@keyframes typing-bounce {
    0%, 80%, 100% {
        transform: scale(0.8);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Charts Row - Desktop Side by Side Layout */
.charts-row {
    display: flex;
    gap: 20px;
    margin: 30px 0;
}

/* Connection Score Progression Chart */
.score-progression-chart {
    flex: 1;
    margin: 0;
    padding: 20px;
    background: #f7fafc;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
}

.score-progression-chart h4 {
    margin: 0 0 15px 0;
    color: #2d3748;
    font-size: 1.1em;
}

.chart-container {
    display: flex;
    justify-content: center;
    background: white;
    border-radius: 8px;
    padding: 15px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

#score-chart {
    max-width: 100%;
    height: auto;
}

@media (max-width: 768px) {
    .charts-row {
        flex-direction: column;
        gap: 15px;
        margin: 20px 0;
    }
    
    .score-progression-chart {
        margin: 0;
        padding: 15px;
    }
    
    .chart-container {
        padding: 10px;
    }
    
    #score-chart {
        width: 100%;
        max-width: 500px;
    }
}

/* Score Distribution Comparison Chart */
.score-distribution-chart {
    flex: 1;
    margin: 0;
    padding: 20px;
    background: #f7fafc;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
}

.score-distribution-chart h4 {
    margin: 0 0 15px 0;
    color: #2d3748;
    font-size: 1.1em;
}

.score-comparison-summary {
    margin-bottom: 20px;
}

.percentile-display {
    text-align: center;
    padding: 20px;
    background: white;
    border-radius: 8px;
    border: 2px solid #00a8e1;
    margin-bottom: 15px;
}

.percentile-number {
    font-size: 2.5rem;
    font-weight: bold;
    color: #00a8e1;
    margin-bottom: 5px;
}

.percentile-text {
    font-size: 1.1rem;
    color: #2d3748;
    margin-bottom: 5px;
}

.sample-size {
    font-size: 0.9rem;
    color: #666;
    font-style: italic;
}

.percentile-summary {
    padding-top: 10px;
}

.comparison-chart-container {
    background: white;
    border-radius: 8px;
    padding: 15px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.comparison-loading {
    text-align: center;
    padding: 20px;
    color: #666;
}

#comparison-chart {
    max-width: 100%;
    height: auto;
}

@media (max-width: 768px) {
    .score-distribution-chart {
        margin: 0;
        padding: 15px;
    }
    
    .percentile-number {
        font-size: 2rem;
    }
    
    .percentile-text {
        font-size: 1rem;
    }
    
    .comparison-chart-container {
        padding: 10px;
    }
    
    #comparison-chart {
        width: 100%;
        max-width: 500px;
    }
}

/* Conversation Insights */
.conversation-insights {
    margin: 30px 0;
    padding: 20px;
    background: #f7fafc;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
}

.conversation-insights h4 {
    margin: 0 0 15px 0;
    color: #2d3748;
    font-size: 1.1em;
}

.insights-loading {
    text-align: center;
    color: #718096;
    font-style: italic;
    padding: 20px;
}

.insights-error {
    text-align: center;
    color: #e53e3e;
    padding: 20px;
}

.insights-content {
    display: grid;
    gap: 20px;
}

.insights-section {
    background: white;
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.insights-section h5 {
    margin: 0 0 10px 0;
    color: #2d3748;
    font-size: 1em;
    font-weight: 600;
}

.insights-list {
    margin: 0;
    padding: 0;
    list-style: none;
}

.insights-list li {
    padding: 8px 0;
    border-bottom: 1px solid #f1f5f9;
    position: relative;
    padding-left: 20px;
    line-height: 1.4;
}

.insights-list li:last-child {
    border-bottom: none;
}

.insights-list.positive li:before {
    content: '✓';
    position: absolute;
    left: 0;
    color: #38a169;
    font-weight: bold;
}

.insights-list.neutral li:before {
    content: '•';
    position: absolute;
    left: 0;
    color: #00A8E1;
    font-weight: bold;
}

.insights-list.suggestions li:before {
    content: '→';
    position: absolute;
    left: 0;
    color: #ed8936;
    font-weight: bold;
}

@media (max-width: 768px) {
    .conversation-insights {
        margin: 20px 0;
        padding: 15px;
    }
    
    .insights-content {
        gap: 15px;
    }
    
    .insights-section {
        padding: 12px;
    }
}