/* =============================================
   Free Files Public Page — Redesigned UI
   ============================================= */

/* ── Page Wrapper ── */
.free-files-page {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px 80px;
    min-height: 60vh;
    color: #1f2937;
}

/* ── Hero Banner ── */
.free-files-hero {
    background: #166534;
    margin: 0 -24px 48px;
    padding: 64px 24px 72px;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.free-files-hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background: transparent;
    pointer-events: none;
}

.free-files-hero::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    right: 0;
    height: 40px;
    background: #D5EBE4;
    clip-path: ellipse(55% 100% at 50% 100%);
}

.free-files-hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(255,255,255,0.15);
    border: 1px solid rgba(255,255,255,0.25);
    color: rgba(255,255,255,0.95);
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    padding: 6px 16px;
    border-radius: 100px;
    margin-bottom: 20px;
    backdrop-filter: blur(8px);
}

.free-files-hero-badge i {
    font-size: 0.75rem;
}

.free-files-hero h1 {
    color: #fff;
    font-size: clamp(2rem, 5vw, 3.2rem);
    font-weight: 800;
    margin: 0 0 16px;
    letter-spacing: -0.5px;
    text-shadow: 0 2px 12px rgba(0,0,0,0.15);
}

.free-files-hero p {
    color: rgba(255,255,255,0.88);
    font-size: clamp(1rem, 2vw, 1.15rem);
    max-width: 540px;
    margin: 0 auto;
    line-height: 1.65;
}

/* ── Stats Row ── */
.free-files-stats {
    display: flex;
    justify-content: center;
    gap: 32px;
    flex-wrap: wrap;
    margin-top: 36px;
}

.free-files-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.free-files-stat-num {
    font-size: 1.6rem;
    font-weight: 800;
    color: #fff;
    line-height: 1;
}

.free-files-stat-label {
    font-size: 0.75rem;
    color: rgba(255,255,255,0.75);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

/* ── Search Box ── */
.free-files-search-wrap {
    max-width: 680px;
    margin: 0 auto 36px;
}

.free-files-search {
    background: #fff;
    border: 1.5px solid #d1fae5;
    border-radius: 16px;
    padding: 20px 24px;
    box-shadow: 0 4px 24px rgba(22, 101, 52, 0.08);
}

.free-files-search label {
    display: block;
    font-weight: 700;
    font-size: 0.9rem;
    color: #166534;
    margin-bottom: 12px;
    letter-spacing: 0.01em;
}

.free-files-search-controls {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.free-files-search-input-wrap {
    flex: 1;
    min-width: 200px;
    position: relative;
    display: flex;
    align-items: center;
}

.free-files-search-input-wrap i {
    position: absolute;
    left: 14px;
    color: #94a3b8;
    font-size: 0.95rem;
    pointer-events: none;
}

.free-files-search input {
    width: 100%;
    padding: 12px 14px 12px 40px;
    border: 1.5px solid #e2e8f0;
    border-radius: 10px;
    font: inherit;
    font-size: 0.95rem;
    background: #f8fafc;
    color: #1f2937;
    transition: border-color 0.2s, box-shadow 0.2s;
    outline: none;
}

.free-files-search input:focus {
    border-color: #16a34a;
    background: #fff;
    box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.12);
}

.free-files-search input::placeholder {
    color: #b0bec5;
}

.free-files-search button {
    background: #166534;
    color: white;
    border: 0;
    border-radius: 10px;
    padding: 12px 22px;
    font: inherit;
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(22, 101, 52, 0.25);
}

.free-files-search button:hover {
    background: #14532d;
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(22, 101, 52, 0.35);
}

.free-files-search button:active {
    transform: translateY(0);
}

.free-files-clear-btn {
    color: #64748b;
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: none;
    padding: 8px 12px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: color 0.2s, background 0.2s;
    white-space: nowrap;
}

.free-files-clear-btn:hover {
    color: #ef4444;
    background: #fef2f2;
}

/* ── Results Info Bar ── */
.free-files-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid #e2e8f0;
}

.free-files-count {
    font-size: 0.9rem;
    color: #64748b;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
}

.free-files-count strong {
    color: #166534;
    font-weight: 700;
}

.free-files-count-pill {
    background: #dcfce7;
    color: #15803d;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 2px 10px;
    border-radius: 100px;
    display: inline-block;
}

/* ── Grid ── */
.free-files-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 290px), 1fr));
    gap: 28px;
    margin-top: 4px;
}

/* ── Card ── */
.free-file-card {
    border: 1px solid #e8f5e9;
    border-radius: 16px;
    overflow: hidden;
    background: #fff;
    display: flex;
    flex-direction: column;
    box-shadow: 0 2px 12px rgba(22, 101, 52, 0.06);
    transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}

.free-file-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 36px rgba(22, 101, 52, 0.14);
    border-color: #bbf7d0;
}

/* Card image / placeholder */
.free-file-image {
    height: 210px;
    background: #f0fdf4;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #86efac;
    font-size: 4rem;
    position: relative;
    overflow: hidden;
    flex-shrink: 0;
}

.free-file-image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

/* Free badge on card image */
.free-file-badge {
    position: absolute;
    top: 12px;
    left: 12px;
    background: #166534;
    color: #fff;
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    padding: 4px 10px;
    border-radius: 100px;
    box-shadow: 0 2px 8px rgba(22, 101, 52, 0.3);
    z-index: 1;
}

/* File-type icon chip on bottom-right of image */
.free-file-type-chip {
    position: absolute;
    bottom: 10px;
    right: 10px;
    background: rgba(255,255,255,0.9);
    backdrop-filter: blur(6px);
    border: 1px solid #d1fae5;
    color: #166534;
    font-size: 0.72rem;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    gap: 5px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

/* Card content area */
.free-file-content {
    padding: 22px 22px 20px;
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow-wrap: anywhere;
}

.free-file-content h2 {
    font-size: 1.05rem;
    font-weight: 700;
    color: #0f172a;
    margin: 0 0 10px;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.free-file-content p {
    color: #64748b;
    font-size: 0.88rem;
    line-height: 1.7;
    margin: 0 0 20px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Download button */
.free-file-download {
    margin-top: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    background: #166534;
    color: white;
    text-decoration: none;
    border-radius: 10px;
    padding: 12px 18px;
    font: inherit;
    font-size: 0.9rem;
    font-weight: 700;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(22, 101, 52, 0.22);
    border: none;
    cursor: pointer;
}

.free-file-download:hover {
    background: #14532d;
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(22, 101, 52, 0.32);
}

.free-file-download:active {
    transform: translateY(0);
}

.free-file-download i {
    font-size: 0.95rem;
    animation: none;
    transition: transform 0.2s;
}

.free-file-download:hover i {
    transform: translateY(2px);
}

/* Unavailable state */
.free-file-unavailable {
    margin-top: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px;
    background: #f8fafc;
    color: #94a3b8;
    border-radius: 10px;
    font-size: 0.85rem;
    font-weight: 500;
    border: 1.5px dashed #e2e8f0;
}

/* ── Empty State ── */
.free-files-empty {
    text-align: center;
    padding: 72px 24px;
    color: #64748b;
    max-width: 420px;
    margin: 0 auto;
}

.free-files-empty-icon {
    width: 88px;
    height: 88px;
    background: #f0fdf4;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 24px;
    font-size: 2.4rem;
    color: #86efac;
    box-shadow: 0 4px 20px rgba(22, 101, 52, 0.1);
}

.free-files-empty h2 {
    color: #1e293b;
    font-size: 1.3rem;
    font-weight: 700;
    margin: 0 0 12px;
}

.free-files-empty p {
    font-size: 0.95rem;
    line-height: 1.65;
    color: #64748b;
    margin: 0;
}

/* Screen-reader only */
.free-file-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ── Responsive ── */
@media (max-width: 768px) {
    .free-files-hero {
        margin: 0 -24px 36px;
        padding: 48px 24px 60px;
    }

    .free-files-stats {
        gap: 24px;
    }
}

@media (max-width: 600px) {
    .free-files-page {
        padding: 0 16px 60px;
    }

    .free-files-hero {
        margin: 0 -16px 32px;
        padding: 44px 20px 56px;
    }

    .free-files-search {
        padding: 16px 18px;
    }

    .free-files-search-controls {
        flex-direction: column;
        align-items: stretch;
    }

    .free-files-search-input-wrap {
        min-width: 0;
    }

    .free-files-search button {
        justify-content: center;
        width: 100%;
    }

    .free-files-clear-btn {
        justify-content: center;
        width: 100%;
        text-align: center;
    }

    .free-files-grid {
        gap: 20px;
    }

    .free-files-toolbar {
        flex-direction: column;
        align-items: flex-start;
    }
}
