/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f8f9fa;
}

/* Main Tool Container */
.html-encoder-decoder-tool {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.tool-container {
    width: 100%;
}

/* Header */
.tool-header {
    text-align: center;
    margin-bottom: 30px;
}

.tool-header h1 {
    font-size: 2rem;
    font-weight: 700;
    color: #2c3e50;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.tool-header h1 i {
    color: #007bff;
}

.tool-description {
    font-size: 1.1rem;
    color: #6c757d;
    max-width: 700px;
    margin: 0 auto;
    line-height: 1.6;
}

/* Converter Interface */
.converter-interface {
    margin-bottom: 30px;
}

.converter-card {
    background: white;
    border-radius: 8px;
    padding: 25px;
    
}

/* Operation Mode Section */
.operation-mode {
    margin-bottom: 25px;
}

.operation-mode h2 {
    font-size: 1.3rem;
    color: #2c3e50;
    margin-bottom: 15px;
    text-align: center;
}

.mode-options {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.mode-option {
    display: flex;
    flex-direction: column;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.mode-option:hover {
    background: #e9ecef;
}

.mode-option input[type="radio"] {
    margin-bottom: 8px;
    transform: scale(1.2);
}

.mode-label {
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 5px;
}

.mode-description {
    font-size: 0.9rem;
    color: #6c757d;
}

/* Converter Content */
.converter-content {
    display: block;
}

.input-section,
.output-section {
    margin-bottom: 20px;
}

.section-label {
    display: block;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 8px;
    font-size: 1.1rem;
}

.text-area {
    width: 100%;
    padding: 12px;
    border: 2px solid #e9ecef;
    border-radius: 6px;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    line-height: 1.5;
    resize: vertical;
    transition: border-color 0.2s ease;
}

.text-area:focus {
    outline: none;
    border-color: #007bff;
}

.text-area[readonly] {
    background-color: #f8f9fa;
}

/* Output Container */
.output-container {
    position: relative;
}

.btn-copy {
    position: absolute;
    top: 8px;
    right: 8px;
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 6px 10px;
    font-size: 0.85rem;
    background: #6c757d;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.btn-copy:hover {
    background: #5a6268;
}

.btn-copy svg {
    width: 14px;
    height: 14px;
}

/* Controls */
.controls {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin: 20px 0;
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
}

.btn-primary {
    background: #007bff;
    color: white;
}

.btn-primary:hover {
    background: #0056b3;
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #5a6268;
}

/* SEO Content Section */
.seo-content {
    background: white;
    margin-top: 30px;
    border-radius: 8px;
}

.content-container {
    padding: 30px;
}

.content-section {
    margin-bottom: 30px;
}

.content-section:last-child {
    margin-bottom: 0;
}

.content-section h2 {
    font-size: 1.8rem;
    color: #2c3e50;
    margin-bottom: 20px;
    border-bottom: 2px solid #007bff;
    padding-bottom: 10px;
}

.content-section h3 {
    font-size: 1.3rem;
    color: #2c3e50;
    margin-bottom: 12px;
    margin-top: 20px;
}

.content-section h4 {
    font-size: 1.1rem;
    color: #2c3e50;
    margin-bottom: 10px;
    margin-top: 15px;
}

.content-section p {
    color: #555;
    margin-bottom: 15px;
    line-height: 1.6;
}

.content-section ul,
.content-section ol {
    color: #555;
    padding-left: 20px;
    margin-bottom: 15px;
}

.content-section li {
    margin-bottom: 8px;
    line-height: 1.5;
}

.content-section li strong {
    color: #2c3e50;
}

/* Entities Table */
.entities-table {
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: #f8f9fa;
    padding: 20px;
    border-radius: 6px;
}

.entity-row {
    display: flex;
    align-items: center;
    gap: 15px;
    font-family: 'Courier New', monospace;
    font-size: 1rem;
}

.character,
.entity {
    background: white;
    padding: 8px 12px;
    border-radius: 4px;
    font-weight: 600;
}

.character {
    color: #dc3545;
    min-width: 40px;
    text-align: center;
}

.entity {
    color: #28a745;
    flex: 1;
}

.arrow {
    color: #6c757d;
    font-weight: bold;
}

/* Related Tools Section */
.related-tools-section {
    background: white;
    border-radius: 12px;
    padding: 2rem;
    margin-top: 2rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    border: 1px solid #e5e7eb;
}

.related-tools-header {
    text-align: center;
    margin-bottom: 1.5rem;
}

.related-tools-header h3 {
    font-size: 1.25rem;
    font-weight: 700;
    color: #2c3e50;
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.related-tools-header h3 i {
    color: #007bff;
}

.related-tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 0.75rem;
}

.related-tool-link {
    background: #f8fafc;
    color: #007bff;
    text-decoration: none;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    text-align: center;
    font-weight: 500;
    transition: all 0.2s ease-in-out;
    border: 1px solid #e5e7eb;
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.related-tool-link:hover {
    background: #007bff;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.related-tool-link i {
    font-size: 0.875rem;
}

/* Tablet Styles */
@media (min-width: 768px) {
    .container {
        padding: 30px;
    }
    
    .tool-header h1 {
        font-size: 2.5rem;
    }
    
    .mode-options {
        flex-direction: row;
        gap: 20px;
    }
    
    .mode-option {
        flex: 1;
    }
    
    .controls {
        flex-direction: row;
        justify-content: center;
        gap: 15px;
    }
    
    .btn {
        min-width: 140px;
    }
    
    .entities-table {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
        gap: 15px;
    }

    .related-tools-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.5rem;
    }

    .related-tool-link {
        padding: 0.625rem 0.75rem;
        font-size: 0.875rem;
    }
}

/* Desktop Styles */
@media (min-width: 1024px) {
    .html-encoder-decoder-tool {
        padding: 30px;
    }

    .converter-card {
        padding: 35px;
    }

    .converter-content {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 25px;
        align-items: start;
    }

    .input-section,
    .output-section {
        margin-bottom: 0;
    }

    .controls {
        grid-column: 1 / -1;
        justify-content: center;
        margin: 25px 0 0 0;
    }

    .content-container {
        padding: 40px;
    }
}

/* Success/Error States */
.success-message {
    background: #d4edda;
    color: #155724;
    padding: 10px 15px;
    border-radius: 4px;
    margin-bottom: 15px;
    font-size: 0.9rem;
}

.error-message {
    background: #f8d7da;
    color: #721c24;
    padding: 10px 15px;
    border-radius: 4px;
    margin-bottom: 15px;
    font-size: 0.9rem;
}

/* Loading State */
.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Focus Styles for Accessibility */
.btn:focus,
.text-area:focus,
.mode-option:focus-within {
    outline: 2px solid #007bff;
    outline-offset: 2px;
}

/* Small Mobile Devices */
@media (max-width: 480px) {
    .related-tools-section {
        padding: 1rem;
    }

    .related-tools-grid {
        grid-template-columns: 1fr;
    }
}
