* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: white;
    min-height: 100vh;
    padding: 20px;
    color: #333;
}

.container {
    max-width: 1000px;
    margin: 0 auto;
    overflow: hidden;
}

header {
    background: white;
    color: #333;
    padding: 40px 30px;
    text-align: center;
}

header h1 {
    font-size: 2.5em;
    margin-bottom: 10px;
    font-weight: 700;
}

header p {
    font-size: 1.1em;
    opacity: 0.9;
}

main {
    padding: 30px;
}

/* Tabs */
.tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 30px;
    border-bottom: 2px solid #eee;
}

.tab-button {
    padding: 12px 24px;
    border: none;
    background: none;
    cursor: pointer;
    font-size: 1em;
    font-weight: 600;
    color: #666;
    border-bottom: 3px solid transparent;
    transition: all 0.3s ease;
    margin-bottom: -2px;
}

.tab-button:hover {
    color: #667eea;
}

.tab-button.active {
    color: #667eea;
    border-bottom-color: #667eea;
}

/* Tab Content */
.tab-content {
    display: none;
    animation: fadeIn 0.3s ease;
}

.tab-content.active {
    display: block;
}

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

/* Method Tabs (Encoder) */
.input-method-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 1px solid #eee;
}

.method-button {
    padding: 8px 16px;
    border: 1px solid #ddd;
    background: #f5f5f5;
    cursor: pointer;
    font-size: 0.95em;
    font-weight: 500;
    color: #666;
    border-radius: 6px;
    transition: all 0.3s ease;
}

.method-button:hover {
    background: #e8e8e8;
    border-color: #ccc;
}

.method-button.active {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

.method-content {
    display: none;
}

.method-content.active {
    display: block;
}

/* Form Elements */
.form-group {
    margin-bottom: 20px;
}

label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #333;
}

textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.95em;
    resize: vertical;
    transition: border-color 0.3s ease;
}

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

textarea:disabled {
    background: #f5f5f5;
    color: #666;
}

input[type="file"] {
    padding: 12px;
    border: 2px dashed #ddd;
    border-radius: 6px;
    cursor: pointer;
    width: 100%;
    transition: border-color 0.3s ease;
}

input[type="file"]:hover {
    border-color: #667eea;
}

select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 0.95em;
    background: white;
    cursor: pointer;
    transition: border-color 0.3s ease;
}

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

/* Checkbox Group */
.checkbox-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.checkbox-group label {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    font-weight: 500;
    color: #666;
}

.checkbox-group input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: #667eea;
}

/* Counter and Info Text */
.char-count {
    display: flex;
    gap: 20px;
    margin-top: 8px;
    font-size: 0.85em;
    color: #666;
}

.file-info {
    display: flex;
    gap: 20px;
    margin-top: 12px;
    padding: 10px;
    background: #f9f9f9;
    border-radius: 6px;
    font-size: 0.9em;
}

.validation-message {
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 0.9em;
    font-weight: 500;
}

.validation-message.valid {
    background: #d4edda;
    color: #155724;
}

.validation-message.invalid {
    background: #f8d7da;
    color: #721c24;
}

.help-text {
    font-size: 0.85em;
    color: #666;
    margin-top: 4px;
    font-weight: normal;
}

/* Options Section */
.options {
    background: #f9f9f9;
    padding: 20px;
    border-radius: 8px;
    margin: 25px 0;
    border-left: 4px solid #667eea;
}

/* Buttons */
.primary-button {
    width: 100%;
    padding: 14px 20px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 1.05em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin: 20px 0;
}

.primary-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(102, 126, 234, 0.3);
}

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

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

.secondary-button {
    padding: 8px 16px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 0.9em;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.secondary-button:hover {
    background: #764ba2;
    transform: translateY(-2px);
}

.secondary-button:active {
    transform: translateY(0);
}

/* Output Section */
.output-section {
    margin-top: 30px;
    padding-top: 30px;
    border-top: 2px solid #eee;
}

.output-actions {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}

/* Containers */
.encoder-container,
.decoder-container {
    animation: slideIn 0.3s ease;
}

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

/* Footer */
footer {
    background: #f5f5f5;
    text-align: center;
    padding: 20px;
    color: #666;
    font-size: 0.9em;
}

/* Responsive */
@media (max-width: 768px) {
    header {
        padding: 25px 20px;
    }

    header h1 {
        font-size: 2em;
    }

    main {
        padding: 20px;
    }

    .tabs {
        flex-wrap: wrap;
    }

    .tab-button {
        padding: 10px 16px;
        font-size: 0.95em;
    }

    .char-count,
    .file-info {
        flex-direction: column;
        gap: 8px;
    }

    .output-actions {
        flex-direction: column;
    }

    .secondary-button {
        width: 100%;
    }
}

/* Status Messages */
.success-message {
    background: #d4edda;
    color: #155724;
    padding: 12px 16px;
    border-radius: 6px;
    margin-bottom: 15px;
    border-left: 4px solid #28a745;
}

.error-message {
    background: #f8d7da;
    color: #721c24;
    padding: 12px 16px;
    border-radius: 6px;
    margin-bottom: 15px;
    border-left: 4px solid #dc3545;
}
