/* Main Tool Section */
.stats-tool-section {
    display: flex;
    flex-direction: column;
    gap: 24px;
    margin-top: 32px;
}

/* Input Card */
.stats-input-card {
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    border-radius: 16px;
    padding: 32px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05), 0 1px 3px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(0, 0, 0, 0.06);
    transition: all 0.3s ease;
}

.stats-input-card:hover {
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.08), 0 4px 8px rgba(0, 0, 0, 0.12);
}

.card-header-section {
    margin-bottom: 24px;
}

.card-title {
    font-size: 24px;
    font-weight: 700;
    color: #1a1a1a;
    margin: 0 0 8px 0;
}

.card-subtitle {
    font-size: 14px;
    color: #6b7280;
    margin: 0;
}

.input-wrapper {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.stats-textarea {
    width: 100%;
    padding: 16px;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    font-size: 15px;
    
    line-height: 1.6;
    resize: vertical;
    transition: all 0.2s ease;
    background: #ffffff;
    color: #1a1a1a;
}

.stats-textarea:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.stats-textarea::placeholder {
    color: #9ca3af;
}

.input-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.btn-primary-action {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 14px 28px;
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: #ffffff;
    border: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(59, 130, 246, 0.3);
}

.btn-primary-action:hover {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(59, 130, 246, 0.4);
}

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

.btn-icon {
    font-size: 18px;
}

.btn-secondary-action {
    display: flex;
    align-items: center;
    padding: 14px 28px;
    background: #ffffff;
    color: #4b5563;
    border: 2px solid #e5e7eb;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-secondary-action:hover {
    background: #f9fafb;
    border-color: #d1d5db;
    color: #1f2937;
}

/* Results Card */
.stats-results-card {
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    border-radius: 16px;
    padding: 32px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05), 0 1px 3px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(0, 0, 0, 0.06);
    animation: slideIn 0.4s ease-out;
}

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

.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 28px;
    flex-wrap: wrap;
    gap: 16px;
}

.results-title {
    font-size: 24px;
    font-weight: 700;
    color: #1a1a1a;
    margin: 0;
}

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

.action-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 16px;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    color: #4b5563;
}

.action-btn:hover {
    background: #f9fafb;
    border-color: #d1d5db;
    color: #1f2937;
    transform: translateY(-1px);
}

.action-icon {
    font-size: 16px;
}

.action-text {
    display: none;
}

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

.stat-item {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 20px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
}

.stat-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: linear-gradient(180deg, #3b82f6 0%, #2563eb 100%);
    opacity: 0;
    transition: opacity 0.2s ease;
}

.stat-item:hover {
    border-color: #3b82f6;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.15);
    transform: translateY(-2px);
}

.stat-item:hover::before {
    opacity: 1;
}

.stat-item.highlight {
    background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
    border-color: #93c5fd;
}

.stat-item.highlight::before {
    opacity: 1;
}

.stat-icon {
    font-size: 24px;
    flex-shrink: 0;
    line-height: 1;
}

.stat-content {
    flex: 1;
    min-width: 0;
}

.stat-label {
    font-size: 13px;
    color: #6b7280;
    font-weight: 500;
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-value {
    font-size: 22px;
    font-weight: 700;
    color: #1a1a1a;
    line-height: 1.2;
    word-break: break-word;
}

.stat-value-small {
    font-size: 18px;
}

/* Sorted Numbers Section */
.sorted-section {
    margin-top: 32px;
    padding-top: 32px;
    border-top: 1px solid #e5e7eb;
}

.sorted-title {
    font-size: 18px;
    font-weight: 600;
    color: #1a1a1a;
    margin: 0 0 16px 0;
}

.sorted-numbers-container {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 16px;
    max-height: 200px;
    overflow-y: auto;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    
}

.sorted-number-tag {
    display: inline-block;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    padding: 6px 12px;
    font-size: 14px;
    color: #1a1a1a;
    transition: all 0.2s ease;
}

.sorted-number-tag:hover {
    background: #eff6ff;
    border-color: #3b82f6;
    transform: scale(1.05);
}

/* Scrollbar Styling */
.sorted-numbers-container::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.sorted-numbers-container::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.sorted-numbers-container::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

.sorted-numbers-container::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Mobile Responsive */
@media (max-width: 767px) {
    .stats-input-card,
    .stats-results-card {
        padding: 20px;
        border-radius: 12px;
    }

    .card-title,
    .results-title {
        font-size: 20px;
    }

    .stats-grid-container {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .stat-item {
        padding: 16px;
    }

    .stat-value {
        font-size: 20px;
    }

    .stat-value-small {
        font-size: 16px;
    }

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

    .btn-primary-action,
    .btn-secondary-action {
        width: 100%;
        justify-content: center;
    }

    .results-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .results-actions {
        width: 100%;
    }

    .action-btn {
        flex: 1;
        justify-content: center;
    }

    .action-text {
        display: inline;
    }

    .sorted-numbers-container {
        max-height: 150px;
    }
}

@media (max-width: 480px) {
    .stats-tool-section {
        margin-top: 24px;
    }

    .stats-input-card,
    .stats-results-card {
        padding: 16px;
    }

    .stat-icon {
        font-size: 20px;
    }

    .stat-label {
        font-size: 12px;
    }

    .stat-value {
        font-size: 18px;
    }
}

/* Tablet Responsive */
@media (min-width: 768px) and (max-width: 1024px) {
    .stats-grid-container {
        grid-template-columns: repeat(2, 1fr);
    }
}
