/* ═══════════════════════════════════════════════════════
   Ezy Tolls — WordPress Theme Styles
   Replicates the Lovable React app design exactly
   ═══════════════════════════════════════════════════════ */

/* ── CSS Variables (Design Tokens) ─────────────────── */

:root {
    --background: 210 30% 98%;
    --foreground: 222 30% 12%;
    --card: 0 0% 100%;
    --card-foreground: 222 30% 12%;
    --primary: 200 92% 38%;
    --primary-foreground: 210 40% 98%;
    --primary-glow: 187 92% 52%;
    --secondary: 210 25% 95%;
    --secondary-foreground: 222 30% 16%;
    --muted: 210 25% 95%;
    --muted-foreground: 220 12% 42%;
    --accent: 255 85% 96%;
    --accent-foreground: 255 35% 20%;
    --accent-2: 255 85% 60%;
    --destructive: 0 84.2% 60.2%;
    --destructive-foreground: 210 40% 98%;
    --border: 216 22% 90%;
    --input: 216 22% 90%;
    --ring: 200 92% 38%;
    --radius: 0.5rem;
    --surface: 0 0% 100%;
    --surface-foreground: 222 30% 12%;
    --shadow-elevated: 0 22px 60px -24px hsla(222, 30%, 12%, 0.25);
    --shadow-glow: 0 18px 60px -28px hsla(200, 92%, 38%, 0.55);
    --gradient-hero: radial-gradient(1200px 600px at 20% 0%, hsla(187, 92%, 52%, 0.35), transparent 55%),
        radial-gradient(900px 500px at 90% 20%, hsla(255, 85%, 60%, 0.26), transparent 55%),
        linear-gradient(180deg, hsl(210, 30%, 98%), hsl(210, 30%, 98%));
    --noise: radial-gradient(100% 100% at 50% 0%, hsla(222, 30%, 12%, 0.06) 0%, transparent 55%);
}

/* ── Reset & Base ──────────────────────────────────── */

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: hsl(var(--background));
    color: hsl(var(--foreground));
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ── Layout ────────────────────────────────────────── */

.app {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.hero-bg {
    flex: 1;
    background-image: var(--gradient-hero);
    position: relative;
}

.hero-bg::before {
    content: "";
    position: absolute;
    inset: 0;
    background-image: var(--noise);
    opacity: 0.7;
    pointer-events: none;
}

.hero-bg > * {
    position: relative;
}

.container {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 1rem;
}

.container.narrow {
    max-width: 42rem;
}

.container.wide {
    max-width: 64rem;
}

/* ── Tool Switcher ─────────────────────────────────── */

.tool-switcher-bar {
    padding: 0.75rem 0;
}

.tool-switcher-wrapper {
    position: relative;
    display: inline-block;
}

.tool-switcher-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border: 1px solid hsl(var(--border));
    border-radius: var(--radius);
    background: hsl(var(--background));
    color: hsl(var(--foreground));
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
}

.tool-switcher-btn:hover {
    background: hsl(var(--muted));
}

.tool-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    min-width: 12rem;
    background: hsl(var(--card));
    border: 1px solid hsl(var(--border));
    border-radius: var(--radius);
    box-shadow: var(--shadow-elevated);
    z-index: 100;
    padding: 0.25rem;
}

.tool-dropdown.open {
    display: block;
}

.tool-dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: none;
    background: none;
    color: hsl(var(--foreground));
    font-size: 0.875rem;
    cursor: pointer;
    border-radius: calc(var(--radius) - 2px);
    text-align: left;
}

.tool-dropdown-item:hover {
    background: hsl(var(--accent));
}

.tool-dropdown-item.active {
    background: hsl(var(--accent));
    font-weight: 500;
}

/* ── Tool Sections ─────────────────────────────────── */

.tool-section {
    display: none;
    padding-bottom: 3rem;
}

.tool-section.active {
    display: block;
}

.tool-header {
    padding-top: 2.5rem;
    padding-bottom: 0;
}

.tool-title {
    font-size: 1.875rem;
    font-weight: 600;
    letter-spacing: -0.025em;
    color: hsl(var(--foreground));
    line-height: 1.2;
}

.tool-title.inline {
    display: inline;
    font-size: 1.125rem;
    font-weight: 700;
}

.tool-desc {
    margin-top: 0.5rem;
    font-size: 1rem;
    color: hsl(var(--muted-foreground));
}

.tool-content {
    margin-top: 1.5rem;
}

.tool-content > .card + .card,
.tool-content > .card + .collapsible-section,
.tool-content > .collapsible-section + .collapsible-section,
.tool-content > .collapsible-section + .card {
    margin-top: 1.5rem;
}

/* ── Cards ─────────────────────────────────────────── */

.card {
    background: hsl(var(--card));
    border: 1px solid hsl(var(--border));
    border-radius: 0.75rem;
    overflow: hidden;
}

.card.glass {
    background: hsla(var(--surface), 0.75);
    backdrop-filter: blur(8px);
    box-shadow: var(--shadow-elevated);
    border-color: hsla(var(--border), 0.6);
}

.card-header {
    padding: 1.5rem 1.5rem 0;
}

.card-title {
    font-size: 1.25rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: hsl(var(--foreground));
}

.card-subtitle {
    margin-top: 0.5rem;
    font-size: 0.875rem;
    color: hsl(var(--muted-foreground));
}

.card-body {
    padding: 1.5rem;
}

.card-header + .card-body {
    padding-top: 1rem;
}

/* ── Form Elements ─────────────────────────────────── */

.field {
    margin-bottom: 1rem;
}

.field:last-child {
    margin-bottom: 0;
}

.field-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: hsl(var(--foreground));
    margin-bottom: 0.375rem;
}

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

.field-hint {
    margin-top: 0.25rem;
    font-size: 0.75rem;
    color: hsl(var(--muted-foreground));
}

.required {
    color: hsl(var(--destructive));
}

.char-counter {
    font-size: 0.75rem;
    color: hsl(var(--muted-foreground));
}

.char-counter .status-best {
    color: #22c55e;
    font-weight: 500;
}

.char-counter .status-low {
    color: #eab308;
    font-weight: 500;
}

.char-counter .status-long {
    color: hsl(var(--destructive));
    font-weight: 500;
}

.input {
    width: 100%;
    height: 2.5rem;
    padding: 0 0.75rem;
    border: 1px solid hsl(var(--input));
    border-radius: var(--radius);
    background: hsl(var(--background));
    color: hsl(var(--foreground));
    font-size: 0.875rem;
    outline: none;
}

.input:focus {
    border-color: hsl(var(--ring));
    box-shadow: 0 0 0 2px hsla(var(--ring), 0.2);
}

.input::placeholder {
    color: hsl(var(--muted-foreground));
    opacity: 0.6;
}

.textarea {
    height: auto;
    padding: 0.5rem 0.75rem;
    resize: vertical;
}

.mono {
    font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
    font-size: 0.875rem;
}

select.input {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.5rem center;
    padding-right: 2rem;
}

.input-group {
    display: flex;
    align-items: center;
    gap: 0;
}

.input-group .input {
    border-radius: 0;
}

.input-group .input:first-of-type {
    border-radius: var(--radius) 0 0 var(--radius);
}

.input-group .input:last-of-type,
.input-group .input:last-child {
    border-radius: 0 var(--radius) var(--radius) 0;
}

.input-addon {
    display: flex;
    height: 2.5rem;
    align-items: center;
    padding: 0 0.625rem;
    border: 1px solid hsl(var(--input));
    border-right: 0;
    border-radius: var(--radius) 0 0 var(--radius);
    background: hsl(var(--muted));
    font-size: 0.875rem;
    color: hsl(var(--muted-foreground));
}

.input-small {
    width: 4rem;
    border-radius: 0;
    border-right: 0;
}

/* ── Switch / Toggle ───────────────────────────────── */

.switch {
    position: relative;
    display: inline-block;
    width: 2.75rem;
    height: 1.5rem;
    flex-shrink: 0;
}

.switch.small {
    width: 2.25rem;
    height: 1.25rem;
}

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

.switch-slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background: hsl(var(--muted));
    border-radius: 999px;
    transition: background 0.2s;
}

.switch-slider::before {
    content: "";
    position: absolute;
    width: 1.125rem;
    height: 1.125rem;
    left: 0.1875rem;
    bottom: 0.1875rem;
    background: white;
    border-radius: 50%;
    transition: transform 0.2s;
}

.switch.small .switch-slider::before {
    width: 0.875rem;
    height: 0.875rem;
    left: 0.1875rem;
    bottom: 0.1875rem;
}

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

.switch input:checked + .switch-slider::before {
    transform: translateX(1.25rem);
}

.switch.small input:checked + .switch-slider::before {
    transform: translateX(1rem);
}

.toggle-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-top: 1rem;
}

.toggle-label {
    font-size: 0.875rem;
    color: hsl(var(--foreground));
}

/* ── Buttons ───────────────────────────────────────── */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border: 1px solid transparent;
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    text-decoration: none;
}

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

.btn-primary:hover {
    opacity: 0.9;
}

.btn-outline {
    background: hsl(var(--background));
    color: hsl(var(--foreground));
    border-color: hsl(var(--border));
}

.btn-outline:hover {
    background: hsl(var(--muted));
}

.btn-secondary {
    background: hsl(var(--secondary));
    color: hsl(var(--secondary-foreground));
}

.btn-secondary:hover {
    opacity: 0.85;
}

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.8125rem;
}

.btn-lg {
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
}

.btn-icon {
    width: 2.5rem;
    height: 2.5rem;
    padding: 0;
}

.btn.full-width {
    width: 100%;
}

.btn-row {
    display: flex;
    gap: 0.5rem;
}

.flex-1 {
    flex: 1;
}

.flex-wrap {
    flex-wrap: wrap;
}

.link-btn {
    background: none;
    border: none;
    color: hsl(var(--foreground));
    text-decoration: underline;
    text-underline-offset: 4px;
    cursor: pointer;
    font-size: inherit;
    padding: 0;
}

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

/* ── Grids ─────────────────────────────────────────── */

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

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

@media (min-width: 768px) {
    .grid-2 {
        grid-template-columns: 1fr 1fr;
    }

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

/* ── Result Box ────────────────────────────────────── */

.result-box {
    margin-top: 1rem;
    padding: 0.75rem;
    border: 1px solid hsl(var(--border));
    border-radius: var(--radius);
    background: hsla(var(--background), 0.6);
}

.result-box.hidden {
    display: none;
}

.result-label {
    font-size: 0.875rem;
    font-weight: 500;
    color: hsl(var(--foreground));
}

.result-url {
    margin-top: 0.25rem;
    word-break: break-all;
    font-size: 0.875rem;
    color: hsl(var(--muted-foreground));
}

.result-divider {
    height: 1px;
    background: hsl(var(--border));
    margin: 0.75rem 0;
}

.result-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
}

.result-actions {
    display: flex;
    gap: 0.25rem;
    flex-shrink: 0;
}

/* ── Stats Row ─────────────────────────────────────── */

.stats-row {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    font-size: 0.75rem;
    color: hsl(var(--muted-foreground));
    margin-bottom: 0.75rem;
}

/* ── Tabs ──────────────────────────────────────────── */

.tabs-container {
    margin-top: 1rem;
}

.tabs-list {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    background: hsl(var(--muted));
    border-radius: var(--radius);
    padding: 0.25rem;
    margin-bottom: 1rem;
}

.tab-btn {
    padding: 0.5rem;
    border: none;
    border-radius: calc(var(--radius) - 2px);
    background: none;
    color: hsl(var(--muted-foreground));
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
}

.tab-btn.active {
    background: hsl(var(--background));
    color: hsl(var(--foreground));
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.tab-panel {
    display: none;
}

.tab-panel.active {
    display: block;
}

/* ── Collapsible Sections ──────────────────────────── */

.collapsible-section {
    border: 1px solid hsl(var(--border));
    border-radius: 0.75rem;
    background: hsl(var(--card));
    overflow: hidden;
    margin-bottom: 1rem;
}

.collapsible-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 1rem 1.5rem;
    border: none;
    background: none;
    cursor: pointer;
    text-align: left;
}

.collapsible-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.collapsible-content {
    padding: 0 1.5rem 1.5rem;
}

.collapsible-content.hidden {
    display: none;
}

/* ── Code Preview ──────────────────────────────────── */

.code-card {
    overflow: hidden;
}

.code-preview {
    padding: 1rem;
    font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
    font-size: 0.8125rem;
    line-height: 1.6;
    color: hsl(var(--foreground));
    overflow-x: auto;
    white-space: pre;
    margin: 0;
}

/* ── Error Box ─────────────────────────────────────── */

.error-box {
    padding: 0.75rem;
    border: 1px solid hsla(var(--destructive), 0.3);
    background: hsla(var(--destructive), 0.1);
    border-radius: var(--radius);
    margin-bottom: 1rem;
}

.error-box.hidden {
    display: none;
}

.error-box p {
    font-size: 0.875rem;
    color: hsl(var(--destructive));
}

/* ── Info List ─────────────────────────────────────── */

.info-list {
    list-style: none;
    padding: 0;
    margin-top: 0.5rem;
}

.info-list li {
    font-size: 0.875rem;
    color: hsl(var(--muted-foreground));
    padding: 0.125rem 0;
}

.info-list li::before {
    content: "• ";
}

/* ── Section Title ─────────────────────────────────── */

.section-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: hsl(var(--foreground));
    margin-bottom: 0.75rem;
}

.section-title.primary {
    color: hsl(var(--primary));
}

/* ── SEO Header ────────────────────────────────────── */

.seo-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.seo-header-left {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* ── Sticky Bar ────────────────────────────────────── */

.sticky-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 50;
    border-top: 1px solid hsl(var(--border));
    background: hsla(var(--surface), 0.9);
    backdrop-filter: blur(8px);
    display: none;
}

.sticky-bar .container {
    max-width: 42rem;
}

.tool-section.active .sticky-bar {
    display: block;
}

.sticky-bar > .container,
.sticky-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
}

.bar-info {
    font-size: 0.875rem;
    color: hsl(var(--muted-foreground));
}

/* ── Footer ────────────────────────────────────────── */

.site-footer {
    text-align: center;
    padding: 2.5rem 1rem;
    font-size: 0.75rem;
    color: hsl(var(--muted-foreground));
}

/* ── Icons ─────────────────────────────────────────── */

.icon {
    width: 1rem;
    height: 1rem;
    flex-shrink: 0;
}

.icon.text-primary {
    color: hsl(var(--primary));
}

.chevron {
    opacity: 0.5;
}

/* ── Utilities ─────────────────────────────────────── */

.hidden {
    display: none !important;
}

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

.mt-6 {
    margin-top: 1.5rem;
}

.text-center {
    text-align: center;
}

.text-hint {
    font-size: 0.75rem;
    color: hsl(var(--muted-foreground));
}

/* ── Toast Notification ────────────────────────────── */

.toast {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    z-index: 9999;
    padding: 0.75rem 1.25rem;
    background: hsl(var(--foreground));
    color: hsl(var(--background));
    border-radius: var(--radius);
    font-size: 0.875rem;
    box-shadow: var(--shadow-elevated);
    opacity: 0;
    transform: translateY(1rem);
    transition: opacity 0.3s, transform 0.3s;
    pointer-events: none;
}

.toast.show {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

/* ── Responsive ────────────────────────────────────── */

@media (min-width: 640px) {
    .tool-title {
        font-size: 2.25rem;
    }

    .btn-row {
        flex-direction: row;
    }
}

@media (max-width: 639px) {
    .btn-row {
        flex-direction: column;
    }

    .btn-row .btn {
        width: 100%;
    }

    .sticky-bar {
        padding: 0.5rem 1rem;
    }
}

/* WordPress admin bar fix */
.admin-bar .sticky-bar {
    bottom: 0;
}

.admin-bar .tool-dropdown {
    top: calc(100% + 4px);
}
