/* 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: #f5f5f5;
}

/* Header */
.header {
    background: linear-gradient(135deg, #006B6B 0%, #008080 100%);
    color: white;
    padding: 2rem 1rem;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.header-content {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.logo-section {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    flex: 1;
}

.logo {
    height: 60px;
    width: auto;
    border-radius: 8px;
    background: white;
    padding: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.title-section h1 {
    font-size: 2.5rem;
    margin: 0 0 0.5rem 0;
    font-weight: 600;
}

.title-section p {
    font-size: 1.1rem;
    opacity: 0.9;
    margin: 0;
}

.website-link {
    flex-shrink: 0;
}

.website-link a {
    color: white;
    text-decoration: none;
    font-size: 1.1rem;
    font-weight: 500;
    padding: 0.75rem 1.5rem;
    border: 2px solid rgba(255,255,255,0.3);
    border-radius: 25px;
    transition: all 0.3s ease;
    background: rgba(255,255,255,0.1);
    backdrop-filter: blur(10px);
}

.website-link a:hover {
    background: rgba(255,255,255,0.2);
    border-color: rgba(255,255,255,0.6);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

/* Main Container */
.main-container {
    max-width: 1400px;
    margin: 2rem auto;
    padding: 0 1rem;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
}

/* Section Styles */
.encoder-section,
.decoder-section {
    background: white;
    border-radius: 12px;
    padding: 2rem;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    border: 1px solid #e1e5e9;
}

.encoder-section h2,
.decoder-section h2 {
    font-size: 1.8rem;
    margin-bottom: 1.5rem;
    color: #2c3e50;
    border-bottom: 3px solid #667eea;
    padding-bottom: 0.5rem;
}

/* Tab Navigation */
.tab-navigation {
    display: flex;
    margin-bottom: 1.5rem;
    border-bottom: 2px solid #e1e5e9;
}

.tab-btn {
    background: none;
    border: none;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    cursor: pointer;
    color: #666;
    border-bottom: 3px solid transparent;
    transition: all 0.3s ease;
}

.tab-btn:hover {
    color: #667eea;
    background-color: #f8f9fa;
}

.tab-btn.active {
    color: #667eea;
    border-bottom-color: #667eea;
    font-weight: 600;
}

/* Tab Content */
.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Input Groups */
.input-group,
.output-group {
    margin-bottom: 1.5rem;
}

.input-group label,
.output-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: #2c3e50;
}

/* Textarea Styles */
textarea {
    width: 100%;
    padding: 1rem;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.9rem;
    line-height: 1.5;
    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::placeholder {
    color: #999;
}

/* Character Count */
.char-count {
    font-size: 0.85rem;
    color: #666;
    margin-top: 0.25rem;
    text-align: right;
}

/* File Upload Area */
.file-upload-area {
    border: 2px dashed #ccc;
    border-radius: 8px;
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background-color: #fafafa;
}

.file-upload-area:hover {
    border-color: #667eea;
    background-color: #f0f4ff;
}

.file-upload-area.dragover {
    border-color: #667eea;
    background-color: #e8f0ff;
    transform: scale(1.02);
}

.upload-content .upload-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.upload-content p {
    margin: 0.5rem 0;
    color: #666;
}

.file-info {
    font-size: 0.85rem;
    color: #999;
}

/* File Details */
.file-details {
    background-color: #f8f9fa;
    border: 1px solid #e1e5e9;
    border-radius: 8px;
    padding: 1rem;
    margin-top: 1rem;
}

.file-info-display {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    margin-bottom: 1rem;
}

.file-name {
    font-weight: 600;
    color: #2c3e50;
}

.file-size,
.file-type {
    font-size: 0.85rem;
    color: #666;
}

/* Buttons */
button {
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 500;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    padding: 0.75rem 1.5rem;
}

.clear-btn {
    background-color: #6c757d;
    color: white;
    margin-top: 0.5rem;
}

.clear-btn:hover {
    background-color: #5a6268;
    transform: translateY(-1px);
}

.action-buttons {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
}

.copy-btn {
    background-color: #28a745;
    color: white;
    flex: 1;
}

.copy-btn:hover {
    background-color: #218838;
    transform: translateY(-1px);
}

.download-btn {
    background-color: #007bff;
    color: white;
    flex: 1;
}

.download-btn:hover:not(:disabled) {
    background-color: #0056b3;
    transform: translateY(-1px);
}

.download-btn:disabled {
    background-color: #ccc;
    cursor: not-allowed;
    transform: none;
}

/* Error Message */
.error-message {
    background-color: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
    padding: 1rem;
    border-radius: 8px;
    margin-top: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.error-icon {
    font-size: 1.2rem;
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    color: white;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top: 4px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

/* Footer */
.footer {
    background: #2c3e50;
    color: #ecf0f1;
    text-align: center;
    padding: 2rem 1rem;
    margin-top: 3rem;
}

.footer-content {
    max-width: 1400px;
    margin: 0 auto;
}

.footer p {
    margin: 0.5rem 0;
    font-size: 0.95rem;
}

.footer a {
    color: #3498db;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s ease;
}

.footer a:hover {
    color: #5dade2;
    text-decoration: underline;
}

.footer-note {
    opacity: 0.8;
    font-size: 0.85rem;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .main-container {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .header h1 {
        font-size: 2rem;
    }
}

@media (max-width: 768px) {
    .main-container {
        margin: 1rem auto;
        padding: 0 0.5rem;
    }
    
    .encoder-section,
    .decoder-section {
        padding: 1.5rem;
    }
    
    .header {
        padding: 1.5rem 1rem;
    }
    
    .header-content {
        flex-direction: column;
        text-align: center;
        gap: 1.5rem;
    }
    
    .logo-section {
        flex-direction: column;
        gap: 1rem;
    }
    
    .title-section h1 {
        font-size: 1.8rem;
    }
    
    .logo {
        height: 50px;
    }
    
    .action-buttons {
        flex-direction: column;
    }
    
    .tab-btn {
        padding: 0.5rem 1rem;
        font-size: 0.9rem;
    }
}

@media (max-width: 480px) {
    .file-upload-area {
        padding: 1.5rem 1rem;
    }
    
    .upload-content .upload-icon {
        font-size: 2rem;
    }
    
    textarea {
        font-size: 0.85rem;
    }
}