/* Tool Hero Section - Required by tool-page-structure.mdc */
.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;
}

.hero-subtitle {
    font-size: 18px;
    color: var(--text-muted);
    max-width: 640px;
    margin-bottom: 1rem;
    margin-top: 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);
    }
}

/* Median Calculator Styles */
.median-calculator {
    margin-top: 2rem;
    margin-bottom: 2rem;
}

.calculator-wrapper {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* Input Panel */
.input-panel {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 20px;
    padding: 2rem;
    box-shadow: 0 10px 40px rgba(102, 126, 234, 0.25);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.input-panel:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 48px rgba(102, 126, 234, 0.3);
}

.panel-header {
    margin-bottom: 1.5rem;
}

.panel-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #ffffff;
    margin: 0 0 0.5rem 0;
}

.panel-description {
    font-size: 0.9375rem;
    color: rgba(255, 255, 255, 0.9);
    margin: 0;
}

.input-container {
    background: #ffffff;
    border-radius: 16px;
    padding: 1.5rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.number-textarea {
    width: 100%;
    min-height: 180px;
    padding: 1.25rem;
    border: 2px solid #e1e8ed;
    border-radius: 12px;
    font-size: 1rem;
    
    line-height: 1.8;
    resize: vertical;
    transition: all 0.3s ease;
    background: #ffffff;
    color: #1a1a1a;
    box-sizing: border-box;
}

.number-textarea:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
}

.number-textarea::placeholder {
    color: #adb5bd;
}

.input-footer {
    display: flex;
    gap: 0.75rem;
    margin-top: 1.25rem;
    flex-wrap: wrap;
}

.btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.9375rem 2rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #ffffff;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(102, 126, 234, 0.5);
}

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

.btn-secondary {
    padding: 0.9375rem 2rem;
    background: #f8f9fa;
    color: #495057;
    border: 2px solid #e9ecef;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

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

.btn-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

/* Results Panel */
.results-panel {
    background: #ffffff;
    border-radius: 20px;
    padding: 2rem;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
    border: 1px solid #e9ecef;
    animation: slideIn 0.4s ease;
}

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

.results-panel .panel-header {
    margin-bottom: 1.5rem;
}

.results-panel .panel-title {
    color: #1a1a1a;
    font-size: 1.5rem;
}

/* Median Display */
.median-display {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    border-radius: 16px;
    padding: 2.5rem 2rem;
    text-align: center;
    margin-bottom: 2rem;
    box-shadow: 0 8px 24px rgba(245, 87, 108, 0.2);
}

.median-badge {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.badge-label {
    font-size: 0.875rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.95);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.median-number {
    font-size: 3.5rem;
    font-weight: 800;
    color: #ffffff;
    line-height: 1;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    min-height: 4rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.median-info {
    font-size: 1rem;
    color: rgba(255, 255, 255, 0.95);
    font-weight: 500;
    margin-top: 0.5rem;
}

/* Sorted Display */
.sorted-display {
    margin-bottom: 2rem;
}

.sorted-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: #1a1a1a;
    margin-bottom: 1rem;
}

.sorted-container {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 1.25rem;
    background: #f8f9fa;
    border-radius: 12px;
    border: 1px solid #e9ecef;
    min-height: 60px;
    align-items: center;
    justify-content: flex-start;
}

.number-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.625rem 1rem;
    background: #ffffff;
    border: 2px solid #dee2e6;
    border-radius: 8px;
    font-size: 0.9375rem;
    font-weight: 600;
    color: #495057;
    transition: all 0.2s ease;
    min-width: 48px;
}

.number-chip.median-chip {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    border-color: #f5576c;
    color: #ffffff;
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(245, 87, 108, 0.3);
    z-index: 1;
    position: relative;
}

.number-chip.median-chip::after {
    content: 'MEDIAN';
    position: absolute;
    top: -8px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.625rem;
    font-weight: 700;
    background: #f5576c;
    color: #ffffff;
    padding: 0.125rem 0.5rem;
    border-radius: 4px;
    white-space: nowrap;
}

.number-chip.median-chip-even {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    border-color: #00f2fe;
    color: #ffffff;
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(79, 172, 254, 0.3);
    z-index: 1;
    position: relative;
}

.number-chip.median-chip-even::after {
    content: 'MEDIAN';
    position: absolute;
    top: -8px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.625rem;
    font-weight: 700;
    background: #00f2fe;
    color: #ffffff;
    padding: 0.125rem 0.5rem;
    border-radius: 4px;
    white-space: nowrap;
}

/* Details Grid */
.details-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
    padding: 1.5rem;
    background: #f8f9fa;
    border-radius: 12px;
}

.detail-item {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 1rem;
    background: #ffffff;
    border-radius: 10px;
    border: 1px solid #e9ecef;
    transition: all 0.2s ease;
}

.detail-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    border-color: #dee2e6;
}

.detail-label {
    font-size: 0.8125rem;
    color: #6c757d;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.detail-value {
    font-size: 1.375rem;
    font-weight: 700;
    color: #1a1a1a;
}

/* Action Bar */
.action-bar {
    display: flex;
    justify-content: center;
    padding-top: 1.5rem;
    border-top: 1px solid #e9ecef;
}

.btn-copy {
    display: inline-flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.9375rem 2rem;
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
    color: #ffffff;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(17, 153, 142, 0.3);
}

.btn-copy:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(17, 153, 142, 0.4);
}

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

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

/* Mobile Responsive */
@media (max-width: 767px) {
    .input-panel {
        padding: 1.5rem;
        border-radius: 16px;
    }

    .panel-title {
        font-size: 1.25rem;
    }

    .input-container {
        padding: 1.25rem;
    }

    .number-textarea {
        min-height: 150px;
        font-size: 0.9375rem;
    }

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

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

    .results-panel {
        padding: 1.5rem;
        border-radius: 16px;
    }

    .median-display {
        padding: 2rem 1.5rem;
    }

    .median-number {
        font-size: 2.5rem;
    }

    .sorted-container {
        padding: 1rem;
        gap: 0.375rem;
    }

    .number-chip {
        padding: 0.5rem 0.875rem;
        font-size: 0.875rem;
        min-width: 44px;
    }

    .details-grid {
        grid-template-columns: 1fr;
        padding: 1.25rem;
    }

    .detail-item {
        padding: 0.875rem;
    }

    .detail-value {
        font-size: 1.25rem;
    }

    .action-bar {
        padding-top: 1.25rem;
    }

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

@media (max-width: 480px) {
    .median-number {
        font-size: 2rem;
    }

    .number-chip.median-chip,
    .number-chip.median-chip-even {
        transform: scale(1.05);
    }

    .sorted-container {
        justify-content: center;
    }
}

/* Scrollbar Styling */
.sorted-container {
    max-height: 200px;
    overflow-y: auto;
}

.sorted-container::-webkit-scrollbar {
    height: 8px;
}

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

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

.sorted-container::-webkit-scrollbar-thumb:hover {
    background: #868e96;
}
