/* Number Sorter Tool - Custom Styling */

/* Container & Layout */
.number-sorter-container {
    font-family: "Inter", -apple-system, BlinkMacSystemFont, sans-serif;
}

/* Header Section */
.header-section h1 {
    background: linear-gradient(135deg, #1e40af 0%, #3b82f6 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Preset Buttons */
.preset-buttons {
}

.preset-btn {
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    border: 2px solid #e2e8f0;
    color: #475569;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.preset-btn:hover {
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
    border-color: #3b82f6;
    color: white;
    box-shadow: 0 8px 25px rgba(59, 130, 246, 0.3);
}

.preset-btn:active {
    transform: translateY(0);
}

.preset-btn::before {
    content: "";
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.preset-btn:hover::before {
    left: 100%;
}

/* Input Panel */
.input-panel {
    border: 1px solid #e5e7eb;
}

.panel-header h2 {
    color: #1f2937;
    font-weight: 600;
}

/* Action Buttons in Header */
.action-btn {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
}

.action-btn:hover {
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

/* Input Textarea */
.input-textarea {
    background: white;
    font-family: "JetBrains Mono", "Monaco", "Courier New", monospace;
    line-height: 1.6;
    transition: all 0.3s ease;
}

.input-textarea:focus {
    background: #fefefe;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.input-textarea::placeholder {
    color: #9ca3af;
    font-size: 14px;
}

/* Status and Count */
.input-info {
}

.status-text {
    padding: 4px 8px;
    border-radius: 4px;
    background: #f1f5f9;
    color: #475569;
    font-weight: 500;
}

.status-text.processing {
    background: #fef3c7;
    color: #d97706;
}

.status-text.success {
    background: #d1fae5;
    color: #059669;
}

.status-text.error {
    background: #fee2e2;
    color: #dc2626;
}

.count-text {
    font-weight: 600;
    color: #374151;
}

/* Format Detection */
.format-detection {
}

.detected-format {
}

/* Form Controls */
.select-input {
    background: white;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 14px;
    color: #374151;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 100%;
}

.select-input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.text-input {
    background: white;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 14px;
    color: #374151;
    transition: all 0.3s ease;
}

.text-input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Advanced Options */
#toggleAdvanced {
    transition: all 0.3s ease;
}

#toggleAdvanced:hover {
    color: #1d4ed8;
}

.advanced-panel {
    border: 1px solid #d1d5db;
}

/* Checkbox Controls */
.checkbox-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    user-select: none;
}

.checkbox-input {
    width: 18px;
    height: 18px;
    margin-right: 8px;
    border: 2px solid #d1d5db;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.checkbox-input:checked {
    background-color: #3b82f6;
    border-color: #3b82f6;
}

.checkbox-text {
    font-size: 14px;
    color: #374151;
    font-weight: 500;
}

/* Primary Buttons */
.primary-btn {
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.primary-btn:hover {
    background: linear-gradient(135deg, #1d4ed8 0%, #1e40af 100%);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(59, 130, 246, 0.3);
}

.primary-btn:active {
    transform: translateY(0);
}

.primary-btn:disabled {
    background: #9ca3af;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.secondary-btn {
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    color: #475569;
    border: 2px solid #e2e8f0;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.secondary-btn:hover {
    background: linear-gradient(135deg, #e2e8f0 0%, #cbd5e1 100%);
    border-color: #cbd5e1;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.1);
}

.danger-btn {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.danger-btn:hover {
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(239, 68, 68, 0.3);
}

/* Loading State */
.loading-state {
}

.loading-spinner {
    width: 24px;
    height: 24px;
    border: 3px solid #e5e7eb;
    border-top: 3px solid #3b82f6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

/* Results Panel */
.results-panel {
}

/* Quick Stats */
.quick-stats {
    gap: 16px;
}

.stat-item {
    background: white;
    padding: 16px;
    border-radius: 8px;
    text-align: center;
    border: 1px solid #e5e7eb;
    transition: all 0.3s ease;
}

.stat-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.1);
}

.stat-value {
    font-size: 24px;
    font-weight: 700;
    color: #1f2937;
    margin-bottom: 4px;
}

.stat-label {
    font-size: 12px;
    color: #6b7280;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Performance Indicator */
.performance-indicator {
}

.performance-bar {
    position: relative;
    overflow: hidden;
}

.performance-fill {
    transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.performance-fill.excellent {
    background: linear-gradient(90deg, #10b981, #059669);
}

.performance-fill.good {
    background: linear-gradient(90deg, #3b82f6, #1d4ed8);
}

.performance-fill.average {
    background: linear-gradient(90deg, #f59e0b, #d97706);
}

.performance-fill.poor {
    background: linear-gradient(90deg, #ef4444, #dc2626);
}

/* Export Buttons */
.export-btn {
    background: #6b7280;
    color: white;
    border: none;
    padding: 10px 16px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.export-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.export-btn:disabled {
    background: #d1d5db;
    color: #9ca3af;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Results Section */
.results-section {
}

.results-header {
    position: relative;
    overflow: hidden;
}

.results-header::before {
    content: "";
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
}

/* Results Tabs */
.results-tabs {
    background: #f8fafc;
}

.tab-buttons {
    display: flex;
    border-bottom: 1px solid #e5e7eb;
}

.tab-btn {
    background: transparent;
    border: none;
    padding: 16px 24px;
    color: #6b7280;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    transition: all 0.3s ease;
    position: relative;
}

.tab-btn:hover {
    color: #3b82f6;
    background: #f1f5f9;
}

.tab-btn.active {
    color: #3b82f6;
    background: white;
    border-bottom: 2px solid #3b82f6;
}

.tab-btn.active::after {
    content: "";
    position: absolute;
    bottom: -1px;
    left: 0;
    right: 0;
    height: 2px;
    background: #3b82f6;
}

/* Tab Content */
.tab-panel {
    display: none;
}

.tab-panel.active {
    display: block;
}

/* Output Textarea */
.output-textarea {
    background: #fafafa;
    font-family: "JetBrains Mono", "Monaco", "Courier New", monospace;
    color: #374151;
    line-height: 1.6;
    resize: vertical;
}

.copy-btn {
    background: #e5e7eb;
    color: #6b7280;
    border: none;
    padding: 4px 8px;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    transition: all 0.2s ease;
}

.copy-btn:hover {
    background: #d1d5db;
    color: #374151;
}

.copy-btn.copied {
    background: #10b981;
    color: white;
}

/* Statistics Content */
.statistics-content {
}

.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.stat-card {
    background: #f8fafc;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    transition: all 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.1);
    border-color: #3b82f6;
}

.stat-card-value {
    font-size: 28px;
    font-weight: 700;
    color: #1f2937;
    margin-bottom: 8px;
}

.stat-card-label {
    font-size: 14px;
    color: #6b7280;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-card-description {
    font-size: 12px;
    color: #9ca3af;
    margin-top: 4px;
}

/* Number Preview */
.number-preview {
    border: 1px solid #d1d5db;
    max-height: 200px;
    overflow-y: auto;
    font-family: "JetBrains Mono", "Monaco", "Courier New", monospace;
    line-height: 1.6;
    white-space: pre-wrap;
}

.number-preview::-webkit-scrollbar {
    width: 6px;
}

.number-preview::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.number-preview::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.number-preview::-webkit-scrollbar-thumb:hover {
    background: #a1a1a1;
}

/* Toast Notifications */
.toast-container {
    z-index: 1000;
}

.toast {
    background: white;
    border-left: 4px solid #3b82f6;
    border-radius: 8px;
    padding: 16px 20px;
    margin-bottom: 12px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    min-width: 300px;
    position: relative;
    overflow: hidden;
}

.toast.success {
    border-left-color: #10b981;
}

.toast.error {
    border-left-color: #ef4444;
}

.toast.warning {
    border-left-color: #f59e0b;
}

.toast-icon {
    width: 20px;
    height: 20px;
    margin-right: 12px;
    flex-shrink: 0;
}

.toast-message {
    flex: 1;
    font-size: 14px;
    color: #374151;
    font-weight: 500;
}

.toast-close {
    background: none;
    border: none;
    color: #9ca3af;
    cursor: pointer;
    padding: 4px;
    margin-left: 8px;
}

.toast-close:hover {
    color: #374151;
}

/* Progress Bar (for toasts) */
.toast::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 0;
    height: 2px;
    background: currentColor;
    opacity: 0.3;
    animation: toastProgress 3s linear forwards;
}

@keyframes toastProgress {
    from {
        width: 100%;
    }
    to {
        width: 0%;
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .number-sorter-container {
        padding: 16px;
    }

    .header-section h1 {
        font-size: 28px;
    }

    .preset-buttons {
        justify-content: center;
    }

    .preset-btn {
        font-size: 13px;
        padding: 6px 12px;
    }

    .input-panel,
    .results-panel {
        padding: 20px;
    }

    .action-buttons {
        flex-direction: column;
    }

    .action-buttons button {
        width: 100%;
        justify-content: center;
    }

    .quick-stats {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    .stat-item {
        padding: 12px;
    }

    .stat-value {
        font-size: 20px;
    }

    .tab-buttons {
        flex-direction: column;
    }

    .tab-btn {
        padding: 12px 16px;
        border-bottom: 1px solid #e5e7eb;
    }

    .tab-btn.active {
        border-bottom: none;
        border-left: 3px solid #3b82f6;
    }

    .toast {
        min-width: auto;
        margin: 0 16px 12px 16px;
    }
}

@media (max-width: 480px) {
    .quick-stats {
        grid-template-columns: 1fr;
    }

    .export-buttons {
        gap: 8px;
    }

    .export-btn {
        padding: 8px 12px;
        font-size: 12px;
    }

    .stat-card {
        padding: 16px;
    }

    .stat-card-value {
        font-size: 24px;
    }
}

/* Focus Indicators for Accessibility */
button:focus,
select:focus,
input:focus,
textarea:focus {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
    .preset-btn,
    .tab-btn,
    .select-input,
    .text-input {
        border-width: 2px;
    }

    .stat-item,
    .stat-card {
        border-width: 2px;
    }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    .loading-spinner {
        animation: none;
        border-top-color: transparent;
    }
}
