:root {
    /* Light Theme Palette */
    --bg-primary: #f5f7fb;
    --bg-card: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --primary: #4f46e5;
    --primary-light: #e0e7ff;
    --primary-dark: #3730a3;
    --accent: #06b6d4;
    --border: #e2e8f0;
    --shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.05), 0 1px 3px rgba(0, 0, 0, 0.02);
    --ad-bg: #f8fafc;
    --ad-border: #cbd5e1;
    
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --radius-lg: 20px;
    --radius-md: 12px;
    
    /* Textarea styling */
    --textarea-bg: #f8fafc;
    --textarea-color: #0f172a;
    --textarea-focus: #ffffff;
}

[data-theme="dark"] {
    /* Dark Theme Palette */
    --bg-primary: #0b0f19;
    --bg-card: #151d30;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --primary: #6366f1;
    --primary-light: #1e293b;
    --primary-dark: #4f46e5;
    --accent: #22d3ee;
    --border: #1e293b;
    --shadow: 0 20px 40px -15px rgba(0, 0, 0, 0.5);
    --ad-bg: #1e293b;
    --ad-border: #334155;
    
    /* Textarea styling */
    --textarea-bg: #0e1422;
    --textarea-color: #e2e8f0;
    --textarea-focus: #121826;
}

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

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    transition: var(--transition);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    line-height: 1.6;
}

header {
    padding: 1.5rem 2rem;
    max-width: 98%;
    width: 100%;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-family: 'Outfit', sans-serif;
    font-size: 1.5rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    text-decoration: none;
}

.theme-toggle {
    cursor: pointer;
    border: 1px solid var(--border);
    background: var(--bg-card);
    padding: 0.6rem;
    border-radius: 50%;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow);
    transition: var(--transition);
    color: var(--text-primary);
}
.theme-toggle:hover {
    transform: scale(1.05);
    border-color: var(--primary);
}
.theme-toggle svg {
    width: 20px;
    height: 20px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
}
.theme-toggle .sun-icon { display: none; }
[data-theme="dark"] .theme-toggle .moon-icon { display: none; }
[data-theme="dark"] .theme-toggle .sun-icon { display: block; }

/* Container & Layout */
.container {
    max-width: 98%;
    width: 100%;
    margin: 0 auto;
    padding: 0 1.5rem 3rem 1.5rem;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

/* Ad Slots */
.ad-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: var(--ad-bg);
    border: 1px dashed var(--ad-border);
    border-radius: var(--radius-md);
    padding: 1rem;
    margin: 0.5rem 0;
    position: relative;
    min-height: 100px;
    overflow: hidden;
}
.ad-container::before {
    content: "SPONSORED";
    position: absolute;
    top: 4px;
    right: 8px;
    font-size: 0.65rem;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    font-weight: 700;
}
.ad-top {
    width: 100%;
    max-width: 970px;
    min-height: 90px;
    margin: 0 auto;
}
.ad-bottom {
    width: 100%;
    max-width: 970px;
    min-height: 90px;
    margin: 1.5rem auto 0 auto;
}
.adsbygoogle {
    width: 100% !important;
    display: block;
}

/* Hero details */
.hero {
    text-align: center;
    max-width: 800px;
    margin: 0 auto;
}
h1 {
    font-family: 'Outfit', sans-serif;
    font-size: 2.5rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}
.subtitle {
    color: var(--text-secondary);
    font-size: 1.05rem;
    margin-bottom: 1rem;
}

/* Input Grid */
.input-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
}
@media (min-width: 992px) {
    .input-grid {
        grid-template-columns: 1fr 1fr;
    }
}

.card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    padding: 1.5rem;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border);
    padding-bottom: 0.75rem;
}

.card-title {
    font-family: 'Outfit', sans-serif;
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.card-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.action-btn {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    color: var(--text-primary);
    padding: 0.4rem 0.8rem;
    border-radius: var(--radius-md);
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.3rem;
    transition: var(--transition);
}
.action-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-light);
}
[data-theme="dark"] .action-btn:hover {
    background: rgba(99, 102, 241, 0.15);
}

.textarea-wrapper {
    position: relative;
    width: 100%;
}

textarea {
    width: 100%;
    height: 350px;
    background-color: var(--textarea-bg);
    color: var(--textarea-color);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 1rem;
    font-family: 'Fira Code', 'Consolas', monospace;
    font-size: 0.9rem;
    line-height: 1.5;
    resize: vertical;
    outline: none;
    transition: var(--transition);
}
textarea:focus {
    border-color: var(--primary);
    background-color: var(--textarea-focus);
    box-shadow: 0 0 0 3px var(--primary-light);
}
[data-theme="dark"] textarea:focus {
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

/* Drag & drop overlay */
.dropzone-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(79, 70, 229, 0.95);
    border: 2px dashed #ffffff;
    border-radius: var(--radius-md);
    color: #ffffff;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    opacity: 0;
    pointer-events: none;
    transition: var(--transition);
    z-index: 10;
    gap: 0.5rem;
}
.dropzone-overlay.active {
    opacity: 1;
}

/* Tool Bar Controls */
.toolbar {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1rem 1.5rem;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 1.5rem;
    box-shadow: var(--shadow);
}

.tool-options {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1.5rem;
}

.select-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.select-group label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
}
.select-control {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    color: var(--text-primary);
    padding: 0.5rem 1rem;
    border-radius: var(--radius-md);
    outline: none;
    font-size: 0.85rem;
    font-family: inherit;
    cursor: pointer;
    transition: var(--transition);
}
.select-control:focus {
    border-color: var(--primary);
}

.toggle-switch {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    user-select: none;
}
.toggle-switch input {
    display: none;
}
.switch-slider {
    width: 40px;
    height: 20px;
    background: var(--border);
    border-radius: 20px;
    position: relative;
    transition: var(--transition);
}
.switch-slider::before {
    content: '';
    width: 14px;
    height: 14px;
    background: #ffffff;
    border-radius: 50%;
    position: absolute;
    top: 3px;
    left: 3px;
    transition: var(--transition);
}
.toggle-switch input:checked + .switch-slider {
    background: var(--primary);
}
.toggle-switch input:checked + .switch-slider::before {
    transform: translateX(20px);
}
.toggle-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.tool-buttons {
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

.btn-swap {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    color: var(--text-primary);
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
}
.btn-swap:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-light);
    transform: rotate(180deg);
}
[data-theme="dark"] .btn-swap:hover {
    background: rgba(99, 102, 241, 0.15);
}

.btn-compare {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #ffffff;
    border: none;
    border-radius: var(--radius-md);
    padding: 0.8rem 1.8rem;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.25);
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.btn-compare:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(79, 70, 229, 0.35);
}
.btn-compare:active {
    transform: translateY(0);
}

/* Diff Render Area */
.diff-container {
    min-height: 200px;
}

/* Welcome / Empty state */
.welcome-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 5rem 2rem;
    color: var(--text-secondary);
    border: 1px dashed var(--border);
    border-radius: var(--radius-lg);
    background: var(--bg-card);
    box-shadow: var(--shadow);
}
.welcome-state svg {
    width: 64px;
    height: 64px;
    stroke: var(--primary);
    margin-bottom: 1.5rem;
    opacity: 0.8;
}
.welcome-state h3 {
    font-family: 'Outfit', sans-serif;
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}
.welcome-state p {
    max-width: 450px;
    font-size: 0.95rem;
}

/* Diff2Html UI Overrides */
.d2h-wrapper {
    background: transparent;
    padding: 0;
    margin: 0;
    font-family: 'Inter', sans-serif;
}
.d2h-file-wrapper {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    margin-bottom: 0;
    overflow: hidden;
    transition: var(--transition);
}
.d2h-file-header {
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border);
    padding: 1rem 1.5rem;
    color: var(--text-primary);
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    font-size: 1.05rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.d2h-file-name-wrapper {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.d2h-file-name {
    color: var(--text-primary) !important;
}
.d2h-file-stats {
    display: none !important;
}
.d2h-file-diff {
    overflow-x: auto;
}
.d2h-diff-table {
    width: 100%;
    border-collapse: collapse;
    font-family: 'Fira Code', 'Consolas', monospace;
    font-size: 0.85rem;
}
.d2h-code-line {
    padding: 0 10px;
}
.d2h-code-linenumber {
    background: var(--bg-primary);
    border-right: 1px solid var(--border);
    color: var(--text-secondary);
    text-align: right;
    width: 50px;
    user-select: none;
    padding: 2px 10px;
    font-size: 0.75rem;
}
.d2h-code-side-linenumber {
    background: var(--bg-primary);
    border-right: 1px solid var(--border);
    color: var(--text-secondary);
    text-align: right;
    width: 50px;
    user-select: none;
    padding: 2px 10px;
    font-size: 0.75rem;
}
.d2h-ins {
    background-color: rgba(16, 185, 129, 0.08) !important;
    border-color: rgba(16, 185, 129, 0.15) !important;
}
.d2h-del {
    background-color: rgba(239, 68, 68, 0.08) !important;
    border-color: rgba(239, 68, 68, 0.15) !important;
}
/* Custom highlight for line numbers columns on insertion/deletion */
.d2h-ins .d2h-code-linenumber,
.d2h-ins .d2h-code-side-linenumber {
    background-color: rgba(16, 185, 129, 0.15) !important;
    border-color: rgba(16, 185, 129, 0.25) !important;
    color: #047857 !important;
}
.d2h-del .d2h-code-linenumber,
.d2h-del .d2h-code-side-linenumber {
    background-color: rgba(239, 68, 68, 0.15) !important;
    border-color: rgba(239, 68, 68, 0.25) !important;
    color: #b91c1c !important;
}
.d2h-cntx {
    background-color: var(--bg-card);
}
.d2h-code-line-ctn {
    color: var(--text-primary);
    background: transparent;
    padding-left: 10px;
    vertical-align: middle;
}
ins.d2h-change {
    background-color: rgba(16, 185, 129, 0.2) !important;
    color: #047857 !important;
    text-decoration: none;
    border-radius: 2px;
    padding: 1px 2px;
}
del.d2h-change {
    background-color: rgba(239, 68, 68, 0.2) !important;
    color: #b91c1c !important;
    text-decoration: none;
    border-radius: 2px;
    padding: 1px 2px;
}

/* Dark mode modifications for diff2html */
[data-theme="dark"] ins.d2h-change {
    color: #34d399 !important;
    background-color: rgba(16, 185, 129, 0.3) !important;
}
[data-theme="dark"] del.d2h-change {
    color: #f87171 !important;
    background-color: rgba(239, 68, 68, 0.3) !important;
}
[data-theme="dark"] .d2h-ins {
    background-color: rgba(16, 185, 129, 0.12) !important;
}
[data-theme="dark"] .d2h-del {
    background-color: rgba(239, 68, 68, 0.12) !important;
}
/* Dark mode custom highlight for line numbers columns on insertion/deletion */
[data-theme="dark"] .d2h-ins .d2h-code-linenumber,
[data-theme="dark"] .d2h-ins .d2h-code-side-linenumber {
    background-color: rgba(16, 185, 129, 0.22) !important;
    border-color: rgba(16, 185, 129, 0.35) !important;
    color: #34d399 !important;
}
[data-theme="dark"] .d2h-del .d2h-code-linenumber,
[data-theme="dark"] .d2h-del .d2h-code-side-linenumber {
    background-color: rgba(239, 68, 68, 0.22) !important;
    border-color: rgba(239, 68, 68, 0.35) !important;
    color: #f87171 !important;
}
[data-theme="dark"] .hljs {
    background: transparent !important;
    color: var(--text-primary) !important;
}

/* Information & FAQ sections */
.info-section {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
    margin-top: 2rem;
}
@media (min-width: 992px) {
    .info-section {
        grid-template-columns: 1.2fr 1.8fr;
    }
}

.info-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 2rem;
    box-shadow: var(--shadow);
}
.info-card h2 {
    font-family: 'Outfit', sans-serif;
    font-size: 1.5rem;
    margin-bottom: 1.25rem;
    color: var(--text-primary);
}
.info-card p {
    color: var(--text-secondary);
    margin-bottom: 1rem;
    font-size: 0.95rem;
}
.info-features {
    margin-top: 1.5rem;
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}
@media (min-width: 576px) {
    .info-features {
        grid-template-columns: 1fr 1fr;
    }
}
.feature-box {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    padding: 1rem;
    border-radius: var(--radius-md);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.feature-box svg {
    color: var(--primary);
    width: 24px;
    height: 24px;
}
.feature-title {
    font-weight: 700;
    font-size: 0.9rem;
}
.feature-desc {
    color: var(--text-secondary);
    font-size: 0.8rem;
}

/* FAQ */
.faq-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}
.faq-item {
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 1.2rem;
    background: var(--bg-primary);
}
.faq-question {
    font-family: 'Outfit', sans-serif;
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.faq-answer {
    color: var(--text-secondary);
    font-size: 0.92rem;
}

/* New Social Share Bar */
.share-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    margin-top: 30px;
    margin-bottom: 20px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 50px;
    padding: 12px 24px;
    backdrop-filter: blur(12px);
    box-shadow: var(--shadow);
    align-self: center;
    width: fit-content;
    margin-left: auto;
    margin-right: auto;
}
.share-label {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-secondary);
}
.share-buttons {
    display: flex;
    gap: 10px;
}
.share-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    transition: var(--transition);
    text-decoration: none;
}
.share-btn svg {
    width: 18px;
    height: 18px;
}
.share-btn.twitter-x {
    background: #1da1f2;
}
.share-btn.twitter-x:hover {
    background: #0c85d0;
    transform: scale(1.1);
}
.share-btn.facebook {
    background: #1877f2;
}
.share-btn.facebook:hover {
    background: #0d5ec4;
    transform: scale(1.1);
}
.share-btn.linkedin {
    background: #0a66c2;
}
.share-btn.linkedin:hover {
    background: #08519c;
    transform: scale(1.1);
}
.share-btn.whatsapp {
    background: #25d366;
}
.share-btn.whatsapp:hover {
    background: #1ebd56;
    transform: scale(1.1);
}

footer {
    text-align: center;
    padding: 2rem;
    color: var(--text-secondary);
    font-size: 0.85rem;
    border-top: 1px solid var(--border);
    margin-top: auto;
}
.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
    font-size: 0.9rem;
    color: var(--text-secondary);
}
.footer-info {
    display: flex;
    align-items: center;
    gap: 20px;
}
.current-time-badge {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    padding: 4px 12px;
    border-radius: 50px;
    font-size: 0.8rem;
    color: var(--text-primary);
}
[data-theme="light"] .current-time-badge {
    background: rgba(15, 23, 42, 0.05);
    border: 1px solid rgba(15, 23, 42, 0.08);
}

/* Utilities */
.text-primary-color {
    color: var(--primary);
}
.hidden {
    display: none !important;
}

/* Floating Copy Button for rendered diff */
.diff-actions {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 0.8rem;
}
