/* CSS Custom Properties */
:root {
    --primary-color: #667eea;
    --secondary-color: #764ba2;
    --focused-color: #2196f3;
    --category-color: #9c27b0;
    --success-color: #4caf50;
    --danger-color: #f44336;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: #333;
    background: #f5f5f5;
}

/* Navigation */
.navbar {
    background: #2c3e50;
    padding: 1rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.navbar-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
}

.navbar-brand-wrapper {
    display: flex;
    flex-direction: column;
}

.navbar .navbar-brand {
    color: #fff;
    text-decoration: none;
    font-size: 1.5rem;
    font-weight: bold;
}

.navbar-toggler {
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 0.25rem 0.75rem;
    background-color: transparent;
    cursor: pointer;
    border-radius: 0.25rem;
}

.navbar-toggler:focus {
    box-shadow: 0 0 0 0.25rem rgba(52, 152, 219, 0.25);
    outline: 0;
}

.navbar-toggler:hover {
    border-color: rgba(255, 255, 255, 0.5);
}

/* Hamburger icon - three horizontal lines */
.navbar-toggler-icon {
    display: inline-block;
    width: 1.5em;
    height: 1.5em;
    vertical-align: middle;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba%28255, 255, 255, 0.85%29' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: center;
    background-size: 100%;
}

.navbar-menu {
    display: flex;
    list-style: none;
    gap: 2rem;
    margin-bottom: 0;
}

.navbar-menu .nav-link {
    color: #ecf0f1;
    text-decoration: none;
    transition: color 0.3s;
    padding: 0.5rem 0;
}

.navbar-menu .nav-link:hover {
    color: #3498db;
}

.navbar-user {
    color: #ecf0f1;
    white-space: nowrap;
    margin-left: 2rem;
}

/* Hide hamburger on desktop */
@media (min-width: 992px) {
    .navbar-toggler {
        display: none;
    }
}

/* Mobile navbar adjustments */
@media (max-width: 991px) {
    .navbar-collapse {
        margin-top: 1rem;
        display: none;
    }
    
    .navbar-collapse.show {
        display: block;
    }
    
    .navbar-menu {
        flex-direction: column;
        gap: 0;
        align-items: flex-start;
        margin-bottom: 1rem;
    }
    
    .navbar-menu .nav-item {
        width: 100%;
    }
    
    .navbar-menu .nav-link {
        display: block;
        padding: 0.75rem 0;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }
    
    .navbar-user {
        margin-left: 0;
        padding-top: 0.5rem;
        border-top: 1px solid rgba(255, 255, 255, 0.1);
    }
}

/* Layout */
.container {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 1rem;
}

.content-card {
    background: white;
    border-radius: 8px;
    padding: 2rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

/* Messages */
.messages {
    margin-bottom: 1rem;
}

.message {
    padding: 1rem;
    border-radius: 4px;
    margin-bottom: 0.5rem;
}

.message.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.message.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.message.info {
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

/* Typography */
h1 {
    color: #2c3e50;
    margin-bottom: 1.5rem;
}

h2 {
    color: #34495e;
    margin: 1.5rem 0 1rem;
}

/* Dashboard Styles */
.dashboard-header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    padding: 2rem;
    border-radius: 10px 10px 0 0;
    margin: -1rem -1rem 2rem -1rem;
}

.session-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    margin-top: 1.5rem;
}

.stat-card {
    background: rgba(255,255,255,0.2);
    padding: 1rem;
    border-radius: 8px;
    backdrop-filter: blur(10px);
}

.stat-value {
    font-size: 2rem;
    font-weight: bold;
    display: block;
}

.control-panel {
    background: #f8f9fa;
    padding: 1.5rem;
    border-radius: 8px;
    margin-bottom: 2rem;
}

.filter-group {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

.filter-chips {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-top: 1rem;
}

.chip {
    padding: 0.5rem 1rem;
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s;
}

.chip:hover {
    border-color: var(--primary-color);
    transform: translateY(-2px);
}

.chip.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.main-grid {
    display: grid;
    grid-template-columns: 1fr 350px;
    gap: 2rem;
}

.code-card {
    position: relative;
    pointer-events: auto;
    background: white;
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: all 0.3s;
    border-left: 4px solid transparent;
}

.code-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    transform: translateX(5px);
}

.code-card.provisional-category {
    background: linear-gradient(to right, #f3e7ff 0%, white 100%);
    border-left-color: var(--category-color);
}

.code-card.focused-code {
    background: linear-gradient(to right, #e3f2fd 0%, white 100%);
    border-left-color: var(--focused-color);
}

.code-card.provisional-category.focused-code {
    pointer-events: auto;
    position: relative;
    z-index: 2;
}

.code-card.reviewed {
    opacity: 0.7;
}

.code-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
}

.code-name {
    font-size: 1.2rem;
    font-weight: 600;
    color: #333;
}

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

.badge {
    padding: 0.25rem 0.5rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.badge-category {
    background: var(--category-color);
    color: white;
}

.badge-focused {
    background: var(--focused-color);
    color: white;
}

.badge-reviewed {
    background: var(--success-color);
    color: white;
}

.code-stats {
    display: flex;
    gap: 1.5rem;
    margin-bottom: 1rem;
    color: #666;
    font-size: 0.9rem;
}

.code-actions {
    display: flex;
    gap: 0.5rem;
    padding-top: 1rem;
    border-top: 1px solid #e0e0e0;
}

.action-btn {
    flex: 1;
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 6px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 0.9rem;
}

.btn-elevate {
    background: var(--category-color);
    color: white;
}

.btn-focus {
    background: var(--focused-color);
    color: white;
}

.btn-memo {
    background: #f5f5f5;
    color: #333;
}

.btn-skip {
    background: white;
    border: 1px solid #e0e0e0;
    color: #666;
}

.sidebar-card {
    background: white;
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.sidebar-card h3 {
    margin-bottom: 1rem;
    color: #333;
}

.memo-form textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    resize: vertical;
    min-height: 100px;
}

.category-item {
    padding: 0.75rem;
    background: #f8f9fa;
    border-radius: 6px;
    margin-bottom: 0.5rem;
    border-left: 3px solid var(--category-color);
    cursor: pointer;
    transition: all 0.3s;
}

.category-item:hover {
    background: #f3e7ff;
    transform: translateX(5px);
}

.progress-bar {
    height: 30px;
    background: #e0e0e0;
    border-radius: 15px;
    overflow: hidden;
    margin-top: 1rem;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    transition: width 0.5s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
}

.alert-info {
    background: #e3f2fd;
    border: 1px solid #2196f3;
    color: #1565c0;
    padding: 1rem;
    border-radius: 6px;
    margin-bottom: 1rem;
}

/* Prevent text selection on UI elements */
.coding-menu,
.coding-modal,
.coding-menu *,
.coding-modal * {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

/* Allow text selection in input fields */
.coding-menu input,
.coding-menu textarea,
.coding-modal input,
.coding-modal textarea,
.text-preview {
    -webkit-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
    user-select: text;
}

/* Coding Menu */
.coding-menu {
    position: absolute;
    background: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    z-index: 10000;
    min-width: 280px;
    max-width: 350px;
    display: none;
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    backdrop-filter: blur(10px);
    animation: menuSlideIn 0.2s ease-out;
}

@keyframes menuSlideIn {
    from {
        opacity: 0;
        transform: translateY(-10px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.menu-header {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    padding: 12px 16px;
    border-bottom: 1px solid #e9ecef;
    font-size: 0.85rem;
    color: #495057;
}

.selected-text-preview {
    font-style: italic;
    font-weight: 500;
    line-height: 1.4;
    word-break: break-word;
    display: block;
}

.menu-actions {
    padding: 12px;
    display: flex;
    gap: 8px;
}

.menu-btn {
    flex: 1;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    background: white;
    cursor: pointer;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all 0.2s ease;
    font-weight: 500;
    position: relative;
    overflow: hidden;
}

.menu-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, transparent 0%, rgba(52, 152, 219, 0.1) 100%);
    opacity: 0;
    transition: opacity 0.2s ease;
}

.menu-btn:hover {
    background: #f8f9fa;
    border-color: #3498db;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(52, 152, 219, 0.15);
}

.menu-btn:hover::before {
    opacity: 1;
}

.menu-btn:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.2);
}

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

.menu-btn .icon {
    font-size: 1rem;
    filter: drop-shadow(0 1px 1px rgba(0,0,0,0.1));
}

.recent-codes {
    border-top: 1px solid #e9ecef;
    background: #fafbfc;
}

.recent-header {
    padding: 10px 16px;
    background: linear-gradient(135deg, #f1f3f4 0%, #e8eaed 100%);
    font-size: 0.8rem;
    font-weight: 600;
    color: #495057;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.recent-list {
    padding: 8px 12px 12px;
    max-height: 180px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: #cbd5e0 transparent;
}

.recent-list::-webkit-scrollbar {
    width: 4px;
}

.recent-list::-webkit-scrollbar-track {
    background: transparent;
}

.recent-list::-webkit-scrollbar-thumb {
    background: #cbd5e0;
    border-radius: 2px;
}

.recent-code-btn {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid transparent;
    background: white;
    cursor: pointer;
    border-radius: 6px;
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 4px;
    transition: all 0.2s ease;
    font-size: 0.85rem;
    position: relative;
}

.recent-code-btn:hover {
    background: #f8f9fa;
    border-color: #dee2e6;
    transform: translateX(2px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.recent-code-btn:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2);
}

.recent-code-btn:last-child {
    margin-bottom: 0;
}

.code-color {
    width: 14px;
    height: 14px;
    border-radius: 3px;
    flex-shrink: 0;
    border: 1px solid rgba(0,0,0,0.1);
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.code-name {
    text-align: left;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 500;
    flex: 1;
}

.no-recent {
    text-align: center;
    color: #6c757d;
    font-size: 0.8rem;
    padding: 16px 12px;
    font-style: italic;
    background: rgba(108, 117, 125, 0.05);
    border-radius: 4px;
    margin: 4px 0;
}

/* Coding Modal */
.coding-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10001;
    backdrop-filter: blur(4px);
    animation: overlayFadeIn 0.3s ease;
    padding: 20px;
    box-sizing: border-box;
}

@keyframes overlayFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.coding-modal {
    background: white;
    border-radius: 12px;
    max-width: 520px;
    width: 100%;
    max-height: 85vh;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-30px) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.modal-header {
    padding: 24px 24px 16px;
    border-bottom: 1px solid #e9ecef;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
    flex-shrink: 0;
}

.modal-header h3 {
    margin: 0;
    color: #2c3e50;
    font-size: 1.3rem;
    font-weight: 600;
}

.close-btn {
    background: none;
    border: none;
    font-size: 24px;
    color: #6c757d;
    cursor: pointer;
    padding: 4px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.close-btn:hover {
    background: #f8f9fa;
    color: #495057;
    transform: scale(1.1);
}

.close-btn:focus {
    outline: none;
    background: #e9ecef;
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2);
}

.modal-content {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}

.selected-text-display {
    margin-bottom: 24px;
}

.selected-text-display label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #495057;
    font-size: 0.9rem;
}

.text-preview {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 16px;
    font-style: italic;
    color: #495057;
    max-height: 120px;
    overflow-y: auto;
    white-space: pre-wrap;
    line-height: 1.5;
    font-family: Georgia, 'Times New Roman', serif;
    scrollbar-width: thin;
}

.text-preview::-webkit-scrollbar {
    width: 4px;
}

.text-preview::-webkit-scrollbar-thumb {
    background: #cbd5e0;
    border-radius: 2px;
}

.code-input-section,
.richpoint-input-section {
    margin-top: 20px;
}

.code-input-section label,
.richpoint-input-section label {
    display: block;
    margin-bottom: 8px;
    margin-top: 20px;
    font-weight: 600;
    color: #495057;
    font-size: 0.9rem;
}

.code-input-section label:first-child,
.richpoint-input-section label:first-child {
    margin-top: 0;
}

.color-input-group {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.color-presets {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.color-preset {
    width: 28px;
    height: 28px;
    border: 2px solid #fff;
    border-radius: 6px;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
    transition: all 0.2s ease;
    position: relative;
}

.color-preset:hover {
    transform: scale(1.15);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

.color-preset:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.3);
}

.color-preset::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 12px;
    height: 8px;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="white"><path d="M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z"/></svg>') no-repeat center;
    background-size: contain;
    transform: translate(-50%, -50%);
    opacity: 0;
    transition: opacity 0.2s ease;
}

.color-preset:active::after {
    opacity: 1;
}

.code-options {
    margin-top: 20px;
    padding: 16px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.code-options label {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 500;
    margin: 0;
    cursor: pointer;
    font-size: 0.9rem;
}

.code-options input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: #3498db;
}

.modal-actions {
    padding: 20px 24px;
    border-top: 1px solid #e9ecef;
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    background: #fafbfc;
    flex-shrink: 0;
}

/* Enhanced form styles */
input[type="text"],
input[type="password"],
input[type="email"],
input[type="date"],
input[type="color"],
textarea,
select {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.2s ease;
    font-family: inherit;
    background: white;
}

input[type="text"]:focus,
input[type="password"]:focus,
input[type="email"]:focus,
input[type="date"]:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
    background: #fafbfc;
}

input[type="text"]:hover,
input[type="password"]:hover,
input[type="email"]:hover,
input[type="date"]:hover,
textarea:hover,
select:hover {
    border-color: #cbd5e0;
}

input[type="color"] {
    width: 60px;
    height: 44px;
    padding: 4px;
    cursor: pointer;
    border-radius: 8px;
}

textarea {
    resize: vertical;
    min-height: 100px;
    line-height: 1.5;
}

/* Enhanced button styles */
.btn {
    display: inline-block;
    padding: 12px 20px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-family: inherit;
    background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(52, 152, 219, 0.3);
    text-decoration: none;
    text-align: center;
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    transition: left 0.5s ease;
}

.btn:hover::before {
    left: 100%;
}

.btn-primary {
    background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(52, 152, 219, 0.3);
}

.btn-primary:hover {
    background: linear-gradient(135deg, #2980b9 0%, #1f618d 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(52, 152, 219, 0.4);
    color: white;
    text-decoration: none;
}

.btn-primary:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.3);
}

.btn-secondary {
    background: linear-gradient(135deg, #6c757d 0%, #495057 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(108, 117, 125, 0.3);
}

.btn-secondary:hover {
    background: linear-gradient(135deg, #5a6268 0%, #343a40 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(108, 117, 125, 0.4);
    color: white;
    text-decoration: none;
}

.btn-secondary:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(108, 117, 125, 0.3);
}

/* Loading states */
.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

.btn:disabled::before {
    display: none;
}

/* Tables */
table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}

th, td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

th {
    background: #f8f9fa;
    font-weight: 600;
}

/* Transcript Table Actions - Compact button styling */
.transcript-table td .btn {
    padding: 0.5rem 0.75rem;
    font-size: 0.75rem;
    margin-right: 0.25rem;
    white-space: nowrap;
}

.transcript-table td .btn:last-child {
    margin-right: 0;
}

/* Transcript List - Responsive Design */
.transcript-cards {
    display: none;
}

.transcript-card {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    margin-bottom: 1rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    overflow: hidden;
}

.transcript-card .card-header {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    padding: 1rem;
    border-bottom: 1px solid #e0e0e0;
}

.transcript-card .card-title {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: #2c3e50;
}

.transcript-card .card-body {
    padding: 1rem;
}

.transcript-card .card-info {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.transcript-card .info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    border-bottom: 1px solid #f0f0f0;
}

.transcript-card .info-row:last-child {
    border-bottom: none;
}

.transcript-card .info-label {
    font-weight: 600;
    color: #666;
    font-size: 0.9rem;
}

.transcript-card .info-value {
    color: #333;
    text-align: right;
    flex: 1;
    margin-left: 1rem;
}

.transcript-card .card-actions {
    padding: 1rem;
    display: flex;
    gap: 0.5rem;
    background: #fafbfc;
    border-top: 1px solid #e0e0e0;
}

.transcript-card .card-actions .btn {
    flex: 1;
    text-align: center;
    padding: 0.75rem;
    font-size: 0.9rem;
}

/* Highlighted text styles */
.coded-segment {
    border-bottom: 2px solid;
    cursor: pointer;
    position: relative;
    transition: all 0.2s ease;
    border-radius: 2px;
    padding: 1px 2px;
    margin: 0 1px;
}

.coded-segment:hover {
    opacity: 0.8;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.rich-point-highlight {
    background-color: rgba(255, 215, 0, 0.3) !important;
    border-bottom: 3px dashed #DAA520 !important;
    cursor: pointer;
    position: relative;
    border-radius: 3px;
    padding: 2px 4px;
    margin: 0 1px;
    transition: all 0.2s ease;
    font-weight: bold;
    text-decoration: underline;
}

.rich-point-highlight:hover {
    background-color: rgba(255, 215, 0, 0.5) !important;
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(218, 165, 32, 0.3);
}

.highlight-selection {
    background-color: yellow;
}

/* Enhanced tooltips */
.coded-segment[title],
.rich-point-highlight[title] {
    position: relative;
}

.coded-segment[title]:hover::after,
.rich-point-highlight[title]:hover::after {
    content: attr(title);
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 12px;
    white-space: nowrap;
    z-index: 10003;
    pointer-events: none;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    animation: tooltipFadeIn 0.2s ease;
}

.coded-segment[title]:hover::before,
.rich-point-highlight[title]:hover::before {
    content: '';
    position: absolute;
    bottom: calc(100% + 2px);
    left: 50%;
    transform: translateX(-50%);
    border: 4px solid transparent;
    border-top-color: rgba(0, 0, 0, 0.9);
    z-index: 10003;
    pointer-events: none;
    animation: tooltipFadeIn 0.2s ease;
}

@keyframes tooltipFadeIn {
    from { opacity: 0; transform: translateX(-50%) translateY(5px); }
    to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* Enhanced notifications */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 16px 20px;
    border-radius: 8px;
    color: white;
    font-weight: 500;
    z-index: 10002;
    opacity: 0;
    transform: translateX(100%);
    transition: all 0.3s ease;
    max-width: 350px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.2);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.2);
    font-size: 0.9rem;
    line-height: 1.4;
}

.notification.show {
    opacity: 1;
    transform: translateX(0);
}

.notification-success {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
}

.notification-error,
.notification-warning {
    background: linear-gradient(135deg, #dc3545 0%, #fd7e14 100%);
}

.notification-info {
    background: linear-gradient(135deg, #17a2b8 0%, #6f42c1 100%);
}

/* Selection styling */
::selection {
    background: rgba(52, 152, 219, 0.25);
    color: inherit;
}

::-moz-selection {
    background: rgba(52, 152, 219, 0.25);
    color: inherit;
}

/* Speaker-specific background colors */
.speaker-1 {
    background-color: #fffbe6;
}
.speaker-2 {
    background-color: #e6fff2;
}
.speaker-3 {
    background-color: #e6f0ff;
}
.speaker-4 {
    background-color: #fae6ff;
}
.speaker-5 {
    background-color: #fff0e6;
}
.speaker-6 {
    background-color: #e6fffa;
}
.speaker-7 {
    background-color: #eae6ff;
}
.speaker-8 {
    background-color: #f2ffe6;
}

.speaker-name {
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

.time-range {
    color: #666;
    font-size: 0.85em;
    font-weight: normal;
    margin-left: 8px;
    font-family: 'Courier New', monospace;
    background: rgba(0, 0, 0, 0.05);
    padding: 2px 6px;
    border-radius: 3px;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

/* Transcript Editor Styles */
#transcript p[data-slug] {
    padding: 8px 12px;
    margin: 4px 0;
    border-radius: 4px;
    transition: background-color 0.2s ease;
    position: relative;
}

#transcript p[data-slug]:hover {
    background-color: #f5f5f5;
    cursor: pointer;
}

#transcript p[data-slug]:hover::after {
    content: '✎';
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #999;
    font-size: 14px;
    opacity: 0.7;
}

.slug-edit-mode {
    background-color: #e3f2fd !important;
    border: 2px solid #2196F3 !important;
    padding: 6px 10px !important;
    animation: editPulse 0.3s ease;
}

@keyframes editPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.01); }
    100% { transform: scale(1); }
}

.edit-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
}

.speaker-select {
    padding: 4px 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background-color: white;
    font-weight: 600;
    cursor: pointer;
    font-size: 14px;
    min-width: 100px;
    max-width: 180px;
    flex-shrink: 0;
}

.speaker-select:focus {
    outline: none;
    border-color: #2196F3;
    box-shadow: 0 0 0 2px rgba(33, 150, 243, 0.2);
}

.text-input {
    flex: 1 1 auto;
    min-width: 0;
    padding: 4px 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    font-family: inherit;
}

.text-input:focus {
    outline: none;
    border-color: #2196F3;
    box-shadow: 0 0 0 2px rgba(33, 150, 243, 0.2);
}

.status-indicator {
    margin-left: 8px;
    font-size: 12px;
    padding: 2px 6px;
    border-radius: 3px;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.status-saving {
    background-color: #fff3cd;
    color: #856404;
}

.status-success {
    background-color: #d4edda;
    color: #155724;
}

.status-error {
    background-color: #f8d7da;
    color: #721c24;
}

.spinner {
    display: inline-block;
    width: 12px;
    height: 12px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #2196F3;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 4px;
    vertical-align: middle;
}

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

/* Focus management for accessibility */
.coding-menu:focus-within,
.coding-modal:focus-within {
    outline: 2px solid #3498db;
    outline-offset: 2px;
}

/* Responsive design */
@media (max-width: 768px) {
    .main-grid {
        grid-template-columns: 1fr;
    }
    
    .coding-modal-overlay {
        padding: 10px;
    }
    
    .coding-modal {
        width: 100%;
        max-height: 95vh;
        border-radius: 12px;
    }
    
    .modal-header {
        padding: 20px 20px 12px;
    }
    
    .modal-content {
        padding: 20px;
    }
    
    .modal-actions {
        padding: 16px 20px;
        flex-direction: column-reverse;
    }
    
    .btn {
        width: 100%;
        margin: 0;
    }
    
    .coding-menu {
        min-width: 260px;
        max-width: calc(100vw - 20px);
    }
    
    .menu-actions {
        flex-direction: column;
    }
    
    .menu-btn {
        width: 100%;
    }
    
    .color-input-group {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    
    .color-presets {
        justify-content: flex-start;
    }
    
    .notification {
        right: 10px;
        left: 10px;
        max-width: none;
        transform: translateY(-100%);
    }
    
    .notification.show {
        transform: translateY(0);
    }

    /* Mobile Transcript List - Show cards, hide table */
    .transcript-table {
        display: none;
    }
    
    .transcript-cards {
        display: block;
    }
}

@media (max-width: 480px) {
    .modal-header h3 {
        font-size: 1.1rem;
    }
    
    .coding-menu {
        min-width: 240px;
    }
    
    .text-preview {
        padding: 12px;
        font-size: 0.9rem;
    }
    
    .color-preset {
        width: 24px;
        height: 24px;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .coding-menu,
    .coding-modal {
        border: 2px solid;
    }
    
    .menu-btn,
    .recent-code-btn,
    .btn {
        border: 2px solid;
    }
    
    .coded-segment,
    .rich-point-highlight {
        border-width: 3px;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .coding-menu {
        background: #2c3e50;
        border-color: #34495e;
        color: #ecf0f1;
    }
    
    .menu-header {
        background: linear-gradient(135deg, #34495e 0%, #2c3e50 100%);
        color: #bdc3c7;
    }
    
    .menu-btn {
        background: #34495e;
        border-color: #4a5f7a;
        color: #ecf0f1;
    }
    
    .menu-btn:hover {
        background: #4a5f7a;
        border-color: #3498db;
    }
    
    .coding-modal {
        background: #2c3e50;
        color: #ecf0f1;
    }
    
    .modal-header {
        background: linear-gradient(135deg, #34495e 0%, #2c3e50 100%);
    }
    
    .text-preview {
        background: linear-gradient(135deg, #34495e 0%, #2c3e50 100%);
        border-color: #4a5f7a;
        color: #bdc3c7;
    }
    
    input[type="text"],
    textarea {
        background: #34495e;
        border-color: #4a5f7a;
        color: #ecf0f1;
    }
    
    input[type="text"]:focus,
    textarea:focus {
        background: #4a5f7a;
        border-color: #3498db;
    }
}

/* CGT Enhancement Styles */
.cgt-reminder {
    background: #e8f4fd;
    border: 1px solid #bee5eb;
    border-radius: 4px;
    padding: 0.75rem;
    margin: 1rem 0;
    font-size: 0.9em;
}

.cgt-tooltip {
    cursor: help;
    color: #007bff;
    font-weight: bold;
}

.elevation-hint {
    font-size: 0.9em;
    margin: 0.5rem 0;
    transition: all 0.3s ease;
}

.elevation-hint:hover {
    transform: translateX(5px);
}

/* Random sort emphasis */
select option[value="random"] {
    background-color: #e8f4fd;
    font-weight: bold;
}

/* Sortable table headers */
.sortable {
    cursor: pointer;
    position: relative;
    text-decoration: none;
    color: inherit;
    display: inline-block;
    transition: all 0.2s ease;
}

.sortable:hover {
    text-decoration: underline;
    color: #3498db;
}

.sortable::after {
    content: ' ↕';
    color: #ccc;
    font-size: 0.8em;
    margin-left: 4px;
}

.sorted-asc::after {
    content: ' ↑';
    color: #333;
}

.sorted-desc::after {
    content: ' ↓';
    color: #333;
}

.sortable:focus {
    outline: 2px solid #3498db;
    outline-offset: 2px;
}

/* Enhanced table header styling */
th .sortable {
    font-weight: 600;
    width: 100%;
    display: block;
    padding: 4px 0;
}

/* Print styles */
@media print {
    /* Hide all UI elements that shouldn't be printed */
    .navbar,
    .coding-menu,
    .coding-modal-overlay,
    .notification,
    .btn,
    button,
    .messages,
    .sortable::after {
        display: none !important;
    }
    
    /* Reset container and body styles for print */
    body {
        background: white !important;
        color: black !important;
    }
    
    .container {
        max-width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
    }
    
    .content-card {
        box-shadow: none !important;
        border-radius: 0 !important;
        padding: 1rem !important;
    }
    
    /* Simplify coded segments and highlights for print */
    .coded-segment,
    .rich-point-highlight {
        background: transparent !important;
        border-bottom: 2px solid black !important;
    }
    
    /* Ensure transcript text is clean and readable */
    #transcript p {
        page-break-inside: avoid;
        margin: 0.5rem 0;
    }
    
    /* Hide speaker background colors for print */
    .speaker-1,
    .speaker-2,
    .speaker-3,
    .speaker-4,
    .speaker-5,
    .speaker-6,
    .speaker-7,
    .speaker-8 {
        background-color: transparent !important;
    }
}
