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

:root {
    --primary-color: #4f46e5;
    --primary-hover: #4338ca;
    --success-color: #10b981;
    --error-color: #ef4444;
    --bg-color: #f8fafc;
    --card-bg: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
    --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.6;
}

.container {
    max-width: 100%;
    margin: 0;
    padding: 1rem;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

header {
    text-align: center;
    margin-bottom: 1rem;
    flex-shrink: 0;
}

h1 {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 0.25rem;
}

.subtitle {
    font-size: 1rem;
    color: var(--text-secondary);
}

.converter-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    flex: 1;
    overflow: hidden;
}

.input-section,
.output-section {
    background: var(--card-bg);
    border-radius: 8px;
    padding: 0.75rem;
    box-shadow: var(--shadow-lg);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.section-header h2 {
    font-size: 1.125rem;
    font-weight: 600;
}

.output-controls,
.input-controls {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

textarea {
    width: 100%;
    flex: 1;
    padding: 0.75rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-family: 'Monaco', 'Courier New', monospace;
    font-size: 0.875rem;
    resize: none;
    transition: border-color 0.2s;
}

textarea:focus {
    outline: none;
    border-color: var(--primary-color);
}

textarea[readonly] {
    background-color: #f9fafb;
}

.file-upload {
    margin-top: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.file-label {
    display: inline-block;
    padding: 0.5rem 1rem;
    background-color: var(--bg-color);
    border: 2px solid var(--border-color);
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.875rem;
    transition: all 0.2s;
}

.file-label:hover {
    border-color: var(--primary-color);
    background-color: #f1f5f9;
}

input[type="file"] {
    font-size: 0.875rem;
    padding: 0.5rem;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    background-color: var(--bg-color);
    cursor: pointer;
    transition: all 0.2s;
}

input[type="file"]:hover {
    border-color: var(--primary-color);
    background-color: #f1f5f9;
}

input[type="file"]::file-selector-button {
    padding: 0.35rem 0.75rem;
    margin-right: 0.5rem;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 500;
    font-size: 0.75rem;
    transition: background-color 0.2s;
}

input[type="file"]::file-selector-button:hover {
    background-color: var(--primary-hover);
}

.controls {
    display: flex;
    gap: 1rem;
    justify-content: space-between;
    align-items: center;
    margin-top: 0.5rem;
    flex-shrink: 0;
}

.convert-btn {
    padding: 0.75rem 1.5rem;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: var(--shadow);
    white-space: nowrap;
}

.convert-btn:hover {
    background-color: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.convert-btn:active {
    transform: translateY(0);
}

.secondary-btn {
    padding: 0.75rem 1.5rem;
    background-color: var(--bg-color);
    color: var(--text-primary);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.secondary-btn:hover {
    border-color: var(--primary-color);
    background-color: #f1f5f9;
}

.clear-btn,
.action-btn {
    padding: 0.5rem 1rem;
    background-color: var(--bg-color);
    color: var(--text-primary);
    border: 2px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.clear-btn:hover,
.action-btn:hover {
    border-color: var(--primary-color);
    background-color: #f1f5f9;
}

.info-section {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 2rem;
    box-shadow: var(--shadow-lg);
    margin-bottom: 2rem;
    display: none;
}

.info-section h3 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--primary-color);
}

.info-section p {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

.example {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-top: 1rem;
}

.example-block {
    background-color: var(--bg-color);
    padding: 1rem;
    border-radius: 8px;
    border: 2px solid var(--border-color);
}

.example-block strong {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.example-block pre {
    margin: 0;
}

.example-block code {
    font-family: 'Monaco', 'Courier New', monospace;
    font-size: 0.875rem;
    color: var(--text-primary);
}

footer {
    text-align: center;
    padding: 0.5rem 0;
    color: var(--text-secondary);
    font-size: 0.75rem;
    flex-shrink: 0;
}

footer a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
}

footer a:hover {
    text-decoration: underline;
}

/* Toast notification styles */
.toast {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    padding: 1rem 1.5rem;
    background-color: var(--success-color);
    color: white;
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    font-weight: 500;
    animation: slideIn 0.3s ease-out;
    z-index: 1000;
}

.toast.error {
    background-color: var(--error-color);
}

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

/* Responsive design */
@media (max-width: 1024px) {
    .converter-container {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .controls {
        padding-top: 0;
    }

    .convert-btn {
        width: 100%;
    }

    .example {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    .container {
        padding: 1rem;
    }

    h1 {
        font-size: 2rem;
    }

    textarea {
        min-height: 300px;
    }

    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .output-controls {
        width: 100%;
    }

    .action-btn {
        flex: 1;
    }
}
