/* =================================================================
   SENTENCE REVIEW MODULE STYLES
   Bob and Mariel Ward School of Filipino Languages
   Version 1.0 - November 2025
   ================================================================= */

/* =================================================================
   TRAINING MODULE STYLES
   ================================================================= */

.module-sentence-review {
    padding: 20px;
}

.module-sentence-review h1 {
    text-align: center;
    margin-bottom: 24px;
    color: var(--text-primary);
}

.module-sentence-review h1 i {
    margin-right: 10px;
    color: var(--primary);
}

/* Controls */
.sr-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.sr-progress {
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    padding: 8px 16px;
    border-radius: 8px;
    transition: background 0.2s;
}

.sr-progress:hover {
    background: var(--bg-secondary);
}

#srSequenceTitle {
    font-weight: 600;
    font-size: 1.1rem;
    color: var(--text-primary);
}

#srSentenceCount {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* Sentence Area */
.sr-sentence-area {
    background: var(--bg-secondary);
    border-radius: 16px;
    padding: 32px;
    margin-bottom: 20px;
    min-height: 150px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.sr-picture-row {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: clamp(8px, 1.5vw, 20px);
    align-items: flex-start;
}

.sr-word-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

/* Flip Card Wrapper - fluid sizing with 2:3 aspect ratio */
.sr-card-wrapper {
    width: clamp(80px, 8vw, 140px);
    aspect-ratio: 2 / 3;
    perspective: 1000px;
    cursor: pointer;
}

.sr-card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    transition: transform 0.6s;
    transform-style: preserve-3d;
}

.sr-card-wrapper.flipped .sr-card-inner {
    transform: rotateY(180deg);
}

.sr-card-face {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    background: white;
}

.sr-card-front {
    display: flex;
    align-items: center;
    justify-content: center;
}

.sr-card-front img,
.sr-card-front video {
    width: 90%;
    height: 90%;
    object-fit: contain;
}

.sr-card-back {
    transform: rotateY(180deg);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 12px;
    background: var(--bg-primary);
    border: 2px solid var(--primary);
}

.sr-card-word {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-primary);
    text-align: center;
    margin-bottom: 8px;
}

.sr-card-word .root-hint {
    font-size: 0.9rem;
    font-weight: normal;
    color: var(--text-tertiary);
    font-style: italic;
}

.sr-card-english {
    font-size: 0.9rem;
    color: var(--text-secondary);
    text-align: center;
    font-style: italic;
}

/* Speaker Icon */
.sr-speaker-icon {
    position: absolute;
    bottom: 8px;
    right: 8px;
    width: 36px;
    height: 36px;
    background: var(--primary);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    cursor: pointer;
    box-shadow: var(--shadow-md);
    transition: all 0.2s;
    z-index: 10;
}

.sr-speaker-icon:hover {
    transform: scale(1.1);
    background: var(--primary-dark);
}

.sr-card-wrapper:hover .sr-card-face {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
}

/* Function word placeholder - smaller than picture cards */
.sr-word-placeholder {
    width: clamp(45px, 5vw, 70px);
    aspect-ratio: 1 / 1;
    border-radius: 8px;
    background: var(--bg-tertiary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: clamp(0.7rem, 1vw, 0.9rem);
    color: var(--text-secondary);
    font-weight: 600;
    border: 2px dashed var(--border-color);
}

/* =================================================================
   SENTENCE TYPE DISPLAY BANNER (Training Module)
   ================================================================= */

.sr-sentence-type-display {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 14px 28px;
    border-radius: 12px;
    margin-left: auto;
    margin-right: auto;
    margin-bottom: 20px;
    font-size: 1.4rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.sr-sentence-type-display i {
    font-size: 1.3rem;
}

/* Question - Gold/Amber */
.sr-sentence-type-display.type-question {
    background: linear-gradient(135deg, #eab308 0%, #ca8a04 100%);
    color: white;
}

/* Statement - Green */
.sr-sentence-type-display.type-statement {
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
    color: white;
}

/* Command - Orange */
.sr-sentence-type-display.type-command {
    background: linear-gradient(135deg, #f97316 0%, #ea580c 100%);
    color: white;
}

/* Answer - Blue */
.sr-sentence-type-display.type-answer {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white;
}

/* =================================================================
   BUBBLE DISPLAY (Training Module - Read Only)
   Word bubbles with connection lines from picture cards
   ================================================================= */

.sr-bubble-display {
    position: relative;
    background: var(--bg-secondary);
    border-radius: 16px;
    padding: 24px 32px;
    margin-bottom: 20px;
    min-height: 80px;
}

/* SVG for connection lines - positioned relative to bubble display */
.sr-bubble-display .sr-connection-lines {
    position: absolute;
    top: -200px;  /* Extend up to reach the cards above */
    left: 0;
    width: 100%;
    height: calc(100% + 200px);
    pointer-events: none;
    z-index: 1;
}

.sr-bubble-display .sr-connection-line {
    stroke: var(--primary);
    stroke-width: 2;
    stroke-opacity: 0.5;
    stroke-linecap: round;
}

.sr-bubble-display .sr-connection-line.function-word-line {
    stroke: var(--text-secondary);
    stroke-dasharray: 4 4;
    stroke-opacity: 0.4;
}

/* Bubbles Row Container */
.sr-display-bubbles-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
    align-items: flex-start;
    position: relative;
    z-index: 2;
    margin-bottom: 20px;
}

/* Bubble Group - keeps multi-word phrases together */
.sr-bubble-group {
    display: flex;
    gap: 6px;
    align-items: flex-start;
}

.sr-bubble-group.function-word-group {
    /* Function word groups may have slightly different spacing */
}

/* Individual Display Bubble (read-only) */
.sr-display-bubble {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: var(--bg-primary);
    border: 2px solid var(--primary);
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

.sr-display-bubble:hover {
    background: var(--primary-light);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.25);
    transform: translateY(-2px);
}

.sr-display-bubble.function-word {
    background: var(--bg-tertiary);
    border-style: dashed;
    border-color: var(--border-color);
}

.sr-display-bubble.function-word:hover {
    border-color: var(--text-secondary);
    background: var(--bg-secondary);
}

.sr-display-bubble .sr-bubble-text {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.sr-display-bubble .sr-bubble-speaker {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    background: var(--primary);
    color: white;
    border-radius: 50%;
    font-size: 10px;
    transition: all 0.2s;
}

.sr-display-bubble:hover .sr-bubble-speaker {
    background: var(--primary-dark, #4a47a3);
    transform: scale(1.1);
}

/* English Translation */
.sr-english-translation {
    text-align: center;
    font-size: 1.2rem;
    font-style: italic;
    color: var(--text-secondary);
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
    position: relative;
    z-index: 2;
}

/* English Hint */
.sr-english-hint {
    text-align: center;
    font-size: 1.1rem;
    color: var(--text-secondary);
    font-style: italic;
    margin-bottom: 24px;
    min-height: 1.5em;
}

/* Reveal Section */
.sr-reveal-section {
    display: flex;
    justify-content: center;
    gap: 16px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.sr-revealed-text {
    background: var(--primary-light);
    border-radius: 12px;
    padding: 20px 32px;
    text-align: center;
    margin-bottom: 24px;
    border: 2px solid var(--primary);
}

.sr-sentence-text {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
}

/* Sequence Selector */
.sr-sequence-selector {
    background: var(--bg-secondary);
    border-radius: 12px;
    padding: 20px;
    margin-top: 24px;
}

.sr-sequence-selector h3 {
    margin-bottom: 16px;
    color: var(--text-primary);
}

.sr-sequence-list {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.sr-sequence-btn {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    padding: 12px 16px;
    background: var(--bg-primary);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    min-width: 150px;
}

.sr-sequence-btn:hover {
    border-color: var(--primary);
    background: var(--primary-light);
}

.sr-sequence-btn.active {
    border-color: var(--primary);
    background: var(--primary);
    color: white;
}

.sr-sequence-btn .sequence-num {
    font-size: 1.5rem;
    font-weight: 700;
}

.sr-sequence-btn .sequence-title {
    font-weight: 500;
}

.sr-sequence-btn .sequence-count {
    font-size: 0.8rem;
    opacity: 0.7;
}

/* =================================================================
   DECK BUILDER ADDON STYLES
   ================================================================= */

/* Import Section */
.sr-builder-import {
    margin-bottom: 24px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--border-color);
}

.sr-builder-import h4 {
    margin-bottom: 12px;
    color: var(--text-primary);
}

.sr-builder-import h4 i {
    margin-right: 8px;
    color: var(--primary);
}

.sr-import-textarea {
    width: 100%;
    min-height: 200px;
    padding: 12px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-family: monospace;
    font-size: 0.9rem;
    resize: vertical;
    background: var(--bg-primary);
    color: var(--text-primary);
    margin-bottom: 12px;
}

.sr-import-textarea:focus {
    border-color: var(--primary);
    outline: none;
}

.sr-import-actions {
    display: flex;
    gap: 12px;
    align-items: center;
}

.sr-import-actions .select-control {
    min-width: 200px;
}

/* Import Tabs */
.sr-import-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 16px;
    border-bottom: 2px solid var(--border-color);
}

.sr-import-tab {
    padding: 10px 20px;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-secondary);
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
}

.sr-import-tab:hover {
    color: var(--text-primary);
    background: var(--bg-secondary);
}

.sr-import-tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.sr-import-tab i {
    font-size: 1rem;
}

.sr-import-tab-content {
    display: none;
}

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

/* CSV Upload Section */
.sr-csv-description {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 16px;
}

.sr-csv-upload-area {
    border: 2px dashed var(--border-color);
    border-radius: 12px;
    padding: 40px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    background: var(--bg-primary);
    margin-bottom: 16px;
}

.sr-csv-upload-area:hover {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.05);
}

.sr-csv-upload-area.dragover {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.1);
    border-style: solid;
}

.sr-csv-upload-area i {
    font-size: 2.5rem;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.sr-csv-upload-area p {
    color: var(--text-secondary);
    margin: 0;
}

.sr-csv-upload-area.hidden {
    display: none;
}

.sr-csv-file-input {
    display: none;
}

.sr-csv-file-info {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--success-light, rgba(34, 197, 94, 0.1));
    border: 1px solid var(--success);
    border-radius: 8px;
    margin-bottom: 16px;
}

.sr-csv-file-info.hidden {
    display: none;
}

.sr-csv-file-info i {
    color: var(--success);
    font-size: 1.25rem;
}

.sr-csv-file-info span {
    flex: 1;
    font-weight: 500;
    color: var(--text-primary);
}

.sr-csv-remove-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.2s;
}

.sr-csv-remove-btn:hover {
    color: var(--error);
    background: rgba(239, 68, 68, 0.1);
}

/* CSV Preview Summary */
.sr-csv-preview-summary {
    display: flex;
    gap: 24px;
    padding: 16px;
    background: var(--bg-primary);
    border-radius: 8px;
    margin-bottom: 16px;
}

.sr-csv-preview-summary .summary-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
    color: var(--text-primary);
}

.sr-csv-preview-summary .summary-item i {
    color: var(--primary);
}

/* Preview Lesson Header (for multi-lesson CSV imports) */
.sr-preview-lesson {
    margin-bottom: 16px;
}

.sr-preview-lesson-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--primary);
    color: white;
    border-radius: 8px 8px 0 0;
    font-weight: 600;
}

.sr-preview-lesson-header i {
    font-size: 1.1rem;
}

.sr-preview-lesson-header .sequence-count {
    margin-left: auto;
    font-weight: normal;
    font-size: 0.9rem;
    opacity: 0.9;
}

/* Sentence Type Badges */
.sr-sentence-type-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-left: 8px;
}

.sr-sentence-type-badge.type-statement {
    background: rgba(99, 102, 241, 0.15);
    color: var(--primary);
}

.sr-sentence-type-badge.type-question {
    background: rgba(234, 179, 8, 0.15);
    color: #b45309;
}

.sr-sentence-type-badge.type-answer {
    background: rgba(34, 197, 94, 0.15);
    color: #15803d;
}

.sr-sentence-type-badge.type-command {
    background: rgba(239, 68, 68, 0.15);
    color: #dc2626;
}

/* Preview Section */
.sr-builder-preview {
    background: var(--bg-secondary);
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 24px;
    display: flex;
    flex-direction: column;
    max-height: 70vh;
}

.sr-builder-preview h4 {
    margin-bottom: 12px;
    color: var(--text-primary);
    flex-shrink: 0;
}

.sr-builder-preview h4 i {
    margin-right: 8px;
    color: var(--warning);
}

/* Scrollable preview content */
#srPreviewContent {
    flex: 1;
    overflow-y: auto;
    padding-right: 8px;
    margin-bottom: 16px;
    min-height: 200px;
    max-height: calc(70vh - 120px);
}

/* Custom scrollbar for preview */
#srPreviewContent::-webkit-scrollbar {
    width: 8px;
}

#srPreviewContent::-webkit-scrollbar-track {
    background: var(--bg-tertiary);
    border-radius: 4px;
}

#srPreviewContent::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

#srPreviewContent::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

.preview-summary {
    font-weight: 500;
    margin-bottom: 16px;
    color: var(--success);
}

.sr-preview-sequence {
    background: var(--bg-primary);
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 12px;
}

.sr-preview-seq-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 12px;
}

.sr-preview-seq-header .sentence-count {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.sr-preview-sentence {
    padding: 8px;
    background: var(--bg-secondary);
    border-radius: 6px;
    margin-bottom: 8px;
}

.sr-preview-sent-text {
    font-weight: 500;
    color: var(--text-primary);
}

.sr-preview-sent-english {
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-style: italic;
    margin-bottom: 8px;
}

.sr-preview-words {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 8px;
}

.sr-preview-word {
    width: 40px;
    height: 40px;
    border-radius: 6px;
    overflow: hidden;
    background: var(--bg-primary);
}

.sr-preview-word.has-pic img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.sr-preview-word.no-pic {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.65rem;
    color: var(--text-secondary);
    border: 1px dashed var(--warning);
    background: var(--warning-light, #fff8e1);
}

.sr-preview-stats {
    display: flex;
    gap: 12px;
    font-size: 0.8rem;
}

.sr-preview-stats .stat-good {
    color: var(--success);
}

.sr-preview-stats .stat-warn {
    color: var(--warning);
}

.sr-preview-stats .stat-resolution {
    color: var(--danger, #e53935);
    font-weight: 500;
}

/* Needs Resolution Flag */
.sr-preview-word.needs-resolution,
.sr-word-pic.needs-resolution {
    box-shadow: 0 0 0 3px var(--warning);
    position: relative;
}

.sr-preview-word .resolution-flag,
.sr-word-pic .resolution-flag {
    position: absolute;
    top: -4px;
    right: -4px;
    font-size: 0.7rem;
    background: var(--warning);
    border-radius: 50%;
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    cursor: help;
}

.sr-preview-actions {
    display: flex;
    gap: 12px;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 2px solid var(--border-color);
    background: var(--bg-secondary);
    flex-shrink: 0;
    position: sticky;
    bottom: 0;
}

/* Lessons List */
.sr-builder-lessons h4 {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.sr-builder-lessons h4 i {
    color: var(--primary);
}

.sr-lessons-list {
    max-height: 600px;
    overflow-y: auto;
}

.sr-empty-state {
    text-align: center;
    padding: 32px;
    color: var(--text-secondary);
}

.sr-empty-state i {
    font-size: 2rem;
    margin-bottom: 12px;
}

/* Lesson Item */
.sr-lesson-item {
    background: var(--bg-secondary);
    border-radius: 8px;
    margin-bottom: 8px;
    overflow: hidden;
}

.sr-lesson-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    cursor: pointer;
    transition: background 0.2s;
}

.sr-lesson-header:hover {
    background: var(--bg-tertiary);
}

.sr-lesson-header .expand-icon {
    color: var(--primary);
}

.sr-lesson-header .lesson-title {
    font-weight: 600;
    flex: 1;
}

.sr-lesson-header .sequence-count {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.sr-lesson-header .edited-badge {
    background: var(--warning);
    color: white;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
}

.sr-lesson-content {
    padding: 0 16px 16px;
}

/* Sequence Item */
.sr-sequences-list {
    padding-left: 16px;
}

.sr-sequence-item {
    background: var(--bg-primary);
    border-radius: 6px;
    margin-bottom: 6px;
    border: 1px solid var(--border-color);
}

.sr-sequence-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    cursor: pointer;
}

.sr-sequence-header:hover {
    background: var(--bg-secondary);
}

.sr-sequence-header .expand-icon {
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.sr-sequence-header .sequence-title {
    flex: 1;
    font-weight: 500;
}

.sr-sequence-header .sentence-count {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.sr-sequence-content {
    padding: 0 12px 12px;
}

/* Sentence Item */
.sr-sentences-list {
    padding-left: 12px;
}

.sr-sentence-item {
    padding: 8px;
    margin-bottom: 6px;
    background: var(--bg-secondary);
    border-radius: 4px;
}

.sr-sentence-header {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.sr-sentence-header .sentence-num {
    font-weight: 600;
    color: var(--primary);
}

.sr-sentence-header .sentence-text {
    font-weight: 500;
}

.sr-sentence-header .sentence-english {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-style: italic;
}

/* Word Pictures Row (legacy) */
.sr-sentence-pictures {
    margin-top: 8px;
}

.sr-word-pictures-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

/* =================================================================
   NEW BUBBLE LAYOUT FOR DECK BUILDER SENTENCE REVIEW EDITOR
   Word bubbles on top -> Connection lines -> Deduplicated pictures
   ================================================================= */

.sr-bubble-layout {
    display: flex;
    flex-direction: column;
    width: 100%;
    position: relative;
    gap: 12px;
    padding: 12px;
    background: var(--bg-secondary);
    border-radius: 8px;
    margin-top: 8px;
}

/* Bubbles Row */
.sr-bubbles-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: flex-end;
    min-height: 40px;
}

/* Individual Word Bubble */
.sr-word-bubble {
    position: relative;
    min-width: 50px;
    max-width: 150px;
    padding: 6px 12px;
    background: var(--bg-primary);
    border: 2px solid var(--primary);
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
}

.sr-word-bubble:hover {
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.25);
    border-color: var(--primary-dark, #4a47a3);
}

.sr-word-bubble.function-word {
    background: var(--bg-tertiary);
    border-style: dashed;
    border-color: var(--border-color);
}

.sr-word-bubble.function-word:hover {
    border-color: var(--text-secondary);
}

.sr-word-bubble.needs-resolution {
    border-color: var(--warning, #f59e0b);
    box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.2);
}

/* Bubble Text */
.sr-bubble-text {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    word-break: break-word;
    line-height: 1.3;
    padding-right: 4px;
}

/* Root hint (shown in bubble text) */
.sr-root-hint {
    font-size: 0.7rem;
    font-weight: 400;
    color: var(--text-secondary);
    font-style: italic;
}

/* Bubble Warning Icon */
.sr-bubble-warning {
    position: absolute;
    top: -6px;
    right: -6px;
    font-size: 12px;
}

/* Bubble Action Buttons */
.sr-bubble-actions {
    position: absolute;
    top: -10px;
    right: -10px;
    display: flex;
    gap: 2px;
    opacity: 0;
    transition: opacity 0.2s;
    z-index: 10;
}

.sr-word-bubble:hover .sr-bubble-actions {
    opacity: 1;
}

.sr-bubble-actions button {
    width: 20px;
    height: 20px;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 9px;
    transition: all 0.15s;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.sr-bubble-edit-btn {
    background: var(--primary);
    color: white;
}

.sr-bubble-edit-btn:hover {
    background: var(--primary-dark, #4a47a3);
    transform: scale(1.1);
}

.sr-bubble-link-btn {
    background: var(--success, #22c55e);
    color: white;
}

.sr-bubble-link-btn:hover {
    background: #16a34a;
    transform: scale(1.1);
}

.sr-bubble-delete-btn {
    background: var(--error, #e53935);
    color: white;
}

.sr-bubble-delete-btn:hover {
    background: #c62828;
    transform: scale(1.1);
}

/* Bubble Drag Handle */
.sr-word-bubble .sr-drag-handle {
    position: absolute;
    left: -8px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 3px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 8px;
    color: var(--text-tertiary);
    opacity: 0;
    transition: opacity 0.2s;
    cursor: grab;
}

.sr-word-bubble:hover .sr-drag-handle {
    opacity: 1;
}

.sr-word-bubble .sr-drag-handle:active {
    cursor: grabbing;
}

/* Sortable States for Bubbles */
.sr-word-bubble.sortable-ghost {
    opacity: 0.4;
}

.sr-word-bubble.sortable-chosen {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    transform: scale(1.05);
}

/* Connection Lines SVG */
.sr-connection-lines {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

.sr-connection-line {
    stroke: var(--primary);
    stroke-width: 2;
    stroke-opacity: 0.4;
    stroke-linecap: round;
}

/* Pictures Row */
.sr-pictures-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: flex-start;
    min-height: 60px;
    position: relative;
    z-index: 2;
}

/* Picture Slot */
.sr-picture-slot {
    position: relative;
    width: 50px;
    height: 65px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sr-picture-slot.no-picture {
    width: 30px;
    height: 30px;
}

/* Picture Card */
.sr-slot-card {
    width: 100%;
    height: 100%;
    border-radius: 6px;
    overflow: hidden;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
    background: white;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.sr-slot-card:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

.sr-slot-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Multi-link Badge */
.sr-multi-link-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    width: 18px;
    height: 18px;
    background: var(--primary);
    color: white;
    border-radius: 50%;
    font-size: 10px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

/* No Picture Dot */
.sr-no-picture-dot {
    width: 6px;
    height: 6px;
    background: var(--border-color);
    border-radius: 50%;
    opacity: 0.5;
}

/* Add Word Button in Bubble Row */
.sr-bubbles-row .sr-add-word-btn {
    width: 32px;
    height: 32px;
    border: 2px dashed var(--primary);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--primary);
    font-size: 14px;
    transition: all 0.2s;
    background: transparent;
}

.sr-bubbles-row .sr-add-word-btn:hover {
    background: var(--primary-light, rgba(79, 70, 229, 0.1));
    transform: scale(1.1);
}

/* =================================================================
   PICTURE LINK MODAL
   ================================================================= */

.sr-picture-link-modal .modal-content {
    max-width: 600px;
    max-height: 85vh;
}

.sr-picture-link-modal .modal-body {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* Current Link Section */
.sr-current-link {
    background: var(--bg-secondary);
    padding: 12px;
    border-radius: 8px;
    border-left: 4px solid var(--primary);
}

.sr-current-link h4 {
    margin: 0 0 8px 0;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.sr-current-picture {
    display: flex;
    align-items: center;
    gap: 12px;
}

.sr-current-picture img {
    width: 50px;
    height: 65px;
    object-fit: cover;
    border-radius: 6px;
    border: 2px solid var(--primary);
}

.sr-current-picture span {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* Quick Link Section */
.sr-quick-link-section {
    background: var(--bg-secondary);
    padding: 12px;
    border-radius: 8px;
    border-left: 4px solid var(--warning, #f59e0b);
}

.sr-quick-link-section h4 {
    margin: 0 0 12px 0;
    font-size: 0.9rem;
    color: var(--text-primary);
}

.sr-quick-link-section h4 i {
    color: var(--warning, #f59e0b);
    margin-right: 6px;
}

.sr-quick-link-options {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.sr-quick-link-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: var(--bg-primary);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.sr-quick-link-option:hover {
    border-color: var(--primary);
    background: var(--primary-light, rgba(79, 70, 229, 0.05));
}

.sr-quick-link-option img {
    width: 40px;
    height: 52px;
    object-fit: cover;
    border-radius: 4px;
}

.sr-quick-link-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.sr-quick-link-word {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
}

.sr-quick-link-card {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

/* Search Section */
.sr-search-section h4 {
    margin: 0 0 12px 0;
    font-size: 0.9rem;
    color: var(--text-primary);
}

.sr-search-section h4 i {
    margin-right: 6px;
}

/* Remove Link Section */
.sr-remove-link-section {
    padding-top: 8px;
    border-top: 1px solid var(--border-color);
}

.sr-remove-link-section .btn-outline-danger {
    width: 100%;
    padding: 10px;
    border: 2px solid var(--error, #e53935);
    background: transparent;
    color: var(--error, #e53935);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.sr-remove-link-section .btn-outline-danger:hover {
    background: var(--error, #e53935);
    color: white;
}

.sr-remove-link-section .btn-outline-danger.hidden {
    display: none;
}

/* =================================================================
   LEGACY WORD PIC STYLES (kept for compatibility)
   ================================================================= */

.sr-word-pic {
    position: relative;
    width: 50px;
    height: 50px;
    border-radius: 6px;
    overflow: hidden;
    background: var(--bg-primary);
}

.sr-word-pic img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.sr-word-pic .word-label {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    font-size: 0.6rem;
    padding: 2px;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sr-word-pic.no-pic {
    border: 2px dashed var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
}

.sr-word-pic.no-pic .word-text {
    font-size: 0.65rem;
    color: var(--text-secondary);
    text-align: center;
    padding: 2px;
}

.sr-word-pic .sr-change-pic-btn,
.sr-word-pic .sr-assign-pic-btn {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.6rem;
    opacity: 0;
    transition: opacity 0.2s;
}

.sr-word-pic:hover .sr-change-pic-btn,
.sr-word-pic:hover .sr-assign-pic-btn {
    opacity: 1;
}

/* Drag handle for word pictures in deck builder */
.sr-word-pic .sr-drag-handle {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 16px;
    height: 16px;
    background: rgba(0, 0, 0, 0.5);
    color: white;
    border-radius: 3px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.55rem;
    opacity: 0;
    transition: opacity 0.2s;
    cursor: grab;
    z-index: 5;
}

.sr-word-pic:hover .sr-drag-handle {
    opacity: 1;
}

.sr-word-pic .sr-drag-handle:active {
    cursor: grabbing;
}

/* Delete word button in deck builder */
.sr-word-pic .sr-delete-word-btn {
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--error, #e53935);
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.5rem;
    opacity: 0;
    transition: opacity 0.2s;
    z-index: 5;
}

.sr-word-pic:hover .sr-delete-word-btn {
    opacity: 1;
}

.sr-word-pic .sr-delete-word-btn:hover {
    background: #c62828;
    transform: scale(1.1);
}

/* Add word button in deck builder */
.sr-add-word-btn {
    width: 50px;
    height: 50px;
    border: 2px dashed var(--primary);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--primary);
    font-size: 1.2rem;
    transition: all 0.2s;
    background: transparent;
}

.sr-add-word-btn:hover {
    background: var(--primary-light, rgba(79, 70, 229, 0.1));
    transform: scale(1.05);
}

/* Sortable ghost/chosen states for word pictures */
.sr-word-pic.sortable-ghost {
    opacity: 0.4;
}

.sr-word-pic.sortable-chosen {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    transform: scale(1.05);
}

/* Add word modal tabs */
.sr-add-word-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 12px;
}

.sr-add-word-tab {
    flex: 1;
    padding: 10px 16px;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-secondary);
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.sr-add-word-tab:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.sr-add-word-tab.active {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

.sr-add-word-content {
    padding: 12px 0;
}

.sr-add-word-content p {
    margin-bottom: 12px;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.sr-add-word-content .hint-text {
    text-align: center;
    color: var(--text-tertiary);
    padding: 20px;
}

/* Add buttons */
.sr-add-sequence,
.sr-add-sentence {
    margin-top: 8px;
}

/* Picture Selector Modal */
.sr-picture-modal .modal-content {
    max-width: 700px;
    max-height: 80vh;
}

.sr-search-bar {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

.sr-search-bar input {
    flex: 1;
    padding: 8px 12px;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-primary);
    color: var(--text-primary);
}

.sr-pic-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 12px;
    max-height: 400px;
    overflow-y: auto;
    padding: 4px;
}

.sr-pic-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 8px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.sr-pic-option:hover {
    border-color: var(--primary);
    background: var(--primary-light);
}

.sr-pic-option img {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 4px;
    margin-bottom: 4px;
}

.sr-pic-option .no-image {
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-secondary);
    border-radius: 4px;
    font-size: 0.7rem;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.sr-pic-option .card-word {
    font-weight: 500;
    font-size: 0.8rem;
    text-align: center;
}

.sr-pic-option .card-english {
    font-size: 0.7rem;
    color: var(--text-secondary);
    text-align: center;
}

.sr-pic-grid .no-results {
    grid-column: 1 / -1;
    text-align: center;
    color: var(--text-secondary);
    padding: 20px;
}

/* Responsive - fluid sizing handles most card dimensions */
@media (max-width: 768px) {
    .sr-controls {
        flex-direction: column;
    }

    .sr-sentence-area {
        padding: 16px;
    }

    /* Fluid sizing with clamp() handles card dimensions */

    .sr-speaker-icon {
        width: clamp(24px, 3vw, 36px);
        height: clamp(24px, 3vw, 36px);
        font-size: clamp(10px, 1.5vw, 16px);
    }

    .sr-card-word {
        font-size: clamp(0.8rem, 1.2vw, 1.2rem);
    }

    .sr-card-english {
        font-size: clamp(0.65rem, 1vw, 0.9rem);
    }

    /* Fluid sizing handles placeholder dimensions */

    .sr-reveal-section {
        flex-direction: column;
    }

    .sr-reveal-section .btn {
        width: 100%;
    }

    .sr-import-actions {
        flex-direction: column;
    }

    .sr-import-actions .select-control {
        width: 100%;
    }
}
