/* Basic styles for the EchoLink recording interface */
#echolink-recorder-container {
  max-width: 600px;
  margin: 20px auto;
  padding: 20px;
  border: 1px solid #ddd;
  border-radius: 4px;
  background-color: #f9f9f9;
}

#echolink-recorder-container h2 {
  margin-top: 0;
}

#echolink-recorder-container .controls {
  margin-bottom: 15px;
}

#echolink-recorder-container .controls button {
  margin-right: 10px;
  padding: 8px 16px;
  border: none;
  border-radius: 4px;
  background-color: #0073aa;
  color: #fff;
  cursor: pointer;
}

#echolink-recorder-container .controls button[disabled] {
  opacity: 0.5;
  cursor: default;
}

#echolink-transcript-container textarea {
  width: 100%;
  box-sizing: border-box;
  padding: 10px;
  border: 1px solid #ccc;
  border-radius: 4px;
  resize: vertical;
}

/* Buttons inside summary actions */
#echolink-summary-actions button {
  padding: 8px 16px;
  border: none;
  border-radius: 4px;
  background-color: #0073aa;
  color: #fff;
  cursor: pointer;
}

/* Generic button class used for AI tools on single memo pages */
.echolink-button {
  margin-right: 10px;
  margin-top: 10px;
  padding: 8px 16px;
  border: none;
  border-radius: 4px;
  background-color: #0073aa;
  color: #fff;
  cursor: pointer;
  display: inline-block;
}

/* Panel styling for AI tools on single memo pages */
#echolink-single-tools.echolink-tools-panel {
  max-width: 600px;
  margin: 20px auto;
  padding: 20px;
  border: 1px solid #ddd;
  border-radius: 4px;
  background-color: #f9f9f9;
}

#echolink-summary-container,
#echolink-result {
  margin-top: 20px;
}

/* Additional spacing for sections */
.section {
  margin-top: 20px;
}

/* Align buttons in summary container */
#echolink-summary-container div {
  margin-top: 10px;
}

#echolink-summary-container button {
  margin-right: 10px;
  padding: 6px 14px;
  border: none;
  border-radius: 4px;
  background-color: #0073aa;
  color: #fff;
  cursor: pointer;
}

/* Buttons for additional actions */
#echolink-summary-actions button {
  margin-right: 10px;
  padding: 6px 14px;
  border: none;
  border-radius: 4px;
  background-color: #0073aa;
  color: #fff;
  cursor: pointer;
}

/* Keyword list styling */
#echolink-keywords-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
#echolink-keywords-list .keyword-item {
  display: inline-flex;
  align-items: center;
  background-color: #e5e5e5;
  padding: 4px 8px;
  border-radius: 4px;
  cursor: pointer;
}
#echolink-keywords-list .keyword-item.selected {
  background-color: #0073aa;
  color: #fff;
}

/* Analysis text */
#echolink-analysis-text {
  white-space: pre-wrap;
  border: 1px solid #ccc;
  padding: 10px;
  border-radius: 4px;
  background-color: #fff;
}

/* Tasks list styling */
#echolink-tasks-list .task-item {
  display: flex;
  align-items: center;
  margin-bottom: 6px;
}
#echolink-tasks-list .task-item label {
  margin-left: 6px;
}

.hidden {
  display: none;
}

.echolink-entry audio {
  width: 100%;
  margin-bottom: 10px;
}

.echolink-entry h3 {
  margin-top: 20px;
}

/* Spinner shown during asynchronous actions such as transcribing audio */
.echolink-spinner {
  width: 24px;
  height: 24px;
  border: 4px solid #ccc;
  border-top-color: #0073aa;
  border-radius: 50%;
  animation: echolink-spin 0.8s linear infinite;
  display: inline-block;
  vertical-align: middle;
  margin-left: 8px;
}

@keyframes echolink-spin {
  to {
    transform: rotate(360deg);
  }
}
/* Enhanced styles for improved user experience */

/* Multi-source chat enhancements */
.echolink-multi-source-container {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 8px;
    padding: 20px;
    margin: 20px 0;
    border: 1px solid #dee2e6;
}

.echolink-multi-source-container h3 {
    color: #495057;
    margin-bottom: 15px;
    font-size: 1.2em;
    display: flex;
    align-items: center;
}

.echolink-multi-source-container h3:before {
    content: "🤖";
    margin-right: 8px;
    font-size: 1.1em;
}

/* Source selection styling */
#memo-selection label {
    transition: all 0.2s ease;
    background: white;
}

#memo-selection label:hover {
    background: #f8f9fa;
    border-color: #0073aa;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

#memo-selection input[type="checkbox"]:checked + strong {
    color: #0073aa;
}

/* Button enhancements */
#start-multi-chat, #end-multi-chat {
    transition: all 0.2s ease;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-size: 0.9em;
}

#start-multi-chat:hover:not(:disabled) {
    background: #005a87 !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0,115,170,0.3);
}

#start-multi-chat:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

#end-multi-chat:hover {
    background: #b32d2e !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(220,50,50,0.3);
}

/* Chat interface improvements */
.chat-message {
    animation: fadeInUp 0.3s ease;
    border-left: 3px solid transparent;
}

.chat-message.user-message {
    border-left-color: #28a745;
}

.chat-message.assistant-message {
    border-left-color: #007cba;
}

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

/* Document upload enhancements */
#echolink-document-container {
    background: linear-gradient(135deg, #fff3cd 0%, #ffeaa7 100%);
    border-radius: 8px;
    padding: 20px;
    margin: 20px 0;
    border: 1px solid #ffeaa7;
}

#echolink-document-container h3 {
    color: #856404;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
}

#echolink-document-container h3:before {
    content: "📄";
    margin-right: 8px;
}

/* Radio button styling */
input[type="radio"] {
    margin-right: 8px;
    transform: scale(1.1);
}

/* File input styling */
input[type="file"] {
    padding: 8px;
    border: 2px dashed #ccc;
    border-radius: 4px;
    background: white;
    width: 100%;
    transition: border-color 0.2s ease;
}

input[type="file"]:hover {
    border-color: #0073aa;
}

/* Drag and drop enhancements */
.drag-handle {
    cursor: grab;
    color: #666;
    font-size: 1.2em;
    padding: 5px;
    border-radius: 3px;
    transition: all 0.2s ease;
}

.drag-handle:hover {
    background: rgba(0,115,170,0.1);
    color: #0073aa;
}

#toggle-drag-mode {
    transition: all 0.2s ease;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-size: 0.9em;
    position: relative;
    overflow: hidden;
}

#toggle-drag-mode:before {
    content: "";
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s;
}

#toggle-drag-mode:hover:before {
    left: 100%;
}

/* Quick question buttons */
.quick-question, .multi-quick-question {
    background: #e9ecef;
    border: 1px solid #ced4da;
    border-radius: 12px;
    transition: all 0.2s ease;
    cursor: pointer;
}

.quick-question:hover, .multi-quick-question:hover {
    background: #0073aa;
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,115,170,0.3);
}

/* Active sources display */
#active-sources-list span {
    transition: all 0.2s ease;
}

#active-sources-list span:hover {
    transform: scale(1.05);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* Loading states */
.loading {
    position: relative;
}

.loading:after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #0073aa;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Message notifications */
.message-notification {
    animation: slideInRight 0.3s ease;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Responsive improvements */
@media (max-width: 768px) {
    .echolink-multi-source-container,
    #echolink-document-container {
        margin: 15px 0;
        padding: 15px;
    }
    
    #memo-selection {
        max-height: 120px;
    }
    
    .quick-question, .multi-quick-question {
        display: block;
        margin: 5px 0;
        width: 100%;
    }
    
    #start-multi-chat, #end-multi-chat {
        width: 100%;
        margin: 10px 0;
    }
}

/* Focus states for accessibility */
input:focus, textarea:focus, button:focus {
    outline: 2px solid #0073aa;
    outline-offset: 2px;
}

/* Improved section spacing */
.section {
    margin-bottom: 25px;
}

.section:last-child {
    margin-bottom: 0;
}

/* Enhanced card styling for drag and drop */
.echolink-card {
    transition: all 0.2s ease;
    position: relative;
}

.echolink-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.echolink-card.sortable-chosen {
    transform: rotate(2deg) scale(1.02);
    box-shadow: 0 8px 20px rgba(0,0,0,0.2);
    z-index: 1000;
}

.echolink-card.sortable-ghost {
    opacity: 0.3;
    transform: scale(0.95);
}

/* Status indicators */
.status-indicator {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 8px;
}

.status-indicator.success {
    background: #28a745;
    animation: pulse 2s infinite;
}

.status-indicator.error {
    background: #dc3545;
}

.status-indicator.processing {
    background: #ffc107;
    animation: pulse 1s infinite;
}

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

/* Improved typography */
h3 {
    font-weight: 600;
    line-height: 1.3;
}

h4 {
    font-weight: 500;
    color: #495057;
    margin-bottom: 10px;
}

/* Better form styling */
input[type="text"], textarea {
    border: 1px solid #ced4da;
    border-radius: 4px;
    padding: 8px 12px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

input[type="text"]:focus, textarea:focus {
    border-color: #0073aa;
    box-shadow: 0 0 0 2px rgba(0,115,170,0.1);
}

/* Enhanced button styling */
button {
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.2s ease;
}

button:active {
    transform: translateY(1px);
}

/* Improved spacing and layout */
.section > *:last-child {
    margin-bottom: 0;
}

/* Better visual hierarchy */
strong {
    font-weight: 600;
    color: #212529;
}

small {
    font-size: 0.875em;
    line-height: 1.4;
}

/* Enhanced accessibility */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

