:root {
    --bg-color: #f8fafc;
    --surface-color: #ffffff;
    --text-color: #1e293b;
    --text-muted: #64748b;
    --primary: #3b82f6;
    --primary-hover: #2563eb;
    --success: #10b981;
    --success-hover: #059669;
    --danger: #ef4444;
    --danger-hover: #dc2626;
    --border-color: #e2e8f0;
    --input-bg: #f8fafc;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --radius: 12px;
    --transition: all 0.3s ease;
}

[data-theme="dark"] {
    --bg-color: #0f172a;
    --surface-color: #1e293b;
    --text-color: #f8fafc;
    --text-muted: #94a3b8;
    --border-color: #334155;
    --input-bg: #0f172a;
    --primary: #3b82f6;
}

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

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    transition: var(--transition);
    min-height: 100vh;
    padding: 3rem 1rem;
}

.floating-btn {
    position: fixed;
    top: 20px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background-color: var(--surface-color);
    color: var(--text-color);
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    cursor: pointer;
    box-shadow: var(--shadow);
    z-index: 1000;
    transition: var(--transition);
    text-decoration: none;
}

.floating-btn:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
    background-color: var(--primary);
    color: white;
    border-color: var(--primary);
}

.floating-btn.left {
    left: 20px;
}

.floating-btn.right {
    right: 20px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    background: var(--surface-color);
    padding: 2.5rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-color);
    transition: var(--transition);
}

header {
    text-align: center;
    margin-bottom: 2.5rem;
}

h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: var(--text-color);
    letter-spacing: -0.5px;
}

.subtitle {
    color: var(--text-muted);
    font-size: 1.1rem;
}

.actions {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 1rem;
    margin-bottom: 1.5rem;
    align-items: center;
}



#btn-paste {
    justify-self: start;
}

#btn-clear {
    justify-self: center;
}

#btn-copy {
    justify-self: end;
}

.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: var(--transition);
    color: white;
    box-shadow: var(--shadow);
}

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

.btn-primary {
    background-color: var(--primary);
}

.btn-primary:hover {
    background-color: var(--primary-hover);
}

.btn-success {
    background-color: var(--success);
}

.btn-success:hover {
    background-color: var(--success-hover);
}

.btn-danger {
    background-color: var(--danger);
}

.btn-danger:hover {
    background-color: var(--danger-hover);
}

.editor-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
}



.editor-col {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

label {
    font-weight: 600;
    font-size: 1rem;
    color: var(--text-color);
}

textarea {
    width: 100%;
    height: 450px;
    padding: 1.25rem;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    background-color: var(--input-bg);
    color: var(--text-color);
    font-family: 'JetBrains Mono', monospace;
    font-size: 1rem;
    resize: vertical;
    transition: var(--transition);
    line-height: 1.6;
}

textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.15);
}

textarea[readonly] {
    background-color: var(--surface-color);
}

/* Admin Styles */
.admin-container {
    max-width: 1000px;
}

.admin-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2.5rem;
}

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

.card h2 {
    margin-bottom: 2rem;
    font-size: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 1rem;
}

.card h3 {
    margin-bottom: 1.5rem;
}

.form-group {
    margin-bottom: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

input[type="text"],
textarea:not(#input-text):not(#output-text) {
    width: 100%;
    padding: 0.8rem 1rem;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: var(--surface-color);
    color: var(--text-color);
    font-family: 'Inter', sans-serif;
    font-size: 1rem;
    transition: var(--transition);
}

input[type="text"]:focus,
textarea:not(#input-text):not(#output-text):focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.15);
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1.5rem;
    background: var(--surface-color);
    border-radius: 8px;
    overflow: hidden;
}

.admin-table th,
.admin-table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.admin-table th {
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 0.05em;
}

.small-input {
    width: 150px !important;
}

.btn-icon {
    padding: 0.6rem;
    border-radius: 8px;
    font-size: 1rem;
}

/* Toggle Switch */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 28px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--border-color);
    transition: .4s;
    border-radius: 34px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
    box-shadow: var(--shadow);
}

input:checked+.slider {
    background-color: var(--success);
}

input:checked+.slider:before {
    transform: translateX(22px);
}

code {
    background: var(--input-bg);
    padding: 0.3rem 0.6rem;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.9em;
    color: var(--primary);
}

.add-rule-form {
    display: flex;
    gap: 1rem;
    align-items: center;
    flex-wrap: wrap;
}

.alert {
    padding: 1rem 1.5rem;
    border-radius: 8px;
    margin-bottom: 2rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.alert.success {
    background-color: rgba(16, 185, 129, 0.1);
    color: var(--success);
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.mt-3 {
    margin-top: 1rem;
}

.mb-4 {
    margin-bottom: 1.5rem;
}

@media (max-width: 768px) {
    * {
        box-sizing: border-box !important;
    }

    html,
    body {
        max-width: 100vw;
        overflow-x: hidden;
        margin: 0;
        padding: 0;
    }

    body {
        padding: 4.5rem 0.6rem 2rem 0.6rem;
    }

    .container {
        padding: 1.25rem 0.75rem !important;
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 auto !important;
        border-radius: 12px;
        box-shadow: none;
        overflow-x: hidden;
    }

    h1 {
        font-size: 1.5rem;
        word-break: break-word;
    }

    .card {
        padding: 1.25rem 0.75rem !important;
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 0 1.5rem 0 !important;
        overflow-x: hidden;
    }

    .form-group {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0;
    }

    input[type="text"],
    textarea,
    input[type="range"] {
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
    }

    .actions {
        display: flex;
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
        width: 100%;
    }

    #btn-paste,
    #btn-clear,
    #btn-copy {
        width: 100% !important;
        justify-content: center;
        margin: 0;
    }

    .floating-btn {
        width: 38px;
        height: 38px;
        top: 10px;
        font-size: 0.9rem;
    }

    .floating-btn.left {
        left: 10px;
    }

    .floating-btn.right {
        right: 10px;
    }

    .admin-table {
        display: block;
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .editor-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
        width: 100%;
    }

    .add-rule-form {
        flex-direction: column;
        align-items: stretch;
        width: 100%;
    }

    .add-rule-form input {
        width: 100% !important;
        margin-bottom: 0.5rem;
    }

    .small-input {
        width: 100% !important;
    }

    .admin-grid {
        gap: 1.5rem;
        width: 100%;
    }

    /* Fix slider container specifically */
    .form-group>div {
        flex-direction: column;
        align-items: stretch !important;
        gap: 0.5rem !important;
    }

    .form-group>div>input {
        width: 100% !important;
    }

    .form-group>div>output {
        text-align: left !important;
    }
}