/**
 * ChildFund Manuals — Frontend Styles
 * Shortcode components: Document Grid, Category Buttons, Download Button
 * Design tokens aligned with V2 prototype
 */

/* ═══════════════════════════════════════════
   DESIGN TOKENS
   ═══════════════════════════════════════════ */
:root {
    --cfm-green-primary: #2d6a4f;
    --cfm-green-dark: #1a3c34;
    --cfm-green-light: #40916c;
    --cfm-green-bg: #f0fdf4;
    --cfm-orange: #f77f00;
    --cfm-orange-bg: #fff7ed;
    --cfm-white: #ffffff;
    --cfm-gray-50: #f8fafc;
    --cfm-gray-100: #f1f5f9;
    --cfm-gray-200: #e2e8f0;
    --cfm-gray-300: #cbd5e1;
    --cfm-gray-400: #94a3b8;
    --cfm-gray-500: #64748b;
    --cfm-gray-600: #475569;
    --cfm-gray-700: #334155;
    --cfm-gray-800: #1e293b;
    --cfm-radius-sm: 6px;
    --cfm-radius-md: 8px;
    --cfm-radius-lg: 12px;
    --cfm-shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
    --cfm-shadow-md: 0 4px 6px rgba(0, 0, 0, 0.05), 0 2px 4px rgba(0, 0, 0, 0.03);
    --cfm-shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.08);
    --cfm-transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}


/* ═══════════════════════════════════════════
   FILTER BAR
   ═══════════════════════════════════════════ */
.cfm-filter-bar {
    margin-bottom: 1.5rem;
}

.cfm-search-wrapper {
    position: relative;
    max-width: 100%;
}

.cfm-search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1rem;
    pointer-events: none;
}

.cfm-grid-search {
    width: 100%;
    padding: 12px 16px 12px 40px;
    border: 1px solid var(--cfm-gray-200);
    border-radius: var(--cfm-radius-md);
    font-size: 0.95rem;
    font-family: 'Inter', sans-serif;
    background: var(--cfm-white);
    outline: none;
    transition: border-color var(--cfm-transition), box-shadow var(--cfm-transition);
}

.cfm-grid-search:focus {
    border-color: var(--cfm-green-primary);
    box-shadow: 0 0 0 3px rgba(45, 106, 79, 0.12);
}


/* ═══════════════════════════════════════════
   DOCUMENT GRID
   ═══════════════════════════════════════════ */
.cfm-doc-grid {
    display: grid;
    gap: 16px;
}

.cfm-cols-2 { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
.cfm-cols-3 { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.cfm-cols-4 { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }


/* ═══════════════════════════════════════════
   DOCUMENT CARD (Bookshelf Pattern)
   ═══════════════════════════════════════════ */
.cfm-doc-card {
    display: flex;
    align-items: center;
    padding: 16px 20px;
    background: var(--cfm-white);
    border: 1px solid var(--cfm-gray-200);
    border-radius: var(--cfm-radius-md);
    box-shadow: var(--cfm-shadow-sm);
    text-decoration: none;
    color: var(--cfm-gray-700);
    transition: all var(--cfm-transition);
    position: relative;
    overflow: hidden;
}

.cfm-doc-card::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: var(--cfm-green-primary);
    transform: scaleY(0);
    transition: transform var(--cfm-transition);
    border-radius: 0 4px 4px 0;
}

.cfm-doc-card:hover {
    border-color: var(--cfm-green-primary);
    box-shadow: var(--cfm-shadow-md);
    transform: translateY(-2px);
}

.cfm-doc-card:hover::before {
    transform: scaleY(1);
}

.cfm-doc-card-icon {
    font-size: 1.8rem;
    margin-right: 14px;
    flex-shrink: 0;
    width: 40px;
    text-align: center;
}

.cfm-doc-card-info {
    flex: 1;
    min-width: 0;
}

.cfm-doc-card-title {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--cfm-green-dark);
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cfm-doc-card-meta {
    font-size: 0.8rem;
    color: var(--cfm-gray-400);
}

.cfm-doc-card-action {
    font-size: 1.2rem;
    margin-left: 12px;
    flex-shrink: 0;
    opacity: 0.5;
    transition: opacity var(--cfm-transition), transform var(--cfm-transition);
}

.cfm-doc-card:hover .cfm-doc-card-action {
    opacity: 1;
    transform: translateX(2px);
}


/* ═══════════════════════════════════════════
   CATEGORY BUTTON GRID
   ═══════════════════════════════════════════ */
.cfm-button-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 2rem;
}

.cfm-big-button {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 18px 22px;
    background: var(--cfm-green-primary);
    color: var(--cfm-white);
    border-radius: var(--cfm-radius-lg);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.95rem;
    box-shadow: var(--cfm-shadow-sm);
    transition: all var(--cfm-transition);
    position: relative;
    overflow: hidden;
}

.cfm-big-button::after {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.08), transparent);
    pointer-events: none;
}

.cfm-big-button:hover {
    transform: translateY(-3px);
    box-shadow: var(--cfm-shadow-lg);
    color: var(--cfm-white);
}

.cfm-big-button.variant-2 { background: var(--cfm-green-light); }
.cfm-big-button.variant-3 { background: #0284c7; }
.cfm-big-button.variant-4 { background: #7c3aed; }
.cfm-big-button.variant-5 { background: var(--cfm-gray-600); }

.cfm-btn-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
}


/* ═══════════════════════════════════════════
   DOWNLOAD BUTTON
   ═══════════════════════════════════════════ */
.cfm-download-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 24px;
    background: var(--cfm-green-primary);
    color: var(--cfm-white);
    border-radius: var(--cfm-radius-sm);
    font-weight: 600;
    font-size: 0.95rem;
    text-decoration: none;
    transition: all var(--cfm-transition);
}

.cfm-download-btn:hover {
    background: var(--cfm-green-dark);
    transform: translateY(-2px);
    box-shadow: var(--cfm-shadow-md);
    color: var(--cfm-white);
}

.cfm-no-file {
    color: var(--cfm-gray-400);
    font-style: italic;
    font-size: 0.9rem;
}

.cfm-no-results {
    grid-column: 1 / -1;
    text-align: center;
    padding: 2rem;
    color: var(--cfm-gray-400);
    font-size: 0.95rem;
}


/* ═══════════════════════════════════════════
   INFO NOTICE
   ═══════════════════════════════════════════ */
.cfm-info-notice {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 18px;
    background: var(--cfm-green-bg);
    border: 1px solid #bbf7d0;
    border-radius: var(--cfm-radius-md);
    font-size: 0.9rem;
    color: var(--cfm-green-dark);
    margin-bottom: 1.5rem;
}

.cfm-info-notice .cfm-notice-icon {
    font-size: 1.2rem;
    flex-shrink: 0;
}


/* ═══════════════════════════════════════════
   ANIMATIONS
   ═══════════════════════════════════════════ */
.cfm-doc-card,
.cfm-big-button {
    animation: cfm-fadeInUp 0.5s ease-out both;
}

.cfm-doc-grid .cfm-doc-card:nth-child(1) { animation-delay: 0.05s; }
.cfm-doc-grid .cfm-doc-card:nth-child(2) { animation-delay: 0.10s; }
.cfm-doc-grid .cfm-doc-card:nth-child(3) { animation-delay: 0.15s; }
.cfm-doc-grid .cfm-doc-card:nth-child(4) { animation-delay: 0.20s; }
.cfm-doc-grid .cfm-doc-card:nth-child(5) { animation-delay: 0.25s; }
.cfm-doc-grid .cfm-doc-card:nth-child(6) { animation-delay: 0.30s; }

.cfm-button-grid .cfm-big-button:nth-child(1) { animation-delay: 0.05s; }
.cfm-button-grid .cfm-big-button:nth-child(2) { animation-delay: 0.10s; }
.cfm-button-grid .cfm-big-button:nth-child(3) { animation-delay: 0.15s; }
.cfm-button-grid .cfm-big-button:nth-child(4) { animation-delay: 0.20s; }
.cfm-button-grid .cfm-big-button:nth-child(5) { animation-delay: 0.25s; }
.cfm-button-grid .cfm-big-button:nth-child(6) { animation-delay: 0.30s; }

@keyframes cfm-fadeInUp {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}


/* ═══════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════ */
@media (max-width: 768px) {
    .cfm-doc-grid {
        grid-template-columns: 1fr !important;
    }

    .cfm-button-grid {
        grid-template-columns: 1fr 1fr;
    }

    .cfm-big-button {
        padding: 14px 16px;
        font-size: 0.85rem;
    }

    .cfm-doc-card {
        padding: 14px 16px;
    }

    .cfm-doc-card-title {
        font-size: 0.9rem;
    }
}

@media (max-width: 480px) {
    .cfm-button-grid {
        grid-template-columns: 1fr;
    }
}
