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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    margin: 0;
    color: #e4e7eb;
    background: linear-gradient(135deg, #0a0e1a 0%, #1a1d2e 100%);
    min-height: 100vh;
}

header {
    padding: 20px 24px;
    background: rgba(10, 14, 26, 0.9);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(99, 102, 241, 0.15);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

header h1 {
    margin: 0 0 4px;
    font-size: 22px;
    font-weight: 700;
    background: linear-gradient(135deg, #818cf8 0%, #c084fc 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

header h1 .emoji {
    background: none !important;
    -webkit-background-clip: initial !important;
    -webkit-text-fill-color: initial !important;
    background-clip: initial !important;
    color: inherit !important;
    filter: none !important;
}

header p {
    margin: 0;
    opacity: 0.7;
    font-size: 12px;
}

main {
    padding: 24px;
    max-width: 1400px;
    margin: 0 auto;
}

.options-container {
    margin-top: 24px;
    display: flex;
    justify-content: center;
}

.io {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    align-items: start;
}

.inputs, .outputs {
    background: rgba(15, 19, 32, 0.6);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(99, 102, 241, 0.2);
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    transition: border-color 0.3s ease;
    min-width: 0;
    overflow: hidden;
}

.inputs:hover, .outputs:hover {
    border-color: rgba(99, 102, 241, 0.4);
}

.output-tabs {
    display: flex;
    gap: 8px;
}

.tab-btn {
    padding: 8px 16px;
    font-size: 13px;
    background: transparent;
    color: #cbd5e1;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease;
    box-shadow: none;
    font-weight: 600;
    min-width: 86px;
    text-align: center;
}

.tab-btn:hover {
    background: rgba(99, 102, 241, 0.1);
    color: #e4e7eb;
    transform: none;
    box-shadow: none;
}

.tab-btn.active {
    background: rgba(99, 102, 241, 0.2);
    color: #818cf8;
}

.output-content {
    display: none;
}

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

#previewOutput {
    width: 100%;
    height: 55vh;
    border: 1px solid rgba(99, 102, 241, 0.2);
    border-radius: 10px;
    padding: 0px 20px;
    overflow-x: auto;
    overflow-y: auto;
    word-wrap: break-word;
    background: rgba(10, 14, 26, 0.5);
}

#previewOutput * {
    all: revert;
}

#previewOutput a {
    color: #818cf8;
    text-decoration: underline;
}

#previewOutput a:hover {
    color: #c084fc;
}

textarea {
    width: 100%;
    height: 55vh;
    border: 1px solid rgba(99, 102, 241, 0.2);
    border-radius: 10px;
    padding: 14px 16px;
    font-family: "JetBrains Mono", "Fira Code", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 13px;
    line-height: 1.6;
    background: rgba(10, 14, 26, 0.5);
    color: #e4e7eb;
    resize: none;
    transition: all 0.3s ease;
    overflow-x: auto;
    overflow-y: auto;
    word-wrap: break-word;
}

textarea:focus {
    outline: none;
    border-color: rgba(129, 140, 248, 0.5);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

textarea::placeholder {
    color: #64748b;
}

textarea[readonly] {
    background: rgba(10, 14, 26, 0.3);
    cursor: default;
}

/* Minimalist scrollbar for textareas */
textarea::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

textarea::-webkit-scrollbar-track {
    background: rgba(10, 14, 26, 0.3);
    border-radius: 4px;
}

textarea::-webkit-scrollbar-thumb {
    background: rgba(129, 140, 248, 0.3);
    border-radius: 4px;
    transition: background 0.3s ease;
}

textarea::-webkit-scrollbar-thumb:hover {
    background: rgba(129, 140, 248, 0.5);
}

.options {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin: 16px 0;
    padding: 16px;
    background: rgba(99, 102, 241, 0.05);
    border-radius: 10px;
    border: 1px solid rgba(99, 102, 241, 0.1);
}

.options label {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-size: 13px;
    color: #cbd5e1;
    transition: color 0.2s ease;
}

.options label:hover {
    color: #e4e7eb;
}

.options input[type="checkbox"] {
    margin-right: 8px;
    cursor: pointer;
    width: 16px;
    height: 16px;
    accent-color: #818cf8;
}

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

.inputs .actions #convertBtn {
    margin-left: auto;
}

button {
    padding: 11px 20px;
    border-radius: 10px;
    border: none;
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    color: white;
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    transition: background-color 0.3s ease, box-shadow 0.3s ease;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
    position: relative;
    overflow: hidden;
}

button::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.2) 0%, rgba(255, 255, 255, 0) 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

button:hover::before {
    opacity: 1;
}

button:hover {
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.4);
}

button.secondary {
    background: rgba(51, 65, 85, 0.5);
    border: 1px solid rgba(99, 102, 241, 0.2);
    box-shadow: none;
}

button.secondary:hover {
    background: rgba(51, 65, 85, 0.7);
    border-color: rgba(99, 102, 241, 0.4);
}

.output-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-top: 12px;
}

.output-actions .copy-btn {
    margin-left: auto;
}

.copy-btn {
    padding: 11px 20px;
    font-size: 14px;
    transition: all 0.3s ease;
    min-width: 80px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.copy-btn.success {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%) !important;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4) !important;
}

/* Apply the same success styling to any button when given the `success` class */
button.success {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%) !important;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4) !important;
}

#previewOutput::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

#previewOutput::-webkit-scrollbar-track {
    background: rgba(10, 14, 26, 0.1);
    border-radius: 4px;
}

#previewOutput::-webkit-scrollbar-thumb {
    background: rgba(129, 140, 248, 0.3);
    border-radius: 4px;
    transition: background 0.3s ease;
}

#previewOutput::-webkit-scrollbar-thumb:hover {
    background: rgba(129, 140, 248, 0.5);
}

@media (max-width: 900px) {
    .io {
        grid-template-columns: 1fr;
    }

    header {
        padding: 16px 20px;
    }

    header h1 {
        font-size: 20px;
    }
}
