/* 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);
    }
}

/* Normalize Tool Section */
.normalize-tool-section {
    margin-bottom: 3rem;
}

.normalize-card {
    background: #ffffff;
    border-radius: 20px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
    overflow: hidden;
    border: 1px solid #e5e7eb;
    transition: box-shadow 0.3s ease;
}

.normalize-card:hover {
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.1);
}

/* Header */
.normalize-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.5rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #ffffff;
}

.header-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    flex-shrink: 0;
}

.header-content {
    flex: 1;
}

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

.normalize-subtitle {
    font-size: 0.9375rem;
    margin: 0;
    opacity: 0.9;
    color: #ffffff;
}

/* Controls */
.normalize-controls {
    padding: 1.5rem;
    background: #f9fafb;
    border-bottom: 1px solid #e5e7eb;
    display: grid;
    gap: 1.5rem;
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.control-label {
    font-size: 0.875rem;
    font-weight: 600;
    color: #374151;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.radio-group {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}

.radio-option {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    padding: 0.625rem 1rem;
    background: #ffffff;
    border: 2px solid #e5e7eb;
    border-radius: 10px;
    transition: all 0.2s ease;
    flex: 1;
    min-width: 140px;
}

.radio-option:hover {
    border-color: #667eea;
    background: #f3f4f6;
}

.radio-option input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.radio-custom {
    width: 20px;
    height: 20px;
    border: 2px solid #d1d5db;
    border-radius: 50%;
    position: relative;
    flex-shrink: 0;
    transition: all 0.2s ease;
}

.radio-option input[type="radio"]:checked + .radio-custom {
    border-color: #667eea;
    background: #667eea;
}

.radio-option input[type="radio"]:checked + .radio-custom::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 8px;
    height: 8px;
    background: #ffffff;
    border-radius: 50%;
}

.radio-text {
    font-weight: 500;
    color: #1f2937;
    font-size: 0.9375rem;
}

.radio-hint {
    font-size: 0.8125rem;
    color: #6b7280;
    margin-left: auto;
}

.radio-option input[type="radio"]:checked ~ .radio-text {
    color: #667eea;
    font-weight: 600;
}

.checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.checkbox-option {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    padding: 0.75rem;
    background: #ffffff;
    border: 2px solid #e5e7eb;
    border-radius: 10px;
    transition: all 0.2s ease;
}

.checkbox-option:hover {
    border-color: #667eea;
    background: #f3f4f6;
}

.checkbox-option input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.checkbox-custom {
    width: 20px;
    height: 20px;
    border: 2px solid #d1d5db;
    border-radius: 6px;
    position: relative;
    flex-shrink: 0;
    transition: all 0.2s ease;
    background: #ffffff;
}

.checkbox-option input[type="checkbox"]:checked + .checkbox-custom {
    border-color: #667eea;
    background: #667eea;
}

.checkbox-option input[type="checkbox"]:checked + .checkbox-custom::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #ffffff;
    font-size: 14px;
    font-weight: bold;
}

.checkbox-text {
    font-weight: 500;
    color: #1f2937;
    font-size: 0.9375rem;
}

.checkbox-option input[type="checkbox"]:checked ~ .checkbox-text {
    color: #667eea;
    font-weight: 600;
}

/* Input/Output Panels */
.normalize-io-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    padding: 1.5rem;
}

.io-panel {
    display: flex;
    flex-direction: column;
}

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

.panel-title {
    font-size: 1rem;
    font-weight: 600;
    color: #1f2937;
    margin: 0;
}

.panel-actions {
    display: flex;
    gap: 0.5rem;
}

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

.action-btn:hover {
    background: #f3f4f6;
    border-color: #9ca3af;
    color: #374151;
    transform: translateY(-1px);
}

.action-btn.primary {
    background: #667eea;
    border-color: #667eea;
    color: #ffffff;
}

.action-btn.primary:hover {
    background: #5568d3;
    border-color: #5568d3;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

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

.textarea-wrapper {
    position: relative;
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 300px;
}

.base64-textarea {
    width: 100%;
    flex: 1;
    min-height: 300px;
    padding: 1rem;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', 'Consolas', 'source-code-pro', monospace;
    font-size: 0.875rem;
    line-height: 1.6;
    resize: vertical;
    background: #ffffff;
    color: #1f2937;
    transition: border-color 0.2s ease;
}

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

.base64-textarea[readonly] {
    background: #f9fafb;
    cursor: default;
}

.char-count {
    position: absolute;
    bottom: 0.75rem;
    right: 1rem;
    font-size: 0.75rem;
    color: #6b7280;
    background: rgba(255, 255, 255, 0.9);
    padding: 0.25rem 0.5rem;
    border-radius: 6px;
    pointer-events: none;
}

.output-panel .char-count {
    background: rgba(249, 250, 251, 0.9);
}

/* Status */
.normalize-status {
    padding: 1.5rem;
    background: #f9fafb;
    border-top: 1px solid #e5e7eb;
    display: none;
}

.normalize-status.active {
    display: block;
}

.status-content {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: #d1fae5;
    color: #065f46;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 600;
    width: fit-content;
}

.status-badge svg {
    width: 16px;
    height: 16px;
}

.status-info {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.status-info-item {
    padding: 0.75rem;
    background: #ffffff;
    border-left: 3px solid #667eea;
    border-radius: 8px;
    font-size: 0.875rem;
    color: #374151;
}

.status-info-item strong {
    color: #1f2937;
    font-weight: 600;
}

.changes-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.change-item {
    padding: 0.625rem 0.875rem;
    background: #eff6ff;
    border-left: 3px solid #3b82f6;
    border-radius: 6px;
    font-size: 0.875rem;
    color: #1e40af;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .normalize-header {
        padding: 1.25rem;
        flex-direction: column;
        align-items: flex-start;
    }

    .header-icon {
        width: 40px;
        height: 40px;
    }

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

    .normalize-subtitle {
        font-size: 0.875rem;
    }

    .normalize-controls {
        padding: 1.25rem;
        gap: 1.25rem;
    }

    .radio-group {
        flex-direction: column;
    }

    .radio-option {
        min-width: 100%;
    }

    .normalize-io-container {
        grid-template-columns: 1fr;
        padding: 1.25rem;
        gap: 1.25rem;
    }

    .textarea-wrapper {
        min-height: 250px;
    }

    .base64-textarea {
        min-height: 250px;
        font-size: 0.8125rem;
    }

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

    .panel-actions {
        width: 100%;
    }

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

    .normalize-status {
        padding: 1.25rem;
    }
}

@media (max-width: 480px) {
    .normalize-card {
        border-radius: 16px;
    }

    .normalize-header {
        padding: 1rem;
    }

    .normalize-controls {
        padding: 1rem;
    }

    .normalize-io-container {
        padding: 1rem;
    }

    .base64-textarea {
        padding: 0.875rem;
        font-size: 0.75rem;
    }

    .char-count {
        font-size: 0.6875rem;
        padding: 0.25rem 0.375rem;
    }
}
