/* ============================================================
   Freebie Library — Front-End Styles
   Buttons use .wp-element-button to inherit theme styles.
   Colors/layout overrideable via Customizer.
   ============================================================ */

/* ── Base button (inherits from theme via wp-element-button) ── */
.fl-btn {
    display: inline-block;
    cursor: pointer;
    text-decoration: none;
    transition: opacity .15s, transform .1s;
}
.fl-btn:hover  { opacity: .87; transform: translateY(-1px); }
.fl-btn:active { transform: none; }

/* wp-element-button is the WP standard class that all themes (inc. Kadence)
   style for their global button settings. We add it alongside fl-btn.
   This means font, size, colors, border-radius all come from the theme.     */

/* Only apply fallback colors if the theme hasn't defined wp-element-button  */
.fl-btn.wp-element-button:not([style]):not(:where(.wp-block *)) {
    background: #333;
    color: #fff;
    padding: 12px 24px;
    border-radius: 6px;
    border: none;
    font-size: 1em;
    font-weight: 600;
}

/* Download button — same class, sizing adjusted to fit inside the card */
.fl-dl-btn.wp-element-button {
    padding: 9px 18px;
    font-size: .9em;
    white-space: nowrap;
}

.fl-btn:disabled,
.fl-btn[disabled] {
    opacity: .6;
    cursor: not-allowed;
    transform: none;
}

/* ── Messages ────────────────────────────────────────────── */
.fl-message {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 16px;
    font-size: .95em;
}
.fl-message.fl-error {
    background: #fff0f0;
    border: 1px solid #f5c6c6;
    color: #c0392b;
}
.fl-message.fl-success {
    background: #f0fff4;
    border: 1px solid #b2dfdb;
    color: #2d6a4f;
}

/* ── Signup page ─────────────────────────────────────────── */
.fl-signup-wrap {
    max-width: 540px;
    margin: 40px auto;
    font-family: inherit;
}

.fl-signup-box {
    background: #fff;
    border-radius: 16px; /* default; overridden by Customizer */
    padding: 48px 40px;
    box-shadow: 0 2px 12px rgba(0,0,0,.08); /* default; overridden by Customizer */
    text-align: center;
}

.fl-signup-icon { font-size: 3em; margin-bottom: 12px; }

.fl-signup-heading {
    font-size: 1.7em;
    margin: 0 0 12px;
    color: #1a1a2e;
}

.fl-signup-sub {
    color: #555;
    margin-bottom: 28px;
    line-height: 1.6;
}

.fl-form { text-align: left; }

.fl-form-row { margin-bottom: 16px; }

.fl-form-row label {
    display: block;
    font-size: .9em;
    font-weight: 600;
    color: #444;
    margin-bottom: 6px;
}

.fl-form input[type="email"],
.fl-form input[type="password"],
.fl-form input[type="text"],
.fl-form-row input {
    width: 100%;
    box-sizing: border-box;
    padding: 12px 14px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1em;
    transition: border-color .2s;
    outline: none;
    font-family: inherit;
}
.fl-form input:focus { border-color: #eee; }

.fl-form .fl-btn { width: 100%; margin-top: 8px; text-align: center; }

.fl-privacy {
    text-align: center;
    color: #999;
    font-size: .82em;
    margin-top: 12px;
}

.fl-success-text {
    font-size: 1.1em;
    color: #2d6a4f;
    margin-bottom: 20px;
}

/* ── Password gate ───────────────────────────────────────── */
.fl-gate-wrap {
    max-width: 480px;
    margin: 40px auto;
}

.fl-gate-box {
    background: #fff;
    border-radius: 16px; /* default; overridden by Customizer */
    padding: 48px 40px;
    box-shadow: 0 2px 12px rgba(0,0,0,.08); /* default; overridden by Customizer */
    text-align: center;
}

.fl-gate-icon { font-size: 3em; margin-bottom: 12px; }

.fl-gate-box h2 {
    font-size: 1.7em;
    font-weight: 700;
    margin: 0 0 12px;
    color: #1a1a2e;
}

.fl-gate-box p { color: #555; margin-bottom: 12px; }

.fl-gate-box .fl-form { margin-top: 20px; text-align: left; }
.fl-gate-box .fl-btn  { width: 100%; margin-top: 12px; }

/* ── Category filter bar ─────────────────────────────────── */
.fl-filter-wrap {
    margin-bottom: 32px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

/* Pills style */
.fl-filter-pills .fl-filter-btn {
    background: #fff;
	color: color-mix(in srgb, var(--global-palette-btn-bg, #333333) 100%, white);
    border-radius: 999px;
    border: 1px solid color-mix(in srgb, var(--global-palette-btn-bg, #333333) 50%, white); 
    padding: 7px 20px;
    font-size: .8em;
    font-weight: 600;
    cursor: pointer;
    transition: all .15s;
    font-family: inherit;
}
.fl-filter-pills .fl-filter-btn:hover {
    background: color-mix(in srgb, var(--global-palette-btn-bg, #333333) 50%, white);
    color: var(--global-palette-btn, #ffffff);
}
.fl-filter-pills .fl-filter-btn.active {
    background: var(--global-palette-btn-bg);
    color: var(--global-palette-btn);
}
.fl-filter-pills .fl-filter-child {
    font-size: .82em;
    padding: 5px 14px;
    opacity: .85;
}

/* Tabs style */
.fl-filter-tabs .fl-filter-btn {
    background: transparent;
    color: color-mix(in srgb, var(--global-palette-btn-bg, #333333) 50%, white);
    border: none;
    border-bottom: 3px solid transparent;
    border-radius: 0;
    padding: 8px 14px;
    font-size: .95em;
    font-weight: 600;
    cursor: pointer;
    transition: color .15s, border-color .15s;
    font-family: inherit;
}
.fl-filter-tabs .fl-filter-btn:hover  { color: var(--global-palette-btn-bg); box-shadow: none;}
.fl-filter-tabs .fl-filter-btn.active { color: var(--global-palette-btn-bg); border-bottom-color: var(--global-palette-btn-bg); box-shadow: none;}
.fl-filter-tabs .fl-filter-child      { font-size: .85em; padding-left: 20px; }

/* Dropdown style */
.fl-filter-dropdown { display: block; }
.fl-cat-dropdown {
    padding: 10px 14px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1em;
    font-family: inherit;
    cursor: pointer;
    min-width: 220px;
    outline: none;
    transition: border-color .2s;
}
.fl-cat-dropdown:focus { border-color: #eee; }

/* No results */
.fl-no-results {
    padding: 24px;
    text-align: center;
    color: #888;
    background: #fafafa;
    border-radius: 12px;
    margin-bottom: 16px;
}

/* ── Library grid (base — Customizer CSS overrides these) ─── */
.fl-library-wrap {
    max-width: 1100px;
    margin: 0 auto;
    padding: 20px 0;
}

.fl-library-heading {
    font-size: 2em;
    margin-bottom: 6px;
}

.fl-library-sub {
    margin-bottom: 28px;
}

.fl-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr); /* overridden by Customizer */
    gap: 24px;                              /* overridden by Customizer */
}

/* ── Card ────────────────────────────────────────────────── */
.fl-card-item {
    background: #fff;
    border-radius: 12px; /* default; overridden by Customizer */
    box-shadow: 0 2px 12px rgba(0,0,0,.08); /* default; overridden by Customizer */
    overflow: hidden;
    transition: transform .2s, box-shadow .2s;
    display: flex;
    flex-direction: column;
}

.fl-card-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 24px rgba(0,0,0,.14); /* default; overridden by Customizer */
}

.fl-item-thumb {
    width: 100%;
    height: 180px; /* overridden by Customizer */
    overflow: hidden;
    background: linear-gradient(135deg, #f3f0ff, #e8e0ff);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.fl-item-thumb img.fl-thumb,
.fl-item-thumb picture.fl-thumb img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100% !important;
    object-fit: cover;
}

.fl-thumb-placeholder {
    font-size: 3.5em;
    opacity: .6;
}

.fl-item-body {
    padding: 18px;
    display: flex;
    flex-direction: column;
    flex: 1;
}

/* Category badges on each card */
.fl-item-cats {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 8px;
}
.fl-item-cat-badge {
    background: #f3f0ff;
    color: #6d28d9;
    font-size: .73em;
    font-weight: 600;
    padding: 2px 10px;
    border-radius: 999px;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.fl-item-title {
    font-size: 1.05em;
    font-weight: 700;
    margin: 0 0 8px;
    color: #1a1a2e;
    line-height: 1.3;
}

.fl-item-desc {
    color: #666;
    font-size: .9em;
    line-height: 1.5;
    margin-bottom: 16px;
    flex: 1;
}

.fl-item-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: auto;
    gap: 8px;
}

.fl-dl-count {
    color: #999;
    font-size: .82em;
    white-space: nowrap;
}

/* ── Responsive (base breakpoints — Customizer adds its own) ─ */
@media (max-width: 900px) {
    .fl-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 600px) {
    .fl-signup-box,
    .fl-gate-box    { padding: 32px 20px; }
    .fl-grid        { grid-template-columns: 1fr; }
    .fl-filter-wrap { gap: 6px; }
    .fl-filter-pills .fl-filter-btn { padding: 6px 12px; font-size: .82em; }
}

/* ── Sidebar layout ────────────────────────────────────────────────────────── */
/* Default sidebar grid — overridden by Customizer for width/gap */
.fl-library-with-sidebar {
    display: grid;
    grid-template-columns: 220px 1fr;
    gap: 24px;
    align-items: start;
}

/* Make the sidebar sticky so it stays visible while scrolling */
.fl-sidebar-filter {
    position: sticky;
    top: 20px;
}

/* Sidebar filter buttons stack vertically */
.fl-sidebar-filter .fl-filter-btn {
    display: block;
    width: 100%;
    text-align: left;
    margin-bottom: 4px;
    margin-right: 0;
}

/* Sidebar pills */
.fl-sidebar-filter.fl-filter-pills .fl-filter-btn {
    border-radius: 999px;
}

/* Sidebar tabs — vertical left-border style instead of underline */
.fl-sidebar-filter.fl-filter-tabs .fl-filter-btn {
    border-bottom: none;
    border-left: 3px solid transparent;
    border-radius: 0;
    padding-left: 12px;
}
.fl-sidebar-filter.fl-filter-tabs .fl-filter-btn.active {
    border-left-color: currentColor;
    border-bottom: none;
    background: transparent;
}

/* Sidebar dropdown fills the column */
.fl-sidebar-filter.fl-filter-dropdown .fl-cat-dropdown {
    width: 100%;
}

/* Child category indent in sidebar */
.fl-sidebar-filter .fl-filter-child {
    padding-left: 28px;
    font-size: 0.9em;
    opacity: 0.85;
}

/* Collapse to top layout on small screens */
@media (max-width: 700px) {
    .fl-library-with-sidebar {
        grid-template-columns: 1fr;
    }
    .fl-sidebar-filter {
        position: static;
    }
    .fl-sidebar-filter .fl-filter-btn {
        display: inline-block;
        width: auto;
        margin-right: 6px;
        margin-bottom: 6px;
    }
    .fl-sidebar-filter.fl-filter-tabs .fl-filter-btn {
        border-left: none;
        border-bottom: 2px solid transparent;
        padding-left: 0;
    }
    .fl-sidebar-filter.fl-filter-tabs .fl-filter-btn.active {
        border-bottom-color: currentColor;
        border-left: none;
    }
}

/* ── Category badges — top-left image overlay ──────────────────────────────── */
.fl-item-thumb {
    position: relative; /* ensure overlay works for fixed-height mode too */
}
.fl-item-cats {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 2;
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    max-width: calc(100% - 20px);
}
.fl-item-cat-badge {
    display: inline-block;
    font-size: 0.7em;
    font-weight: 600;
    letter-spacing: .03em;
    text-transform: uppercase;
    padding: 3px 8px;
    border-radius: 999px;
    background: rgba(0,0,0,0.55);
    color: #fff;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    white-space: nowrap;
}

/* ── Unboxed card style ─────────────────────────────────────────────────────── */
.fl-content-style-unboxed .fl-card-item {
    background: transparent;
    box-shadow: none;
    border: none;
}
.fl-content-style-unboxed .fl-card-item:hover {
    box-shadow: none;
    transform: none;
}
.fl-content-style-unboxed .fl-item-body {
    padding: 12px 0;
}

/* ── Downloaded button state ────────────────────────────────────────────────── */
.fl-dl-btn--done {
    opacity: 0.75;
    cursor: default;
}
.fl-dl-btn--done:hover {
    opacity: 0.75;
}
