:root {
    --surface: #ffffff;
    --surface-muted: #f4f6fb;
    --border: #e3e8f2;
    --text-main: #1c2333;
    --text-muted: #5f6b85;
    --primary: #4f46ef;
    --primary-dark: #312e81;
    --primary-light: #6366f1;
    --accent: #36cfc9;
    --success: #10b981;
    --info: #3b82f6;
    --danger: #ef4444;
    --shadow-soft: 0 20px 45px rgba(15, 23, 42, 0.08);
    --shadow-medium: 0 10px 25px rgba(15, 23, 42, 0.1);
    --shadow-sm: 0 2px 8px rgba(15, 23, 42, 0.04);
    --radius: 12px;
    --radius-lg: 20px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Tool Hero Section */
.tool-hero {
    display: flex;
    flex-wrap: wrap;
    gap: 32px;
    align-items: flex-start;
    margin-bottom: 1rem;
}

.hero-text {
    flex: 1;
    min-width: 260px;
}

.hero-text h1 {
    font-size: 40px;
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: 0;
    color: var(--text-main);
}

.hero-subtitle {
    font-size: 18px;
    color: var(--text-muted);
    max-width: 640px;
    margin-bottom: 1rem;
    margin-top: 0.5rem;
    line-height: 1.6;
}

/* Tool Wrapper */
.sort-numbers-wrapper {
    display: flex;
    flex-direction: column;
    gap: 24px;
    margin-bottom: 40px;
}

/* Tool Card */
.tool-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-soft);
    padding: 32px;
    transition: var(--transition);
}

.tool-card:hover {
    box-shadow: var(--shadow-medium);
}

/* Card Layout - 2 Columns */
.card-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 32px;
    align-items: stretch;
}

.card-column {
    display: flex;
    flex-direction: column;
}

.input-column {
    border-right: 2px solid var(--border);
    padding-right: 32px;
}

.results-column {
    padding-left: 32px;
}

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

.card-title {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-main);
    margin: 0 0 8px 0;
}

.card-description {
    font-size: 14px;
    color: var(--text-muted);
    margin: 0;
    line-height: 1.5;
}

/* Form Elements */
.form-group {
    display: flex;
    flex-direction: column;
    margin-bottom: 24px;
}

.form-group:last-of-type {
    margin-bottom: 0;
}

.form-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 8px;
}

.form-label i {
    font-size: 12px;
    color: var(--primary);
}

.form-textarea,
.form-select {
    width: 100%;
    padding: 12px 16px;
    font-size: 15px;
    line-height: 1.5;
    color: var(--text-main);
    background: var(--surface);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    transition: var(--transition);
    
    resize: vertical;
}

.form-textarea:focus,
.form-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 239, 0.1);
}

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

.form-select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%234f46ef' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
    padding-right: 40px;
}

.form-hint {
    display: block;
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 6px;
    line-height: 1.4;
}

/* Buttons */
.action-buttons {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 24px;
}

.btn-primary,
.btn-secondary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 14px 28px;
    font-size: 15px;
    font-weight: 600;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    transition: var(--transition);
    
    white-space: nowrap;
}

.btn-primary {
    background: var(--primary);
    color: white;
    box-shadow: 0 4px 12px rgba(79, 70, 239, 0.2);
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(79, 70, 239, 0.3);
}

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

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

.btn-secondary {
    background: var(--surface-muted);
    color: var(--text-main);
    border: 2px solid var(--border);
}

.btn-secondary:hover {
    background: var(--border);
    border-color: var(--text-muted);
    transform: translateY(-1px);
}

/* Results Display */
.results-display {
    margin-bottom: 24px;
}

.numbers-output {
    background: var(--surface-muted);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    min-height: 120px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    justify-content: flex-start;
}

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

.empty-state i {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-state p {
    margin: 0;
    font-size: 14px;
    font-style: italic;
}


.number-item {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 16px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    color: white;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    transition: var(--transition);
    box-shadow: 0 2px 8px rgba(79, 70, 239, 0.2);
    animation: fadeInScale 0.3s ease-out;
    animation-fill-mode: both;
}

.number-item:nth-child(1) { animation-delay: 0.01s; }
.number-item:nth-child(2) { animation-delay: 0.02s; }
.number-item:nth-child(3) { animation-delay: 0.03s; }
.number-item:nth-child(4) { animation-delay: 0.04s; }
.number-item:nth-child(5) { animation-delay: 0.05s; }
.number-item:nth-child(n+6) { animation-delay: 0.06s; }

@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.number-item:hover {
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 4px 12px rgba(79, 70, 239, 0.3);
}

/* Statistics Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(196px, 1fr));
    gap: 16px;
    margin: 24px 0;
}

.stat-card {
    background: var(--surface-muted);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: var(--transition);
}

.stat-card:hover {
    border-color: var(--primary-light);
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}

.stat-icon {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    color: white;
    border-radius: var(--radius);
    font-size: 20px;
    flex-shrink: 0;
}

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

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

.stat-value {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-main);
    line-height: 1.2;
    word-break: break-word;
}

/* Toast Notification */
.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: var(--text-main);
    color: white;
    padding: 16px 24px;
    border-radius: var(--radius);
    box-shadow: var(--shadow-medium);
    display: flex;
    align-items: center;
    gap: 12px;
    z-index: 1000;
    animation: slideUp 0.3s ease-out;
    max-width: 400px;
}

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

.toast.success {
    background: var(--success);
}

.toast.error {
    background: var(--danger);
}

/* Mobile Responsive */
@media (max-width: 1024px) {
    .card-layout {
        grid-template-columns: 1fr;
        gap: 0;
    }

    .input-column {
        border-right: none;
        border-bottom: 2px solid var(--border);
        padding-right: 0;
        padding-bottom: 32px;
        margin-bottom: 32px;
    }

    .results-column {
        padding-left: 0;
    }
}

@media (max-width: 767px) {
    .hero-text h1 {
        font-size: clamp(1.75rem, 5vw, 2.5rem);
    }
    
    .hero-subtitle {
        font-size: clamp(1rem, 3vw, 1.125rem);
    }

    .tool-card {
        padding: 24px 20px;
    }

    .card-layout {
        gap: 0;
    }

    .input-column {
        padding-bottom: 24px;
        margin-bottom: 24px;
    }

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

    .form-group {
        margin-bottom: 20px;
    }

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

    .action-buttons button {
        width: 100%;
        justify-content: center;
    }

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

    .stat-card {
        flex-direction: column;
        text-align: center;
        padding: 16px;
    }

    .stat-icon {
        width: 40px;
        height: 40px;
        font-size: 18px;
    }

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

    .numbers-output {
        padding: 16px;
        gap: 8px;
    }

    .number-item {
        font-size: 14px;
        padding: 8px 14px;
    }

    .toast {
        bottom: 16px;
        right: 16px;
        left: 16px;
        max-width: none;
    }
}

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

    .tool-hero {
        margin-bottom: 1.5rem;
    }

    .number-item {
        font-size: 13px;
        padding: 7px 12px;
    }

    .form-textarea {
        font-size: 14px;
    }
}
