/**
 * Sort Lines Tool Styles
 * Extends main.css with tool-specific styling
 */

.sort-lines-container {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.textarea-wrapper {
    position: relative;
}

.sort-lines-textarea {
    width: 100%;
    padding: 1rem;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', 'Consolas', 'source-code-pro', monospace;
    font-size: 0.9rem;
    line-height: 1.6;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-color);
    color: var(--text-color);
    resize: vertical;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.sort-lines-textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px var(--primary-color-alpha);
}

.sort-lines-textarea::placeholder {
    color: var(--text-muted);
    opacity: 0.6;
}

/* Options Container */
.options-container {
    padding: 1.25rem;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
}

.options-title {
    margin: 0 0 1rem 0;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-color);
}

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

.option-checkbox {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    user-select: none;
}

.option-checkbox input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--primary-color);
}

.checkbox-label {
    font-size: 0.95rem;
    color: var(--text-color);
}

/* Sort Buttons */
.sort-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 0.75rem;
}

.sort-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.875rem 1rem;
    font-size: 0.95rem;
    font-weight: 600;
    border: 2px solid var(--border-color, #e5e7eb);
    border-radius: 8px;
    background-color: var(--bg-color, #ffffff);
    color: var(--text-color, #1f2937);
    cursor: pointer;
    transition: all 0.2s ease;
}

.sort-btn:hover {
    border-color: var(--primary-color, #3b82f6);
    background-color: var(--primary-bg-hover, #eff6ff);
    color: var(--primary-color, #3b82f6);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.15);
}

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

.sort-btn svg {
    flex-shrink: 0;
    width: 16px;
    height: 16px;
}

/* Dark theme sort buttons */
[data-theme="dark"] .sort-btn {
    background-color: #1e293b;
    border-color: #334155;
    color: #e2e8f0;
}

[data-theme="dark"] .sort-btn:hover {
    background-color: #334155;
    border-color: #60a5fa;
    color: #60a5fa;
}

/* System dark mode preference */
@media (prefers-color-scheme: dark) {
    .sort-btn {
        background-color: #1e293b;
        border-color: #334155;
        color: #e2e8f0;
    }

    .sort-btn:hover {
        background-color: #334155;
        border-color: #60a5fa;
        color: #60a5fa;
    }
}

/* Light theme explicit override */
[data-theme="light"] .sort-btn {
    background-color: #ffffff;
    border-color: #e5e7eb;
    color: #1f2937;
}

[data-theme="light"] .sort-btn:hover {
    background-color: #eff6ff;
    border-color: #3b82f6;
    color: #3b82f6;
}

/* Statistics Container */
.stats-container {
    padding: 1.25rem;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
}

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

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

.stat-label {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-color);
}

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

.btn-copy,
.btn-clear {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-copy {
    background: var(--success-color);
    color: white;
    flex: 1;
}

.btn-copy:hover {
    background: var(--success-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(46, 213, 115, 0.3);
}

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

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

/* Output Container */
.output-container {
    margin-top: 1rem;
}

.output-title {
    margin: 0 0 1rem 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-color);
}

/* Copy Notification */
.copy-notification {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    padding: 1rem 1.5rem;
    background: var(--success-color);
    color: white;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    font-weight: 600;
    z-index: 1000;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        transform: translateY(100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .sort-buttons {
        grid-template-columns: 1fr;
    }

    .options-grid {
        grid-template-columns: 1fr;
    }

    .stats-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .action-buttons {
        flex-direction: column;
    }

    .btn-copy,
    .btn-clear {
        width: 100%;
        justify-content: center;
    }

    .copy-notification {
        bottom: 1rem;
        right: 1rem;
        left: 1rem;
    }
}

/* Dark Theme Support */
@media (prefers-color-scheme: dark) {
    .sort-lines-textarea {
        background: var(--bg-secondary);
    }

    .options-container,
    .stats-container {
        background: var(--bg-secondary);
    }
}

/* Light Theme Specific (when explicitly set) */
[data-theme="light"] .sort-lines-textarea {
    background: #ffffff;
}

[data-theme="light"] .options-container,
[data-theme="light"] .stats-container {
    background: #f8f9fa;
}

/* Dark Theme Specific (when explicitly set) */
[data-theme="dark"] .sort-lines-textarea {
    background: var(--bg-secondary);
}

[data-theme="dark"] .options-container,
[data-theme="dark"] .stats-container {
    background: var(--bg-secondary);
}
