/* ==================== Review Modal V2 Styles ==================== */

:root {
    --modal-bg: #ffffff;
    --modal-overlay: rgba(0, 0, 0, 0.6);
    --primary-blue: #2196F3;
    --success-green: #4CAF50;
    --warning-orange: #FF9800;
    --danger-red: #F44336;
    --text-dark: #333333;
    --text-muted: #666666;
    --border-color: #e0e0e0;
    --hover-bg: #f5f5f5;
    --shadow-sm: 0 2px 4px rgba(0,0,0,0.1);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.15);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.2);
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --transition: 0.25s ease;
}

/* Modal Container */
.review-modal-v2 {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
    display: none;
}

.review-modal-v2.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--modal-overlay);
    backdrop-filter: blur(4px);
}

.modal-container {
    position: relative;
    background: var(--modal-bg);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    max-width: 900px;
    width: 90%;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    animation: modalSlideIn 0.3s ease;
}

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

/* Header */
.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.modal-header h2 {
    margin: 0;
    font-size: 24px;
    font-weight: 600;
}

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

.btn-icon {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-icon:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.05);
}

.btn-icon:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Live Score */
.live-score {
    padding: 16px 24px;
    background: linear-gradient(135deg, #e3f2fd 0%, #f3e5f5 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    font-size: 20px;
    font-weight: 600;
    border-bottom: 1px solid var(--border-color);
    transition: all var(--transition);
}

.score-label {
    color: var(--text-muted);
    font-size: 18px;
}

.score-value {
    font-size: 28px;
    color: var(--primary-blue);
}

.score-emoji {
    font-size: 24px;
}

.live-score.excellent {
    background: linear-gradient(135deg, #e8f5e9 0%, #c8e6c9 100%);
}

.live-score.excellent .score-value {
    color: var(--success-green);
}

.live-score.good {
    background: linear-gradient(135deg, #fff3e0 0%, #ffe0b2 100%);
}

.live-score.good .score-value {
    color: var(--warning-orange);
}

.live-score.needs-work {
    background: linear-gradient(135deg, #ffebee 0%, #ffcdd2 100%);
}

.live-score.needs-work .score-value {
    color: var(--danger-red);
}

/* Sentences Container */
.sentences-container {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    background: #fafafa;
}

.sentence-box {
    margin-bottom: 16px;
}

.sentence-box:last-child {
    margin-bottom: 0;
}

.sentence-box label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-dark);
    font-size: 14px;
}

.sentence-box p {
    margin: 0;
    padding: 12px 16px;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 16px;
    line-height: 1.6;
}

/* Word Chips */
.word-chips-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 12px 16px;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    min-height: 50px;
}

.word-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
    border-radius: 16px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
    border: 2px solid transparent;
    position: relative;
}

.word-chip-interactive {
    cursor: pointer;
}

.word-chip-interactive:hover {
    transform: translateY(-2px) scale(1.05);
    box-shadow: var(--shadow-md);
}

.word-chip-interactive:active {
    transform: translateY(0) scale(0.98);
}

.word-chip-icon {
    font-size: 10px;
    opacity: 0;
    transition: opacity var(--transition);
}

.word-chip:hover .word-chip-icon {
    opacity: 1;
}

.word-chip.verified {
    background: #e8f5e9;
    color: #2e7d32;
    border-color: #81c784;
}

.word-chip.needs-review {
    background: #fff3e0;
    color: #e65100;
    border-color: #ffb74d;
}

.word-chip.urgent {
    background: #ffebee;
    color: #c62828;
    border-color: #e57373;
    animation: pulse 2s infinite;
}

.word-chip.modified {
    background: #e3f2fd;
    color: #1565c0;
    border-color: #64b5f6;
}

.word-chip.selected {
    border-color: var(--primary-blue);
    box-shadow: 0 0 0 3px rgba(33, 150, 243, 0.2);
    transform: scale(1.05);
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
}

/* Review Sections */
.review-sections {
    flex: 1;
    overflow-y: auto;
    padding: 20px 24px;
}

.review-section {
    margin-bottom: 20px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: white;
    overflow: hidden;
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: var(--hover-bg);
    cursor: pointer;
    transition: background var(--transition);
}

.section-header:hover {
    background: #e8e8e8;
}

.section-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.toggle-icon {
    transition: transform var(--transition);
}

.review-section.expanded .toggle-icon {
    transform: rotate(180deg);
}

.section-content {
    padding: 16px 20px;
}

/* Word Editor */
.word-editor {
    padding: 16px;
    margin-bottom: 16px;
    background: #fafafa;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    transition: all var(--transition);
}

.word-editor:hover {
    border-color: var(--primary-blue);
    box-shadow: var(--shadow-sm);
}

.word-editor:last-child {
    margin-bottom: 0;
}

.word-editor-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.word-label {
    font-weight: 600;
    color: var(--text-dark);
    font-size: 14px;
}

.confidence-badge {
    background: var(--primary-blue);
    color: white;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.word-editor-body {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.input-group label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.current-value {
    padding: 10px 12px;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 14px;
    color: var(--text-dark);
}

.current-value.verified {
    background: #e8f5e9;
    border-color: #81c784;
    color: #2e7d32;
    font-weight: 600;
}

.word-input {
    padding: 10px 12px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 14px;
    transition: all var(--transition);
    font-family: inherit;
}

.word-input:focus {
    outline: none;
    border-color: var(--primary-blue);
    box-shadow: 0 0 0 3px rgba(33, 150, 243, 0.1);
}

.word-actions {
    grid-column: 1 / -1;
    display: flex;
    gap: 8px;
    margin-top: 8px;
}

.btn-verify {
    flex: 1;
    padding: 10px 16px;
    border: 2px solid var(--success-green);
    background: white;
    color: var(--success-green);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-weight: 600;
    transition: all var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.btn-verify:hover {
    background: var(--success-green);
    color: white;
}

.btn-verify.active {
    background: var(--success-green);
    color: white;
}

.btn-clear {
    padding: 10px 16px;
    border: 2px solid var(--danger-red);
    background: white;
    color: var(--danger-red);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-weight: 600;
    transition: all var(--transition);
    display: flex;
    align-items: center;
    gap: 6px;
}

.btn-clear:hover {
    background: var(--danger-red);
    color: white;
}

/* Suggestions */
.suggestions-container {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
}

.btn-load-suggestions {
    background: none;
    border: none;
    color: var(--primary-blue);
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    padding: 8px 0;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: color var(--transition);
}

.btn-load-suggestions:hover {
    color: #1565c0;
}

.suggestions-list {
    margin-top: 12px;
}

.suggestion-group {
    margin-bottom: 12px;
}

.suggestion-group:last-child {
    margin-bottom: 0;
}

.suggestion-group label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.suggestion-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 10px 12px;
    margin-bottom: 6px;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition);
    text-align: left;
}

.suggestion-item:hover {
    border-color: var(--primary-blue);
    background: #f0f8ff;
    transform: translateX(4px);
}

.suggestion-meta {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 600;
}

/* Verified List */
.verified-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 12px;
}

.verified-item {
    padding: 12px;
    background: #e8f5e9;
    border: 1px solid #81c784;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    cursor: pointer;
    transition: all var(--transition);
}

.verified-item:hover {
    background: #c8e6c9;
    border-color: #66bb6a;
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.verified-item .edit-hint {
    opacity: 0;
    color: #2e7d32;
    font-size: 12px;
    transition: opacity var(--transition);
}

.verified-item:hover .edit-hint {
    opacity: 0.7;
}

.word-pair {
    font-weight: 600;
    color: #2e7d32;
    font-size: 14px;
}

.confidence {
    font-size: 12px;
    color: #2e7d32;
    background: rgba(46, 125, 50, 0.1);
    padding: 2px 6px;
    border-radius: 8px;
}

/* Verified Editor (inline editing) */
.verified-editor {
    grid-column: 1 / -1;
    padding: 16px;
    background: #fff8e1;
    border: 2px solid #ffb74d;
    border-radius: var(--radius-md);
    animation: editorSlideIn 0.2s ease;
}

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

.verified-editor-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.verified-editor-header .word-label {
    font-size: 16px;
    color: #e65100;
}

.btn-cancel-edit {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    transition: all var(--transition);
}

.btn-cancel-edit:hover {
    background: rgba(0, 0, 0, 0.1);
    color: var(--danger-red);
}

.verified-editor-body {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.verified-editor-body .input-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.verified-editor-body .input-row label {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-muted);
    min-width: 40px;
}

.verified-edit-input {
    flex: 1;
    padding: 10px 12px;
    border: 2px solid #ffb74d;
    border-radius: var(--radius-sm);
    font-size: 14px;
    transition: all var(--transition);
    font-family: inherit;
}

.verified-edit-input:focus {
    outline: none;
    border-color: #ff9800;
    box-shadow: 0 0 0 3px rgba(255, 152, 0, 0.2);
}

.verified-editor-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

.btn-save-edit {
    padding: 8px 16px;
    background: var(--success-green);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all var(--transition);
}

.btn-save-edit:hover {
    background: #43a047;
    transform: translateY(-1px);
}

.btn-unverify {
    padding: 8px 16px;
    background: white;
    color: var(--warning-orange);
    border: 2px solid var(--warning-orange);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all var(--transition);
}

.btn-unverify:hover {
    background: var(--warning-orange);
    color: white;
}

/* Word chip editing state */
.word-chip.editing {
    border-color: #ff9800;
    box-shadow: 0 0 0 3px rgba(255, 152, 0, 0.3);
    animation: none;
}

/* Stats Footer */
.stats-footer {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px;
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
    background: #fafafa;
}

.stat {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: var(--text-dark);
}

.stat i {
    color: var(--primary-blue);
    font-size: 16px;
}

/* Modal Actions */
.modal-actions {
    display: flex;
    gap: 12px;
    padding: 20px 24px;
    border-top: 1px solid var(--border-color);
    background: white;
}

.btn-primary,
.btn-secondary {
    flex: 1;
    padding: 12px 24px;
    border: none;
    border-radius: var(--radius-md);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn-secondary {
    background: white;
    color: var(--text-dark);
    border: 2px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--hover-bg);
    border-color: var(--text-muted);
}

.btn-link {
    background: none;
    border: none;
    color: var(--primary-blue);
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    padding: 0;
    transition: color var(--transition);
}

.btn-link:hover {
    color: #1565c0;
    text-decoration: underline;
}

/* Responsive Design */
@media (max-width: 768px) {
    .modal-container {
        width: 95%;
        max-height: 95vh;
    }

    .word-editor-body {
        grid-template-columns: 1fr;
    }

    .verified-list {
        grid-template-columns: 1fr;
    }

    .stats-footer {
        grid-template-columns: repeat(2, 1fr);
    }

    .modal-actions {
        flex-direction: column;
    }

    .word-chip {
        font-size: 12px;
        padding: 4px 8px;
    }
}

/* Utility Classes */
.text-muted {
    color: var(--text-muted);
}

.text-center {
    text-align: center;
}

/* Loading Spinner */
.fa-spinner {
    animation: spin 1s linear infinite;
}

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

/* Loading Skeleton */
.modal-loading-skeleton {
    padding: 40px;
}

.skeleton-line,
.skeleton-box,
.skeleton-score,
.skeleton-sentence,
.skeleton-chip,
.skeleton-text,
.skeleton-word-editor {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s ease-in-out infinite;
    border-radius: var(--radius-sm);
}

.skeleton-line {
    height: 20px;
    width: 100%;
    margin-bottom: 16px;
}

.skeleton-line.short {
    width: 60%;
}

.skeleton-box {
    height: 100px;
    width: 100%;
    margin-bottom: 16px;
}

/* Skeleton for Live Score */
.skeleton-live-score {
    background: linear-gradient(135deg, #f5f5f5 0%, #eeeeee 100%) !important;
}

.skeleton-score {
    width: 80px;
    height: 32px;
    border-radius: var(--radius-md);
}

/* Skeleton for Sentences */
.skeleton-sentence {
    height: 48px;
    width: 100%;
    border-radius: var(--radius-md);
}

/* Skeleton for Word Chips */
.skeleton-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 12px 16px;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    min-height: 50px;
}

.skeleton-chip {
    width: 60px;
    height: 32px;
    border-radius: 16px;
}

.skeleton-chip:nth-child(2) { width: 50px; }
.skeleton-chip:nth-child(3) { width: 70px; }
.skeleton-chip:nth-child(4) { width: 45px; }
.skeleton-chip:nth-child(5) { width: 55px; }
.skeleton-chip:nth-child(6) { width: 65px; }
.skeleton-chip:nth-child(7) { width: 40px; }
.skeleton-chip:nth-child(8) { width: 75px; }

/* Skeleton for Text */
.skeleton-text {
    height: 20px;
    display: inline-block;
}

/* Skeleton for Word Editor */
.skeleton-word-editor {
    height: 120px;
    width: 100%;
    margin-bottom: 16px;
    border-radius: var(--radius-md);
}

.skeleton-word-editor:last-child {
    margin-bottom: 0;
}

@keyframes skeleton-loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* Legacy animation alias */
@keyframes loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}
