:root {
    /* Colors */
    --primary: #FD8204;
    --primary-hover: #e67300;
    --secondary: #fb923c;

    /* Light Theme Backgrounds */
    --bg-dark: #f8fafc;
    /* Very light gray/white */
    --bg-card: #ffffff;
    /* Solid background instead of transparent */
    --glass: none;

    --text-main: #0F172A;
    /* Deeper slate for better contrast */
    --text-muted: #64748b;
    --border: #e2e8f0;
    /* Solid border */

    --shadow: 0 8px 32px rgba(0, 0, 0, 0.04);
    --surface-bg: #ffffff;
    --surface-border: #e2e8f0;
    --input-bg: #ffffff;
    --input-border: #e2e8f0;
    --input-text: #1e293b;

    /* Diff Colors - Light */
    --diff-add-bg: #dcfce7;
    --diff-add-text: #166534;
    --diff-remove-bg: #fee2e2;
    --diff-remove-text: #991b1b;

    /* Spacing */
    --container: 1100px;
    --header-height: 80px;
}

.dark-mode {
    --bg-dark: #121212;
    --bg-card: #1e1e1e;
    --text-main: #e0e0e0;
    --text-muted: #a0a0a0;
    --shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    --surface-bg: #1e1e1e;
    --surface-border: rgba(255, 255, 255, 0.08);
    --input-bg: #181818;
    --input-border: rgba(255, 255, 255, 0.08);
    --input-text: #e0e0e0;
    --border: rgba(255, 255, 255, 0.08);

    /* Diff Colors - Dark */
    --diff-add-bg: rgba(34, 197, 94, 0.15);
    --diff-add-text: #4ade80;
    --diff-remove-bg: rgba(239, 68, 68, 0.15);
    --diff-remove-text: #f87171;
}

.dark-mode h1,
.dark-mode h2,
.dark-mode h3,
.dark-mode h4,
.dark-mode p,
.dark-mode label,
.dark-mode span:not(.btn-label):not(.slider i):not(.fa-stack) {
    color: var(--text-main);
}

.dark-mode .tool-description,
.dark-mode .text-muted,
.dark-mode .category-accordion p {
    color: var(--text-muted);
}

.dark-mode .surface,
.dark-mode .glass,
.dark-mode .result-area,
.dark-mode .settings-panel,
.dark-mode .card,
.dark-mode .modal-content {
    background: var(--surface-bg) !important;
    border-color: var(--surface-border) !important;
    color: var(--text-main) !important;
}

.dark-mode .surface h2,
.dark-mode .surface h3,
.dark-mode .glass h2,
.dark-mode .glass h3,
.dark-mode .settings-panel h2,
.dark-mode .settings-panel h3 {
    color: var(--text-main) !important;
}

/* Standard Tool Header */
.tool-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    /* Standardized spacing */
    padding: 10px 0;
    gap: 30px;
}

.tool-header-left {
    flex: 1;
}

.tool-header-right {
    display: flex;
    gap: 15px;
    align-items: center;
}

.tool-title {
    margin: 0;
    font-size: 1.125rem;
    /* 18px Desktop */
    color: #1e293b;
    font-weight: 800;
}

.tool-description {
    margin: 5px 0 0;
    color: #64748b;
    font-size: 0.9rem;
}

@media (max-width: 768px) {
    .tool-header {
        flex-direction: column;
        text-align: center;
        gap: 20px;
    }

    .tool-header-right {
        justify-content: center;
        width: 100%;
    }

    .tool-title {
        font-size: 1rem !important;
        /* 16px */
    }
}

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

body {
    font-family: 'Poppins', sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-main);
    line-height: 1.6;
    overflow-x: hidden;
    min-height: 100vh;
    position: relative;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Optimized background - use pseudo-element instead of fixed attachment on body */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    background-image:
        radial-gradient(circle at 0% 0%, rgba(253, 130, 4, 0.12) 0%, transparent 50%),
        radial-gradient(circle at 100% 100%, rgba(59, 130, 246, 0.08) 0%, transparent 50%),
        radial-gradient(circle at 100% 0%, rgba(236, 72, 153, 0.04) 0%, transparent 50%);
    pointer-events: none;
}

/* Surface Utility - High Performance (Solid) */
.glass,
.surface {
    background: var(--surface-bg);
    border: 1px solid var(--surface-border);
    border-radius: 24px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.dark-mode .glass,
.dark-mode .surface {
    background: var(--surface-bg) !important;
    border-color: var(--surface-border) !important;
}

input:not([type="checkbox"]):not([type="radio"]),
textarea,
select {
    background-color: var(--input-bg);
    color: var(--input-text);
    border: 1px solid var(--input-border);
    border-radius: 12px;
    padding: 12px 16px;
    font-family: inherit;
    font-size: 0.95rem;
    width: 100%;
    outline: none;
    transition: all 0.2s ease;
}

input:not([type="checkbox"]):not([type="radio"]):focus,
textarea:focus,
select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(253, 130, 4, 0.1);
}

a {
    text-decoration: none;
    color: inherit;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 28px;
    border-radius: 999px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    border: none;
    text-decoration: none;
    font-size: 0.95rem;
    gap: 8px;
    color: var(--text-main);
}

.btn-primary {
    background: #0F1820;
    color: #fff;
    box-shadow: 0 4px 12px rgba(15, 24, 32, 0.2);
}

.btn-primary:hover {
    background: var(--primary);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(253, 130, 4, 0.4);
}

.container {
    .container {
        max-width: 95%;
        /* Fullwidth feel as requested */
        margin: 0 auto;
        padding: 0 30px;
    }

    padding: 0 20px;
}

/* Header - Centered Layout */
header {
    height: var(--header-height);
    display: flex;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--surface-bg);
    border-bottom: 1px solid var(--surface-border);
    border-bottom-left-radius: 25px;
    border-bottom-right-radius: 25px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03);
    transition: all 0.3s ease;
}

header .container {
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-main);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 8px;
    letter-spacing: -0.5px;
}

.logo span {
    color: var(--primary);
}

.logo img {
    width: 275px;
    height: auto;
    object-fit: contain;
}

header a {
    display: flex;
    align-items: center;
    height: 100%;
}

header a img {
    max-width: 200px;
    width: 100%;
    height: auto;
    object-fit: contain;
}

/* Grid Layout for Index */
.tools-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 30px;
    /* Increased gap */
    margin-top: 30px;
    padding: 30px 0 50px;
    /* Top 30px, Bottom 50px */
}

.tool-card {
    padding: 30px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
    height: 100%;
    background: var(--surface-bg);
    border: 1px solid var(--surface-border);
    border-radius: 16px;
    transition: all 0.2s ease;
    cursor: pointer;
}

.tool-card:hover {
    border-color: var(--primary);
    background: var(--bg-card);
    transform: translateY(-5px);
}

/* Category Accordion */
.category-accordion {
    /* Removed background/border/radius to prevent double-boxing */
    background: transparent;
    border: none;
    border-radius: 0;
    margin-bottom: 5px;
    /* Reduced to 5px as requested */
    overflow: visible;
    /* Allowing header shadow to show */
}

.btn-minimal {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-weight: 400;
    color: #000000;
    text-decoration: none;
    padding: 0;
    margin: 0;
    background: transparent;
    border: none;
    font-size: 12px;
    transition: color 0.2s ease;
}

.tool-card:hover .btn-minimal {
    color: var(--primary);
}

.tool-icon {
    width: 48px;
    height: 48px;
    background: rgba(0, 0, 0, 0.03);
    /* Soft neutral background */
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    color: var(--primary);
    margin-bottom: 8px;
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.glass-inner {
    background: rgba(0, 0, 0, 0.02);
    border: 1px solid rgba(0, 0, 0, 0.04);
    border-radius: 12px;
    padding: 15px;
}

.progress-container-glass {
    background: rgba(0, 0, 0, 0.05);
    border-radius: 999px;
    height: 8px;
    overflow: hidden;
}

.card-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-main);
}

.tool-desc {
    color: var(--text-muted);
    font-size: 0.95rem;
    flex-grow: 1;
    line-height: 1.5;
}

/* New Navigation & Card Refinements */
.back-nav-container {
    display: flex;
    justify-content: center;
    margin-bottom: 25px;
}

.btn-back {
    background: var(--bg-dark);
    color: var(--text-main);
    padding: 10px 24px;
    font-size: 0.9rem;
    border: 1px solid var(--surface-border);
    transition: all 0.2s;
}

.btn-back:hover {
    background: var(--surface-bg);
    transform: translateY(-1px);
}

.tool-card .btn-minimal {
    display: none !important;
    /* Remove redundant "Utilizar" button */
}

/* Tool Page Layout */
.tool-page {
    padding: 60px 0;
    max-width: var(--container);
    margin: 0 auto;
}

.dropzone {
    border: 2px dashed var(--surface-border);
    border-radius: 24px;
    padding: 80px 40px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: var(--surface-bg);
    box-shadow: var(--shadow);
}

.dropzone:hover,
.dropzone.dragover {
    border-color: var(--primary);
    background: var(--bg-card);
}

.settings-panel {
    margin-top: 30px;
    padding: 30px;
    background: var(--surface-bg);
    border-radius: 24px;
    border: 1px solid var(--surface-border);
    box-shadow: var(--shadow);
}

.hidden {
    display: none !important;
}

/* Form Elements - Light Theme input overrides */
input[type="text"],
input[type="url"],
input[type="number"],
input[type="tel"],
input[type="password"],
select,
textarea,
input[type="email"] {
    width: 100%;
    padding: 14px;
    background: var(--input-bg);
    border: 1px solid var(--input-border);
    border-radius: 12px;
    color: var(--input-text);
    font-family: inherit;
    font-size: 0.95rem;
    transition: all 0.2s;
    margin-bottom: 12px;
    outline: none;
}

input:focus,
select:focus,
textarea:focus {
    background: var(--input-bg);
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(253, 130, 4, 0.15);
}

input[type="range"] {
    width: 100%;
    margin: 15px 0;
    accent-color: var(--primary);
}

/* Result Area in light mode needs to be distinct */
.result-area {
    margin-top: 30px;
    padding: 30px;
    border-radius: 24px;
    border: 1px solid #e2e8f0;
    background: #ffffff;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03);
}

/* Footer */
footer {
    padding: 40px 0;
    text-align: center;
    color: var(--text-muted);
    border-top: 1px solid var(--surface-border);
    margin-top: auto;
    font-size: 0.9rem;
    background: var(--surface-bg);
}

.dark-mode footer {
    background: rgba(0, 0, 0, 0.2);
    border-top-color: var(--surface-border);
    color: var(--text-muted);
}

/* Responsive Utilities */
.editor-col {
    flex: 1;
    min-width: 300px;
}

.recorder-grid {
    grid-template-columns: 1fr 320px;
}

.watermark-grid {
    width: 100%;
    margin-top: 30px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
}

.video-container-responsive {
    flex: 1;
    min-width: 300px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: #000;
    border-radius: 12px;
    overflow: hidden;
    min-height: 200px;
}

@media (max-width: 768px) {
    :root {
        --container: 100%;
        --header-height: auto;
    }

    body {
        font-size: 15px;
        /* Slightly smaller base font */
    }

    .container {
        padding: 0 16px;
    }

    header {
        padding: 15px 0;
        position: relative;
        /* Unstick on mobile if content is tall? Or keep sticky. Let's keep sticky but ensure height. */
        height: auto;
    }

    @media (max-width: 1100px) {
        .tools-grid {
            grid-template-columns: repeat(3, 1fr);
        }
    }

    @media (max-width: 850px) {
        .tools-grid {
            grid-template-columns: repeat(2, 1fr);
        }
    }

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

        .header-content {
            flex-direction: column;
            gap: 15px;
        }
    }

    header .container {
        flex-direction: column;
        gap: 10px;
    }

    .logo img {
        width: 220px;
        /* Smaller logo but legible */
    }

    /* Tools Grid: 1 column on mobile naturally by auto-fit, but ensure gap is smaller */
    .tools-grid {
        gap: 16px;
        grid-template-columns: 1fr;
        /* Force 1 column on very small screens if needed, or stick to auto-fit */
        padding: 24px 0 40px;
    }

    .tool-card {
        padding: 24px;
        min-height: auto;
    }

    .tool-page {
        padding: 30px 0;
    }

    .dropzone {
        padding: 40px 20px;
    }

    /* Flex containers in tools (Settings vs Preview) */
    .settings-panel>div {
        flex-direction: column;
        gap: 20px !important;
    }

    .editor-col,
    .video-container-responsive {
        min-width: 100% !important;
        /* Full width on mobile */
        width: 100%;
    }

    /* Recorder Grid Responsive */
    .recorder-grid,
    .watermark-grid {
        grid-template-columns: 1fr !important;
        display: grid;
    }

    /* Adjust generic buttons */
    .btn {
        width: 100%;
        /* Full width buttons on mobile are easier to tap */
        justify-content: center;
    }

    h1 {
        font-size: 1.8rem !important;
        /* Override inline styles if any */
    }

    h3 {
        font-size: 1.2rem !important;
    }

    p.tool-desc {
        font-size: 0.9rem;
    }
}

@media (max-width: 480px) {

    /* Optimization for very small screens */
    .logo img {
        width: 150px;
    }

    .dropzone h3 {
        font-size: 1.1rem;
    }

    .tool-icon {
        width: 40px;
        height: 40px;
        font-size: 1.2rem;
    }

    .tool-icon-large {
        width: 60px !important;
        height: 60px !important;
        font-size: 2rem !important;
    }
}

/* Base style for large icons (desktop default) */
.tool-icon-large {
    margin: 0 auto 20px;
    font-size: 3rem;
    width: 80px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    /* Removed inconsistent orange background */
    color: var(--primary);
}

/* Base & Responsive Layout Classes */
.utm-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 25px;
}

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

.password-input {
    width: 100%;
    font-family: 'JetBrains Mono', 'Courier New', monospace;
    text-align: center;
    background: #f8fafc;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: 2px;
    padding: 20px 60px 20px 20px;
    color: var(--primary);
    outline: none;
    transition: all 0.2s;
}

.password-input:focus {
    border-color: var(--primary);
    background: #ffffff;
}

/* Accordion Styles - Ultra Smooth & No Movement */
.category-wrapper {
    display: flex;
    flex-direction: column;
    gap: 25px;
    /* Consistent spacing between accordions to 25px */
}

.category-accordion {
    width: 100%;
    border-radius: 12px;
    overflow: hidden;
}

.accordion-header {
    width: 100%;
    padding: 18px 25px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    background: var(--surface-bg);
    border: 1px solid var(--surface-border);
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03);
    transition: all 0.2s ease;
}

/* No hover movement, just subtle bg change */
.accordion-header:hover {
    background: var(--bg-dark);
    /* Removed border-color: var(--primary) as user disliked the orange contour */
}

.accordion-header h2 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 0;
}

.accordion-header h2 i {
    color: var(--primary);
    font-size: 1rem;
}

.accordion-icon {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    transition: transform 0.2s ease;
}

.category-accordion.active .accordion-icon {
    transform: rotate(180deg);
    color: var(--primary);
}

/* Performance Optimized Animation using Grid Template Rows */
.accordion-content-wrapper {
    display: grid;
    grid-template-rows: 0fr;
    transition: grid-template-rows 0.3s ease;
    background: transparent;
}

.category-accordion.active .accordion-content-wrapper {
    grid-template-rows: 1fr;
}

.accordion-content {
    overflow: hidden;
    min-height: 0;
}

.accordion-grid-inner {
    padding: 20px 0;
}

/* Force 4 columns on desktop inside accordion */
.accordion-grid-inner.tools-grid {
    margin-top: 0;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    padding-bottom: 20px;
}

@media (max-width: 1200px) {
    .accordion-grid-inner.tools-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 900px) {
    .accordion-grid-inner.tools-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

.btn-outline {
    background: var(--surface-bg);
    border: 1px solid var(--surface-border);
    color: var(--text-main);
}

.btn-outline:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--bg-card);
}

@media (max-width: 600px) {
    header {
        height: auto;
        padding: 15px 10px;

        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        z-index: 1000;
        background: var(--surface-bg);
        border-bottom: 1px solid var(--surface-border);
    }

    .dark-mode header {
        background: var(--surface-bg);
        border-bottom: 1px solid var(--surface-border);
    }

    /* Push content down so it's not hidden behind fixed header */
    body {
        padding-top: 70px;
        /* Reduced from 80px to balance with bottom spacing */
        padding-bottom: 20px;
        /* Ensure some bottom spacing */
    }

    /* Grid Layout: 2 Columns -> Logo (70%) | Toggle (30%) */
    header .container {
        display: grid !important;
        grid-template-columns: 7fr 3fr;
        align-items: center;
        /* Vertical Center */
        gap: 0;
        width: 100%;
    }

    /* Logo Area */
    header a {
        display: flex;
        align-items: center;
        justify-content: flex-start;
        height: 100%;
    }

    header a img {
        max-width: 160px;
        /* Slightly larger as requested */
        height: auto;
        display: block;
    }

    /* Toggle Area */
    header .theme-switch-wrapper {
        justify-content: flex-end;
        height: 100%;
        display: flex;
        align-items: center;
    }

    .theme-switch {
        margin-left: 0;
        /* Remove auto margins if any */
        transform: scale(0.85);
        /* Slightly smaller toggle for mobile fit */
    }

    .accordion-grid-inner.tools-grid {
        grid-template-columns: 1fr;
    }

    .accordion-header h2,
    .card-title {
        font-size: 14px !important;
    }
}

/* Theme Toggle Switch */
.theme-switch-wrapper {
    display: flex;
    align-items: center;
}

.theme-switch {
    display: inline-block;
    height: 30px;
    position: relative;
    width: 60px;
}

.theme-switch input {
    display: none;
}

.slider {
    background-color: #cbd5e1;
    bottom: 0;
    cursor: pointer;
    left: 0;
    position: absolute;
    right: 0;
    top: 0;
    transition: .4s;
    border-radius: 34px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 6px;
}

.slider::before {
    background-color: #fff;
    bottom: 4px;
    content: "";
    height: 22px;
    left: 4px;
    position: absolute;
    transition: .4s;
    width: 22px;
    border-radius: 50%;
    z-index: 2;
}

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

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

.slider i {
    font-size: 14px;
    color: #fff;
    z-index: 1;
}

.fa-sun {
    color: #f59e0b !important;
}

.fa-moon {
    color: #64748b !important;
    /* Visible gray */
}

input:checked+.slider .fa-moon {
    color: #f8fafc !important;
    /* Bright white in dark mode */
}

input:checked+.slider .fa-sun {
    color: rgba(255, 255, 255, 0.4) !important;
}

.dark-mode .tool-title {
    color: var(--text-main);
}

.dark-mode .result-area {
    background: var(--surface-bg);
    border-color: var(--surface-border);
}

.dark-mode footer {
    background: rgba(0, 0, 0, 0.4);
    border-top-color: var(--surface-border);
    color: var(--text-muted);
}

.dark-mode .btn-primary {
    background: var(--primary);
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(253, 130, 4, 0.2);
}

.dark-mode .btn-primary:hover {
    background: var(--primary-hover);
    box-shadow: 0 8px 20px rgba(253, 130, 4, 0.4);
}

.dark-mode .btn-outline {
    border-color: var(--surface-border);
    color: var(--text-main);
}

.dark-mode .btn-outline:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: rgba(253, 130, 4, 0.05);
}