/* ═══════════════════════════════════════════════════════════════════════════
   Freely Useful — Base Stylesheet (fu-base.css)
   ═══════════════════════════════════════════════════════════════════════════
   Shared styles for all Freely Useful tools.
   Self-contained design system with a clean, professional palette.
   Override any --fu-* variable in your theme to customize.
   ═══════════════════════════════════════════════════════════════════════════ */

/* ─── CSS Custom Properties ───────────────────────────────────────────────
   A complete, self-contained palette. Slate tones + muted indigo accent.
   Clean, professional, modern — works on any page background.
   ──────────────────────────────────────────────────────────────────────── */
:root {
    /* Typography */
    --fu-font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    --fu-font-mono: 'SFMono-Regular', 'Consolas', 'Liberation Mono', 'Menlo', monospace;

    /* Spacing & Shape */
    --fu-radius: 8px;
    --fu-radius-sm: 6px;
    --fu-radius-lg: 12px;
    --fu-transition: 0.2s ease;
    --fu-max-width: 900px;
    --fu-gap: 1rem;

    /* Elevation */
    --fu-shadow: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
    --fu-shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08), 0 2px 4px rgba(0, 0, 0, 0.04);
    --fu-shadow-lg: 0 12px 24px rgba(0, 0, 0, 0.1), 0 4px 8px rgba(0, 0, 0, 0.05);

    /* Colors — Slate + Indigo palette */
    --fu-accent: #5468ff;
    --fu-accent-hover: #4356db;
    --fu-accent-light: rgba(84, 104, 255, 0.08);
    --fu-text: #1e293b;
    --fu-text-muted: #64748b;
    --fu-bg: #f8fafc;
    --fu-panel-bg: #ffffff;
    --fu-input-bg: #f8fafc;
    --fu-border: #e2e8f0;
    --fu-border-focus: #cbd5e1;
    --fu-success: #16a34a;
    --fu-warning: #f59e0b;
    --fu-danger: #ef4444;
    --fu-btn-primary-text: #ffffff;
}

/* ─── Tool Wrapper ────────────────────────────────────────────────────────── */
.fu-tool-wrapper {
    max-width: var(--fu-max-width);
    margin: 0 auto 2rem auto;
    padding: 1.5rem;
    font-family: var(--fu-font-family);
    color: var(--fu-text);
    background: var(--fu-bg);
    border-radius: var(--fu-radius-lg);
}

.fu-tool {
    display: flex;
    flex-direction: column;
    gap: var(--fu-gap);
}

/* ─── Panels (Input / Output Sections) ────────────────────────────────────── */
.fu-panel {
    background: var(--fu-panel-bg);
    border: 1px solid var(--fu-border);
    border-radius: var(--fu-radius);
    padding: 1.25rem;
    box-shadow: var(--fu-shadow);
    transition: box-shadow var(--fu-transition);
}

.fu-panel:focus-within {
    box-shadow: var(--fu-shadow-md);
}

.fu-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.75rem;
    gap: 0.5rem;
}

.fu-panel-title {
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--fu-text-muted);
    margin: 0;
}

/* ─── Form Elements ───────────────────────────────────────────────────────── */
input.fu-input,
textarea.fu-textarea,
select.fu-select {
    width: 100%;
    padding: 0.5rem 0.75rem;
    font-family: var(--fu-font-family);
    font-size: 0.875rem;
    line-height: 1.5;
    color: var(--fu-text);
    background: var(--fu-input-bg) !important;
    border: 1px solid #e2e8f0 !important;
    border-radius: 6px !important;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05) !important;
    transition: border-color var(--fu-transition), box-shadow var(--fu-transition), background-color var(--fu-transition);
    box-sizing: border-box;
}

input.fu-input:hover,
textarea.fu-textarea:hover,
select.fu-select:hover {
    border-color: #cbd5e1 !important;
    background-color: #f1f5f9 !important;
}

select.fu-select {
    appearance: none !important;
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: right 0.75rem center !important;
    background-size: 0.875rem !important;
    padding-right: 2rem !important;
    cursor: pointer;
}

input.fu-input:focus,
textarea.fu-textarea:focus,
select.fu-select:focus {
    outline: none !important;
    border-color: var(--fu-accent) !important;
    background-color: #ffffff !important;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05), 0 0 0 3px var(--fu-accent-light) !important;
}

.fu-textarea {
    min-height: 150px;
    resize: vertical;
    font-family: var(--fu-font-family);
}

.fu-textarea-mono {
    font-family: var(--fu-font-mono);
    font-size: 0.9rem;
}

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

/* ─── Buttons ─────────────────────────────────────────────────────────────── */
.fu-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    font-family: var(--fu-font-family);
    font-size: 0.9rem;
    font-weight: 500;
    line-height: 1;
    text-decoration: none;
    border: 1px solid var(--fu-border);
    border-radius: var(--fu-radius-sm);
    background: var(--fu-panel-bg);
    color: var(--fu-text);
    cursor: pointer;
    transition: all var(--fu-transition);
    white-space: nowrap;
}

.fu-btn:hover {
    box-shadow: var(--fu-shadow);
    border-color: var(--fu-border-focus);
    background: var(--fu-bg);
}

.fu-btn:active {
    transform: scale(0.97);
}

.fu-btn:focus-visible {
    outline: 2px solid var(--fu-accent);
    outline-offset: 2px;
}

.fu-btn-primary {
    background: var(--fu-accent);
    color: var(--fu-btn-primary-text);
    border-color: var(--fu-accent);
}

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

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

/* ─── Button Group ────────────────────────────────────────────────────────── */
.fu-btn-group {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

/* ─── Output Area ─────────────────────────────────────────────────────────── */
.fu-output {
    background: var(--fu-panel-bg);
    border: 1px solid var(--fu-border);
    border-radius: var(--fu-radius-sm);
    padding: 0.875rem;
    min-height: 60px;
    font-family: var(--fu-font-family);
    font-size: 1rem;
    line-height: 1.6;
    white-space: pre-wrap;
    word-break: break-word;
}

.fu-output-mono {
    font-family: var(--fu-font-mono);
    font-size: 0.9rem;
}

/* ─── Stats Row ───────────────────────────────────────────────────────────── */
.fu-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.fu-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1 1 0;
    min-width: 80px;
    padding: 0.75rem 0.5rem;
    background: var(--fu-panel-bg);
    border: 1px solid var(--fu-border);
    border-radius: var(--fu-radius);
    text-align: center;
    transition: background var(--fu-transition), box-shadow var(--fu-transition);
}

.fu-stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1.2;
    color: var(--fu-accent);
}

.fu-stat-label {
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--fu-text-muted);
    margin-top: 0.25rem;
}

/* Hero variant — use for the single most important output in a tool */
.fu-stat-hero {
    border-color: var(--fu-accent);
    background: linear-gradient(180deg, var(--fu-panel-bg) 0%, var(--fu-accent-light) 100%);
}

.fu-stat-hero .fu-stat-value {
    font-size: 2.25rem;
    font-weight: 800;
}

/* ─── Responsive Grid ─────────────────────────────────────────────────────── */
.fu-grid {
    display: grid;
    gap: var(--fu-gap);
}

.fu-grid-2 {
    grid-template-columns: 1fr 1fr;
}

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

/* ─── Copy Feedback ───────────────────────────────────────────────────────── */
.fu-copy-feedback {
    position: relative;
}

.fu-copy-feedback::after {
    content: 'Copied!';
    position: absolute;
    top: -2rem;
    left: 50%;
    transform: translateX(-50%);
    background: var(--fu-accent);
    color: var(--fu-btn-primary-text);
    font-size: 0.75rem;
    padding: 0.25rem 0.625rem;
    border-radius: var(--fu-radius-sm);
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--fu-transition);
}

.fu-copy-feedback.fu-copied::after {
    opacity: 1;
}

/* ─── Privacy Badge ───────────────────────────────────────────────────────── */
.fu-privacy-badge {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
    margin-top: 0.75rem;
    padding: 0.5rem;
    font-size: 0.8rem;
    color: var(--fu-text-muted);
    text-align: center;
}

/* ─── Utility Classes ─────────────────────────────────────────────────────── */
.fu-hidden {
    display: none !important;
}

.fu-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

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

.fu-mt-1 { margin-top: 0.5rem; }
.fu-mt-2 { margin-top: 1rem; }
.fu-mb-1 { margin-bottom: 0.5rem; }
.fu-mb-2 { margin-bottom: 1rem; }

/* ─── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 640px) {
    .fu-tool-wrapper {
        padding: 0 0.5rem;
    }

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

    .fu-stats {
        gap: 0.5rem;
    }

    .fu-stat {
        min-width: 60px;
        padding: 0.5rem 0.375rem;
    }

    .fu-stat-value {
        font-size: 1.25rem;
    }

    .fu-btn-group {
        flex-direction: column;
    }

    .fu-btn-group .fu-btn {
        width: 100%;
    }
}

/* ─── Related Tools Section ───────────────────────────────────────────────── */
.fu-related-tools {
    margin-top: 2.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--fu-border);
}

.fu-related-tools h2 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--fu-text);
    margin-bottom: 1rem;
}

.fu-related-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 0.75rem;
}

.fu-related-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    background: var(--fu-bg);
    border: 1px solid var(--fu-border);
    border-radius: var(--fu-radius);
    text-decoration: none;
    color: var(--fu-text);
    transition: border-color var(--fu-transition), box-shadow var(--fu-transition), transform var(--fu-transition);
}

.fu-related-card:hover {
    border-color: var(--fu-accent);
    box-shadow: var(--fu-shadow-md);
    transform: translateY(-1px);
}

.fu-related-title {
    font-weight: 500;
    font-size: 0.95rem;
}

.fu-related-arrow {
    font-size: 1.1rem;
    color: var(--fu-accent);
    transition: transform var(--fu-transition);
}

.fu-related-card:hover .fu-related-arrow {
    transform: translateX(3px);
}

/* ─── Reduced Motion ──────────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
    }
}
