/* Tool Hero Section - Required by structure rules */
.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);
    }
}

/* Average Tool Styles */
.average-tool {
    margin-top: 2rem;
    margin-bottom: 3rem;
}

.tool-card {
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05), 0 1px 2px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    transition: box-shadow 0.3s ease;
}

.tool-card:hover {
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05), 0 2px 4px rgba(0, 0, 0, 0.1);
}

.tool-columns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
    min-height: 500px;
}

/* Input Column */
.input-column {
    padding: 2rem;
    border-right: 1px solid #e5e7eb;
    display: flex;
    flex-direction: column;
}

.input-section {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.input-label {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.label-text {
    font-size: 1rem;
    font-weight: 600;
    color: #1a1a1a;
}

.label-hint {
    font-size: 0.875rem;
    color: #6b7280;
}

.textarea-wrapper {
    position: relative;
    margin-bottom: 1rem;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.number-input {
    width: 100%;
    flex: 1;
    padding: 1rem;
    font-size: 0.9375rem;
    line-height: 1.6;
    color: #1a1a1a;
    background: #f9fafb;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    resize: none;
    
    transition: all 0.2s ease;
    min-height: 200px;
}

.number-input:focus {
    outline: none;
    border-color: #8b5cf6;
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.1);
}

.number-input::placeholder {
    color: #9ca3af;
}

.input-actions {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    display: flex;
    gap: 0.5rem;
}

.btn-clear {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: #6b7280;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    backdrop-filter: blur(4px);
}

.btn-clear:hover {
    color: #1a1a1a;
    background: #ffffff;
    border-color: #d1d5db;
}

.btn-clear:active {
    transform: scale(0.98);
}

.btn-clear svg {
    flex-shrink: 0;
}

.btn-calculate {
    width: 100%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.875rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    color: #ffffff;
    background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(139, 92, 246, 0.2);
    margin-top: auto;
}

.btn-calculate:hover {
    background: linear-gradient(135deg, #7c3aed 0%, #6d28d9 100%);
    box-shadow: 0 4px 8px rgba(139, 92, 246, 0.3);
    transform: translateY(-1px);
}

.btn-calculate:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(139, 92, 246, 0.2);
}

.btn-calculate svg {
    flex-shrink: 0;
    transition: transform 0.2s ease;
}

.btn-calculate:hover svg {
    transform: translateX(2px);
}

/* Results Column */
.results-column {
    padding: 2rem;
    background: linear-gradient(to bottom, #fafafa 0%, #ffffff 100%);
    display: flex;
    flex-direction: column;
    position: relative;
}

/* Empty State */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 3rem 2rem;
    height: 100%;
    min-height: 400px;
    animation: fadeIn 0.4s ease;
}

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

.empty-state-icon {
    width: 120px;
    height: 120px;
    margin-bottom: 1.5rem;
    color: #8b5cf6;
    opacity: 0.6;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 0.6;
        transform: scale(1);
    }
    50% {
        opacity: 0.8;
        transform: scale(1.05);
    }
}

.empty-state-icon svg {
    width: 100%;
    height: 100%;
}

.empty-state-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #1a1a1a;
    margin: 0 0 0.75rem 0;
}

.empty-state-description {
    font-size: 0.9375rem;
    color: #6b7280;
    line-height: 1.6;
    max-width: 400px;
    margin: 0 0 1.5rem 0;
}

.empty-state-hint {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background: #f3f4f6;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    font-size: 0.875rem;
    color: #6b7280;
    margin-top: 0.5rem;
}

.empty-state-hint svg {
    flex-shrink: 0;
    color: #8b5cf6;
}

.empty-state[style*="display: none"] {
    display: none !important;
}

.results-section {
    display: none;
    flex-direction: column;
    height: 100%;
}

.results-section[style*="display: flex"],
.results-section[style*="display:flex"] {
    display: flex !important;
}

.results-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

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

.btn-copy {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: #6b7280;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-copy:hover {
    color: #8b5cf6;
    border-color: #8b5cf6;
    background: #faf5ff;
}

.btn-copy:active {
    transform: scale(0.98);
}

.btn-copy svg {
    flex-shrink: 0;
}

/* Average Highlight */
.average-highlight {
    background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    text-align: center;
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.2);
}

.average-label {
    font-size: 0.875rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.9);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
}

.average-value {
    font-size: 2.5rem;
    font-weight: 700;
    color: #ffffff;
    line-height: 1.2;
}

/* Stats List */
.stats-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    flex: 1;
}

.stat-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.875rem 1rem;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.stat-item:hover {
    border-color: #d1d5db;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.stat-item-label {
    font-size: 0.875rem;
    font-weight: 500;
    color: #6b7280;
}

.stat-item-value {
    font-size: 1.125rem;
    font-weight: 600;
    color: #1a1a1a;
    text-align: right;
}

/* Steps Section */
.steps-section {
    border-top: 1px solid #e5e7eb;
    padding: 2rem;
    background: #fafafa;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.steps-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: #1a1a1a;
    margin: 0 0 1.5rem 0;
}

.steps-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.step-item {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 1.25rem;
    display: flex;
    gap: 1rem;
    transition: all 0.2s ease;
}

.step-item:hover {
    border-color: #d1d5db;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.step-number {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
    color: #ffffff;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 700;
}

.step-content {
    flex: 1;
}

.step-title {
    font-size: 0.9375rem;
    font-weight: 600;
    color: #1a1a1a;
    margin-bottom: 0.5rem;
}

.step-description {
    font-size: 0.875rem;
    color: #6b7280;
    line-height: 1.6;
}

.step-formula {
    margin-top: 0.5rem;
    padding: 0.75rem;
    background: #f9fafb;
    border-radius: 6px;
    
    font-size: 0.8125rem;
    color: #1a1a1a;
    border-left: 3px solid #8b5cf6;
}

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

    .input-column {
        border-right: none;
        border-bottom: 1px solid #e5e7eb;
    }

    .results-column {
        min-height: auto;
    }

    .average-value {
        font-size: 2rem;
    }
}

@media (max-width: 767px) {
    .average-tool {
        margin-top: 1.5rem;
        margin-bottom: 2rem;
    }

    .input-column,
    .results-column {
        padding: 1.5rem;
    }

    .steps-section {
        padding: 1.5rem;
    }

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

    .average-highlight {
        padding: 1.25rem;
    }

    .average-value {
        font-size: 1.75rem;
    }

    .stat-item-value {
        font-size: 1rem;
    }

    .label-text {
        font-size: 0.9375rem;
    }

    .label-hint {
        font-size: 0.8125rem;
    }

    .number-input {
        padding: 0.875rem;
        font-size: 0.875rem;
        min-height: 180px;
    }

    .btn-calculate {
        padding: 0.75rem 1.25rem;
        font-size: 0.9375rem;
    }

    .input-actions {
        top: 0.625rem;
        right: 0.625rem;
    }

    .btn-clear {
        padding: 0.375rem 0.625rem;
        font-size: 0.8125rem;
    }

    .steps-title {
        font-size: 1.125rem;
    }

    .step-item {
        padding: 1rem;
        flex-direction: column;
    }

    .step-number {
        width: 32px;
        height: 32px;
        font-size: 0.8125rem;
    }

    .empty-state {
        padding: 2rem 1.5rem;
        min-height: 300px;
    }

    .empty-state-icon {
        width: 80px;
        height: 80px;
        margin-bottom: 1.25rem;
    }

    .empty-state-title {
        font-size: 1.25rem;
    }

    .empty-state-description {
        font-size: 0.875rem;
        max-width: 100%;
    }

    .empty-state-hint {
        font-size: 0.8125rem;
        padding: 0.625rem 0.875rem;
        flex-wrap: wrap;
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .input-column,
    .results-column {
        padding: 1.25rem;
    }

    .steps-section {
        padding: 1.25rem;
    }

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

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

    .average-value {
        font-size: 1.5rem;
    }

    .empty-state {
        padding: 1.5rem 1rem;
        min-height: 250px;
    }

    .empty-state-icon {
        width: 64px;
        height: 64px;
        margin-bottom: 1rem;
    }

    .empty-state-title {
        font-size: 1.125rem;
    }

    .empty-state-description {
        font-size: 0.8125rem;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .tool-card {
        background: #1a1a1a;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3), 0 1px 2px rgba(0, 0, 0, 0.4);
    }

    .number-input {
        background: #2a2a2a;
        border-color: #3a3a3a;
        color: #e5e5e5;
    }

    .number-input:focus {
        border-color: #8b5cf6;
        background: #2a2a2a;
    }

    .label-text {
        color: #e5e5e5;
    }

    .label-hint {
        color: #9ca3af;
    }

    .input-column {
        border-right-color: #3a3a3a;
    }

    .results-column {
        background: linear-gradient(to bottom, #1a1a1a 0%, #2a2a2a 100%);
    }

    .empty-state-title {
        color: #e5e5e5;
    }

    .empty-state-description {
        color: #9ca3af;
    }

    .empty-state-hint {
        background: #2a2a2a;
        border-color: #3a3a3a;
        color: #9ca3af;
    }

    .empty-state-hint svg {
        color: #8b5cf6;
    }

    .results-title {
        color: #e5e5e5;
    }

    .stat-item {
        background: #2a2a2a;
        border-color: #3a3a3a;
    }

    .stat-item-label {
        color: #9ca3af;
    }

    .stat-item-value {
        color: #e5e5e5;
    }

    .steps-section {
        background: #1a1a1a;
        border-top-color: #3a3a3a;
    }

    .steps-title {
        color: #e5e5e5;
    }

    .step-item {
        background: #2a2a2a;
        border-color: #3a3a3a;
    }

    .step-title {
        color: #e5e5e5;
    }

    .step-description {
        color: #9ca3af;
    }

    .step-formula {
        background: #1a1a1a;
        color: #e5e5e5;
        border-left-color: #8b5cf6;
    }

    .btn-copy {
        background: #2a2a2a;
        border-color: #3a3a3a;
        color: #9ca3af;
    }

    .btn-copy:hover {
        background: #3a3a3a;
        border-color: #8b5cf6;
        color: #8b5cf6;
    }

    .btn-clear {
        background: rgba(42, 42, 42, 0.9);
        border-color: #3a3a3a;
        color: #9ca3af;
    }

    .btn-clear:hover {
        background: #2a2a2a;
        border-color: #4a4a4a;
        color: #e5e5e5;
    }
}
