/* Grammar Checker - Clean Modern Design */

/* Grammar-specific color variables */
:root {
    --grammar-color: #ef4444;
    --grammar-bg: #fef2f2;
    --clarity-color: #3b82f6;
    --clarity-bg: #eff6ff;
    --vocabulary-color: #8b5cf6;
    --vocabulary-bg: #f5f3ff;
    --style-color: #ec4899;
    --style-bg: #fdf2f8;
    --spelling-color: #f59e0b;
    --spelling-bg: #fffbeb;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --error-color: #ef4444;
}

/* Main Content */
.main-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* Editor and Issues Row */
.editor-issues-row {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 24px;
}

/* Editor Section */
.editor-section {
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    overflow: hidden;
}

.editor-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-secondary);
}

.editor-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-label {
    font-size: 14px;
    color: var(--text-secondary);
    font-weight: 500;
}

.language-select {
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    background: var(--bg-primary);
    color: var(--text-primary);
    cursor: pointer;
    outline: none;
    transition: all 0.2s;
}

.language-select:hover {
    border-color: var(--primary-color);
}

.editor-header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.text-stats {
    font-size: 13px;
    color: var(--text-muted);
}

.stats-divider {
    color: var(--text-muted);
}

.btn-check {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: var(--primary-gradient);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow-md);
}

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

.btn-check:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.editor-container {
    position: relative;
    min-height: 280px;
}

.text-editor {
    min-height: 280px;
    max-height: 400px;
    overflow-y: auto;
    padding: 20px;
    font-size: 16px;
    line-height: 1.8;
    color: var(--text-primary);
    outline: none;
}

.text-editor:empty:before {
    content: attr(data-placeholder);
    color: var(--text-muted);
    pointer-events: none;
}

/* Grammar Error Highlights */
.grammar-error {
    position: relative;
    border-bottom: 2px wavy var(--grammar-color);
    cursor: pointer;
    background: var(--grammar-bg);
    border-radius: 2px;
    padding: 0 2px;
    transition: background 0.2s;
}

.grammar-error:hover {
    background: rgba(239, 68, 68, 0.2);
}

.grammar-error.spelling {
    border-bottom-color: var(--spelling-color);
    background: var(--spelling-bg);
}

.grammar-error.style {
    border-bottom-color: var(--style-color);
    background: var(--style-bg);
}

.grammar-error.clarity {
    border-bottom-color: var(--clarity-color);
    background: var(--clarity-bg);
}

.grammar-error.vocabulary {
    border-bottom-color: var(--vocabulary-color);
    background: var(--vocabulary-bg);
}

/* Loading Overlay */
.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.95);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.loading-overlay.show {
    display: flex;
}

.loading-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

.loading-content span {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
}

/* Issues Section */
.issues-section {
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    max-height: 500px;
}

.issues-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
}

.issues-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
}

.issues-title svg {
    color: var(--warning-color);
}

.issues-badge {
    background: var(--error-color);
    color: white;
    font-size: 12px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 10px;
    min-width: 24px;
    text-align: center;
}

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

.btn-fix-all {
    padding: 8px 16px;
    background: transparent;
    color: var(--primary-color);
    border: none;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    letter-spacing: 0.5px;
}

.btn-fix-all:hover {
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
}

.issues-list {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
}

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    text-align: center;
    color: var(--text-muted);
}

.empty-icon {
    margin-bottom: 16px;
    opacity: 0.3;
}

.empty-icon svg {
    color: var(--success-color);
}

.empty-state p {
    font-size: 14px;
    max-width: 200px;
    line-height: 1.5;
}

/* Issue Item */
.issue-item {
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    padding: 16px;
    margin-bottom: 12px;
    border-left: 4px solid var(--grammar-color);
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}

.issue-item:last-child {
    margin-bottom: 0;
}

.issue-item:hover {
    box-shadow: var(--shadow-md);
    transform: translateX(2px);
}

.issue-item.grammar {
    border-left-color: var(--grammar-color);
    background: var(--grammar-bg);
}

.issue-item.clarity {
    border-left-color: var(--clarity-color);
    background: var(--clarity-bg);
}

.issue-item.vocabulary {
    border-left-color: var(--vocabulary-color);
    background: var(--vocabulary-bg);
}

.issue-item.style {
    border-left-color: var(--style-color);
    background: var(--style-bg);
}

.issue-item.spelling {
    border-left-color: var(--spelling-color);
    background: var(--spelling-bg);
}

.issue-type-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.issue-item.grammar .issue-type-label { color: var(--grammar-color); }
.issue-item.clarity .issue-type-label { color: var(--clarity-color); }
.issue-item.vocabulary .issue-type-label { color: var(--vocabulary-color); }
.issue-item.style .issue-type-label { color: var(--style-color); }
.issue-item.spelling .issue-type-label { color: var(--spelling-color); }

.issue-type-icon {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
}

.issue-item.grammar .issue-type-icon { background: rgba(239, 68, 68, 0.2); color: var(--grammar-color); }
.issue-item.clarity .issue-type-icon { background: rgba(59, 130, 246, 0.2); color: var(--clarity-color); }
.issue-item.vocabulary .issue-type-icon { background: rgba(139, 92, 246, 0.2); color: var(--vocabulary-color); }
.issue-item.style .issue-type-icon { background: rgba(236, 72, 153, 0.2); color: var(--style-color); }
.issue-item.spelling .issue-type-icon { background: rgba(245, 158, 11, 0.2); color: var(--spelling-color); }

.issue-correction {
    margin-bottom: 10px;
}

.issue-original {
    text-decoration: line-through;
    color: var(--text-muted);
    font-size: 14px;
}

.issue-arrow {
    margin: 0 8px;
    color: var(--text-muted);
}

.issue-suggestion {
    color: var(--success-color);
    font-weight: 600;
    font-size: 14px;
}

.issue-description {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 12px;
}

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

.btn-accept,
.btn-ignore {
    padding: 6px 16px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid;
}

.btn-accept {
    background: var(--success-color);
    color: white;
    border-color: var(--success-color);
}

.btn-accept:hover {
    background: #059669;
    border-color: #059669;
}

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

.btn-ignore:hover {
    background: var(--bg-secondary);
}

/* Corrected Section */
.corrected-section {
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    overflow: hidden;
}

.corrected-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    background: rgba(16, 185, 129, 0.05);
}

.corrected-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 15px;
    font-weight: 600;
    color: var(--success-color);
}

.btn-copy {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: var(--bg-primary);
    color: var(--primary-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    letter-spacing: 0.5px;
}

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

.btn-copy.copied {
    background: var(--success-color);
    color: white;
    border-color: var(--success-color);
}

.corrected-text {
    padding: 20px;
    font-size: 15px;
    line-height: 1.8;
    color: var(--text-primary);
    font-style: italic;
}

/* Writing Quality Progress Section */
.quality-section {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 24px;
    box-shadow: var(--shadow-sm);
}

.quality-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.quality-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

.quality-title svg {
    color: #667eea;
}

.quality-score {
    font-size: 32px;
    font-weight: 800;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.quality-progress-container {
    margin-bottom: 24px;
}

.quality-progress-bar {
    height: 12px;
    background: #e2e8f0;
    border-radius: 6px;
    overflow: hidden;
    margin-bottom: 8px;
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.quality-progress-fill {
    height: 100%;
    border-radius: 6px;
    background: linear-gradient(90deg, #ef4444 0%, #f59e0b 25%, #eab308 50%, #84cc16 75%, #22c55e 100%);
    transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.quality-progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(180deg, rgba(255,255,255,0.3) 0%, transparent 50%, rgba(0,0,0,0.1) 100%);
}

.quality-labels {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    font-weight: 500;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.quality-metrics {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}

.metric-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: var(--bg-primary);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    transition: all 0.2s;
}

.metric-item:hover {
    border-color: #667eea;
    box-shadow: var(--shadow-sm);
}

.metric-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.metric-icon.grammar-metric {
    background: linear-gradient(135deg, #fef2f2, #fee2e2);
    color: #ef4444;
}

.metric-icon.clarity-metric {
    background: linear-gradient(135deg, #eff6ff, #dbeafe);
    color: #3b82f6;
}

.metric-icon.style-metric {
    background: linear-gradient(135deg, #fdf2f8, #fce7f3);
    color: #ec4899;
}

.metric-icon.vocabulary-metric {
    background: linear-gradient(135deg, #f5f3ff, #ede9fe);
    color: #8b5cf6;
}

.metric-info {
    flex: 1;
    min-width: 0;
}

.metric-label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.metric-bar {
    height: 6px;
    background: #e2e8f0;
    border-radius: 3px;
    overflow: hidden;
}

.metric-bar-fill {
    height: 100%;
    border-radius: 3px;
    background: linear-gradient(90deg, #667eea, #764ba2);
    transition: width 0.6s ease-out;
}

.metric-score {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
    min-width: 40px;
    text-align: right;
}

/* Bottom Cards Row */
.bottom-cards-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
}

.analysis-card {
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    overflow: hidden;
}

.card-header {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
}

.card-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
}

.tone-icon {
    background: linear-gradient(135deg, #fef3c7, #fde68a);
    color: #d97706;
}

.style-icon {
    background: linear-gradient(135deg, #e0e7ff, #c7d2fe);
    color: #6366f1;
}

.stats-icon {
    background: linear-gradient(135deg, #dbeafe, #bfdbfe);
    color: #2563eb;
}

.card-title-group h3 {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.card-title-group p {
    font-size: 12px;
    color: var(--text-muted);
}

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

.placeholder-content {
    padding: 20px;
    text-align: center;
    color: var(--text-muted);
    font-size: 13px;
}

/* Tone Analysis Styles */
.tone-item {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
}

.tone-item:last-child {
    margin-bottom: 0;
}

.tone-emoji {
    font-size: 20px;
}

.tone-info {
    flex: 1;
}

.tone-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.tone-bar {
    height: 8px;
    background: var(--bg-secondary);
    border-radius: 4px;
    overflow: hidden;
}

.tone-bar-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.5s ease-out;
}

.tone-bar-fill.casual { background: linear-gradient(90deg, #fbbf24, #f59e0b); }
.tone-bar-fill.neutral { background: linear-gradient(90deg, #9ca3af, #6b7280); }
.tone-bar-fill.confident { background: linear-gradient(90deg, #3b82f6, #2563eb); }
.tone-bar-fill.professional { background: linear-gradient(90deg, #8b5cf6, #7c3aed); }
.tone-bar-fill.friendly { background: linear-gradient(90deg, #ec4899, #db2777); }

.tone-percentage {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-secondary);
    min-width: 45px;
    text-align: right;
}

/* Style Suggestions */
.suggestion-item {
    display: flex;
    gap: 12px;
    margin-bottom: 14px;
    font-size: 13px;
    line-height: 1.5;
    color: var(--text-secondary);
}

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

.suggestion-icon {
    flex-shrink: 0;
    color: var(--text-muted);
}

.suggestion-highlight {
    color: var(--primary-color);
    font-style: italic;
}

/* Writing Stats */
.stats-content {
    padding: 16px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.stat-box {
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
    padding: 16px;
    text-align: center;
}

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

.stat-value {
    display: block;
    font-size: 24px;
    font-weight: 700;
    color: var(--primary-color);
}

/* Footer */
.footer {
    text-align: center;
    padding: 32px 24px;
    color: var(--text-muted);
    font-size: 13px;
}

/* All Clear State */
.all-clear {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    text-align: center;
}

.all-clear-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.all-clear h4 {
    font-size: 16px;
    font-weight: 600;
    color: var(--success-color);
    margin-bottom: 8px;
}

.all-clear p {
    font-size: 13px;
    color: var(--text-muted);
}

/* Scrollbar Styling */
.text-editor::-webkit-scrollbar,
.issues-list::-webkit-scrollbar {
    width: 6px;
}

.text-editor::-webkit-scrollbar-track,
.issues-list::-webkit-scrollbar-track {
    background: transparent;
}

.text-editor::-webkit-scrollbar-thumb,
.issues-list::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

.text-editor::-webkit-scrollbar-thumb:hover,
.issues-list::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* Animation */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-8px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.issue-item {
    animation: slideIn 0.3s ease-out;
}

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

/* Responsive Design */
@media (max-width: 1200px) {
    .editor-issues-row {
        grid-template-columns: 1fr 320px;
    }
}

@media (max-width: 1024px) {
    .nav-center {
        display: none;
    }
    
    .mobile-menu-btn {
        display: flex;
    }
    
    .editor-issues-row {
        grid-template-columns: 1fr;
    }
    
    .issues-section {
        max-height: none;
    }
    
    .bottom-cards-row {
        grid-template-columns: 1fr;
    }
    
    .quality-metrics {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .nav-container {
        padding: 12px 16px;
    }
    
    .nav-actions {
        gap: 8px;
    }
    
    .btn-check {
        padding: 8px 16px;
        font-size: 13px;
    }
    
    .btn-check svg {
        display: none;
    }
    
    .main-content {
        padding: 16px;
        gap: 16px;
    }
    
    .editor-header {
        flex-direction: column;
        gap: 12px;
        align-items: flex-start;
    }
    
    .editor-header-left,
    .editor-header-right {
        width: 100%;
        justify-content: space-between;
    }
    
    .issues-header {
        flex-direction: column;
        gap: 12px;
        align-items: flex-start;
    }
    
    .btn-fix-all {
        width: 100%;
        background: var(--bg-secondary);
        border-radius: var(--radius-sm);
        padding: 12px;
    }
    
    .bottom-cards-row {
        gap: 16px;
    }
    
    .quality-section {
        padding: 16px;
    }
    
    .quality-score {
        font-size: 24px;
    }
    
    .quality-metrics {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .metric-item {
        padding: 12px;
    }
}

@media (max-width: 480px) {
    .brand-text {
        display: none;
    }
    
    .stats-grid {
        grid-template-columns: 1fr 1fr;
    }
}
