/* Grammar Checker Styles */
.grammar-checker-page {
    padding: 2rem 0;
    background-color: #f8f9fa;
    min-height: 100vh;
}

.tool-header {
    text-align: center;
    margin-bottom: 2.5rem;
}

.tool-header h1 {
    font-size: 2.5rem;
    color: #2c3e50;
    margin-bottom: 1rem;
}

.subtitle {
    font-size: 1.1rem;
    color: #7f8c8d;
    max-width: 800px;
    margin: 0 auto 1.5rem;
    line-height: 1.6;
}

.breadcrumb {
    font-size: 0.9rem;
    color: #7f8c8d;
    margin-bottom: 1.5rem;
}

.breadcrumb a {
    color: #3498db;
    text-decoration: none;
    transition: color 0.3s ease;
}

.breadcrumb a:hover {
    color: #2980b9;
    text-decoration: underline;
}

/* Tool Container */
.tool-container {
    background: white;
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    padding: 2rem;
    margin-bottom: 2rem;
    overflow: hidden;
}

.grammar-checker-container {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    height: calc(100vh - 200px); /* Full viewport height minus header and padding */
    min-height: 600px; /* Minimum height to ensure usability */
}

/* Editor Section */
.editor-section {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    height: 100%;
    min-height: 500px; /* Minimum height for the editor */
}

/* Editor Container */
.editor-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 400px; /* Minimum height for the editor area */
    border: 1px solid #dee2e6;
    border-radius: 8px;
    overflow: hidden;
}

/* Textarea/Editor Styling */
#editor {
    flex: 1;
    width: 100%;
    min-height: 400px;
    padding: 1rem;
    font-family: 'Fira Code', 'Consolas', 'Monaco', monospace;
    font-size: 14px;
    line-height: 1.6;
    border: none;
    resize: none;
    outline: none;
    background: #fff;
    color: #333;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.05);
    transition: border-color 0.2s ease;
}

#editor:focus {
    border-color: #80bdff;
    box-shadow: 0 0 0 0.2rem rgba(0,123,255,0.15);
}

.toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 0.5rem;
}

.toolbar-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1.2rem;
    background: #f1f3f5;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    color: #495057;
    cursor: pointer;
    font-size: 0.95rem;
    transition: all 0.2s ease;
}

.btn:hover {
    background: #e9ecef;
    border-color: #ced4da;
}

.btn-primary {
    background-color: #3498db;
    border-color: #3498db;
    color: white;
}

.btn-primary:hover {
    background-color: #2980b9;
    border-color: #2980b9;
}

.file-upload {
    position: relative;
    display: inline-block;
}

.file-upload input[type="file"] {
    position: absolute;
    left: 0;
    top: 0;
    opacity: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
}

.word-count, .char-count {
    font-size: 0.9rem;
    color: #6c757d;
    padding: 0.3rem 0.8rem;
    background: #f1f3f5;
    border-radius: 4px;
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.word-count::before {
    content: '📝';
}

.char-count::before {
    content: '🔤';
}

/* Editor Container */
.editor-container {
    border: 1px solid #dee2e6;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 1rem;
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 400px;
    max-height: 70vh;
    background: white;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.05);
    transition: border-color 0.2s ease;
}

.editor-container:focus-within {
    border-color: #80bdff;
    box-shadow: 0 0 0 0.2rem rgba(0,123,255,0.15);
}

/* Textarea/Editor Styling */
#editor, #editor-textarea {
    flex: 1;
    width: 100%;
    min-height: 400px;
    padding: 1rem;
    font-family: 'Fira Code', 'Consolas', 'Monaco', monospace;
    font-size: 14px;
    line-height: 1.6;
    border: none;
    resize: none;
    outline: none;
    background: transparent;
    color: #333;
    box-sizing: border-box;
}

#editor:focus, #editor-textarea:focus {
    outline: none;
    box-shadow: none;
}

#editor-textarea {
    min-height: 300px;
    padding: 15px;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    font-family: 'Fira Code', 'Consolas', 'Monaco', 'Andale Mono', monospace;
    font-size: 14px;
    line-height: 1.5;
    resize: vertical;
    width: 100%;
    box-sizing: border-box;
}

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

/* Responsive adjustments */
@media (min-width: 992px) {
    .grammar-checker-container {
        flex-direction: row;
        gap: 2rem;
    }
    
    .editor-section {
        flex: 1;
        min-width: 0;
    }
    
    .results-section {
        flex: 1;
        min-width: 0;
        max-width: 50%;
    }

    .editor-container,
    .results-section {
        max-height: calc(100vh - 300px);
        overflow-y: auto;
    }
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* CodeMirror overrides */
.CodeMirror {
    line-height: 1.5;
    padding: 15px;
    border: none !important;
    border-radius: 0 0 8px 8px;
}

.CodeMirror-scroll {
    min-height: 300px;
}

.CodeMirror-focused {
    outline: none;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.2);
}

.CodeMirror-placeholder {
    color: #999;
    font-style: italic;
}

.CodeMirror-lines {
    padding: 10px 0;
}

.CodeMirror-gutters {
    background-color: #f8f9fa;
    border-right: 1px solid #dee2e6;
}

/* Results Section */
.results-section {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 1.5rem;
    margin-top: 1rem;
}

.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #e9ecef;
}

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

.score-container {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.score {
    background: #2c3e50;
    color: white;
    width: 80px;
    height: 80px;
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

.score #scoreValue {
    font-size: 1.8rem;
    line-height: 1;
}

.score small {
    font-size: 0.7rem;
    opacity: 0.8;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-box {
    background: white;
    border-radius: 8px;
    padding: 1.2rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.stat-box:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    color: white;
}

.stat-box:nth-child(1) .stat-icon { background: #e74c3c; }
.stat-box:nth-child(2) .stat-icon { background: #f39c12; }
.stat-box:nth-child(3) .stat-icon { background: #3498db; }
.stat-box:nth-child(4) .stat-icon { background: #2ecc71; }

.stat-info {
    flex-grow: 1;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: #2c3e50;
    line-height: 1;
    margin-bottom: 0.2rem;
}

.stat-label {
    font-size: 0.85rem;
    color: #7f8c8d;
}

/* Issues Container */
.issues-container {
    background: white;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 1.5rem;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
}

.issues-tabs {
    display: flex;
    border-bottom: 1px solid #e9ecef;
    background: #f8f9fa;
    padding: 0 1rem;
    flex-wrap: wrap;
}

.tab-btn {
    padding: 0.8rem 1.2rem;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    font-weight: 500;
    color: #6c757d;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.tab-btn:hover {
    color: #3498db;
}

.tab-btn.active {
    color: #3498db;
    border-bottom-color: #3498db;
    background: rgba(52, 152, 219, 0.05);
}

.issues-list {
    min-height: 200px;
    max-height: 400px;
    overflow-y: auto;
}

.issue-item {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid #f1f3f5;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.issue-item:last-child {
    border-bottom: none;
}

.issue-item:hover {
    background-color: #f8f9fa;
}

.issue-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.issue-type {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.8rem;
    font-weight: 600;
    padding: 0.2rem 0.6rem;
    border-radius: 4px;
    text-transform: capitalize;
}

.issue-type.critical {
    background: #fde8e8;
    color: #e53e3e;
}

.issue-type.warning {
    background: #fef3c7;
    color: #d97706;
}

.issue-type.suggestion {
    background: #e0f2fe;
    color: #0284c7;
}

.issue-message {
    font-size: 0.95rem;
    color: #2d3748;
    margin-bottom: 0.5rem;
    line-height: 1.5;
}

.issue-context {
    background: #f8f9fa;
    padding: 0.5rem 0.8rem;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    margin: 0.5rem 0;
    border-left: 3px solid #dee2e6;
}

.issue-suggestions {
    margin-top: 0.5rem;
}

.suggestion-btn {
    background: #f1f3f5;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    padding: 0.3rem 0.8rem;
    margin-right: 0.5rem;
    margin-bottom: 0.5rem;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
}

.suggestion-btn:hover {
    background: #e9ecef;
    border-color: #ced4da;
}

.suggestion-btn i {
    font-size: 0.8em;
}

.no-issues {
    padding: 3rem 1.5rem;
    text-align: center;
    color: #6c757d;
}

.no-issues i {
    font-size: 2.5rem;
    color: #2ecc71;
    margin-bottom: 1rem;
    opacity: 0.8;
}

.no-issues p {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
    color: #2c3e50;
}

.no-issues small {
    font-size: 0.9rem;
    opacity: 0.8;
}

/* Enhancement Suggestions */
.enhancement-suggestions {
    margin-top: 2rem;
}

.enhancement-suggestions h4 {
    color: #2c3e50;
    margin-bottom: 1rem;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.enhancement-suggestions h4::before {
    content: '✨';
    font-size: 1.3em;
}

.enhancement-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1rem;
}

.enhancement-item {
    background: white;
    border-radius: 8px;
    padding: 1.5rem;
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    cursor: pointer;
}

.enhancement-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.enhancement-item i {
    font-size: 1.5rem;
    color: #3498db;
    margin-top: 0.2rem;
}

.enhancement-content h5 {
    margin: 0 0 0.3rem 0;
    color: #2c3e50;
    font-size: 1rem;
}

.enhancement-content p {
    margin: 0;
    font-size: 0.9rem;
    color: #6c757d;
    line-height: 1.5;
}

/* Action Buttons */
.action-buttons {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-top: 1rem;
}

/* Responsive Design */
@media (max-width: 1200px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .enhancement-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .tool-header h1 {
        font-size: 2rem;
    }
    
    .subtitle {
        font-size: 1rem;
    }
    
    .tool-container {
        padding: 1.5rem;
    }
    
    .stats-grid, .enhancement-grid {
        grid-template-columns: 1fr;
    }
    
    .toolbar {
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
    }
    
    .toolbar-group {
        justify-content: space-between;
    }
    
    .CodeMirror {
        height: 300px;
    }
    
    .results-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1.5rem;
    }
    
    .score-container {
        width: 100%;
        justify-content: space-between;
    }
    
    .tab-btn {
        padding: 0.6rem 0.8rem;
        font-size: 0.85rem;
    }
}

@media (max-width: 480px) {
    .toolbar-group {
        width: 100%;
        justify-content: space-between;
    }
    
    .file-upload {
        width: 100%;
    }
    
    #uploadBtn {
        width: 100%;
        justify-content: center;
    }
    
    .btn {
        padding: 0.5rem 1rem;
        font-size: 0.9rem;
    }
    
    .action-buttons {
        justify-content: center;
    }
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.stat-box, .enhancement-item, .issue-item {
    animation: fadeIn 0.5s ease-out forwards;
    opacity: 0;
}

/* Add delay to each item */
.stat-box:nth-child(1) { animation-delay: 0.1s; }
.stat-box:nth-child(2) { animation-delay: 0.2s; }
.stat-box:nth-child(3) { animation-delay: 0.3s; }
.stat-box:nth-child(4) { animation-delay: 0.4s; }

.enhancement-item:nth-child(1) { animation-delay: 0.2s; }
.enhancement-item:nth-child(2) { animation-delay: 0.3s; }
.enhancement-item:nth-child(3) { animation-delay: 0.4s; }
