/**
 * ============================================================================
 * CERTIFICATIONS PAGE STYLES
 * ============================================================================
 * Page-specific styles for the certifications gallery page.
 * Extends the base style.css with components for search, filtering,
 * sorting, and certificate card display.
 * 
 * Table of Contents:
 * 1. Page Layout & Structure
 * 2. Hero Section
 * 3. Search Components
 * 4. Filter & Sort Controls
 * 5. Certifications Grid
 * 6. Certificate Card
 * 7. Badge Image Modal
 * 8. Responsive Breakpoints
 * ============================================================================
 */

/* ==========================================================================
   1. PAGE LAYOUT & STRUCTURE
   ========================================================================== */

/**
 * Flex container for sticky footer pattern.
 * Uses :has() selector to scope styles only when certifications hero exists.
 */
body:has(.certifications-hero) {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ==========================================================================
   2. HERO SECTION
   ========================================================================== */

.certifications-hero {
    min-height: 50vh;
    padding-top: 150px;
    padding-bottom: 50px;
}

/* ==========================================================================
   3. SEARCH COMPONENTS
   ========================================================================== */

.search-container {
    max-width: 500px;
    margin: 0 auto 40px;
}

.search-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.search-icon {
    position: absolute;
    left: 20px;
    color: var(--text-muted);
    font-size: 1rem;
}

.search-wrapper input {
    width: 100%;
    padding: 15px 20px 15px 50px;
    border: 2px solid rgba(138, 43, 226, 0.2);
    border-radius: 50px;
    background: var(--card-bg);
    color: var(--text);
    font-size: 1rem;
    font-family: 'Poppins', sans-serif;
    transition: all 0.3s ease;
}

.search-wrapper input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 20px rgba(138, 43, 226, 0.2);
}

.search-wrapper input::placeholder {
    color: var(--text-muted);
}

/* ==========================================================================
   4. FILTER & SORT CONTROLS
   ========================================================================== */

.filter-controls {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

/* Category filter button group - uses .filter-btn from style.css */
.project-filters {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 10px;
}

.sort-control {
    display: flex;
    align-items: center;
}

.sort-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 24px;
    background: var(--card-bg);
    border: 2px solid rgba(138, 43, 226, 0.2);
    border-radius: 30px;
    color: var(--text);
    font-size: 0.9rem;
    font-family: 'Poppins', sans-serif;
    cursor: pointer;
    transition: all 0.3s ease;
}

.sort-btn:hover {
    border-color: var(--primary);
    background: rgba(138, 43, 226, 0.1);
}

.sort-btn i {
    color: var(--primary);
    font-size: 1rem;
}

/* ==========================================================================
   5. CERTIFICATIONS GRID
   ========================================================================== */

#certifications-feed {
    flex: 1; /* Push footer to bottom via flex-grow */
    padding-top: 40px !important;
    padding-bottom: 60px;
}

.certifications-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 30px;
}

/* ==========================================================================
   6. CERTIFICATE CARD
   ========================================================================== */

.cert-card {
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 22px 20px;
    background: var(--card-bg);
    border: 1px solid rgba(138, 43, 226, 0.1);
    border-radius: 16px;
    text-align: center;
    transition: all 0.3s ease;
}

/* Gradient top border - reveals on hover */
.cert-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(to right, var(--primary), var(--accent));
    opacity: 0;
    transition: opacity 0.3s ease;
}

.cert-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 35px rgba(138, 43, 226, 0.12);
    border-color: var(--primary);
}

.cert-card:hover::before {
    opacity: 1;
}

/* Badge image container - clickable for modal */
.cert-badge {
    width: 96px;
    height: 96px;
    margin: 0 auto 16px;
    cursor: pointer;
    transition: transform 0.3s ease;
}

.cert-badge:hover {
    transform: scale(1.05);
}

.cert-badge img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* Card typography */
.cert-card h3 {
    font-size: 1.05rem;
    font-weight: 600;
    line-height: 1.4;
    margin-bottom: 10px;
    color: var(--text);
}

.cert-card p {
    flex-grow: 1; /* Push year/button to bottom */
    margin-bottom: 12px;
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* Year badge pill */
.cert-year {
    display: inline-block;
    padding: 5px 14px;
    margin-bottom: 12px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    border-radius: 20px;
    color: white;
    font-size: 0.8rem;
    font-weight: 600;
}

/* View Certificate button - extends .btn from style.css */
.cert-card .btn {
    width: 100%;
    max-width: 200px;
    padding: 10px 20px;
    justify-content: center;
}

/* ==========================================================================
   7. BADGE IMAGE MODAL
   ========================================================================== */

.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.9);
    opacity: 0;
    visibility: hidden;
    z-index: 10000;
    transition: all 0.3s ease;
}

.modal.active {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    max-width: 90%;
    max-height: 90%;
}

.modal-logo {
    max-width: 100%;
    max-height: 80vh;
    object-fit: contain;
    border-radius: 10px;
}

.modal-close {
    position: absolute;
    top: 20px;
    right: 30px;
    background: none;
    border: none;
    color: white;
    font-size: 3rem;
    cursor: pointer;
    transition: transform 0.3s ease;
}

.modal-close:hover {
    transform: scale(1.1);
}

/* ==========================================================================
   8. RESPONSIVE BREAKPOINTS
   ========================================================================== */

/* Tablet breakpoint */
@media (max-width: 768px) {
    .filter-controls {
        gap: 15px;
    }
    
    .project-filters {
        gap: 8px;
    }
    
    .certifications-grid {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
        gap: 20px;
    }
    
    .cert-card {
        padding: 25px 20px;
    }
    
    .cert-badge {
        width: 64px;
        height: 64px;
    }
    
    .cert-card h3 {
        font-size: 1rem;
        min-height: auto; /* Allow natural height on smaller screens */
    }
    
    #certifications-feed {
        padding-top: 30px !important;
    }
}

/* Mobile breakpoint */
@media (max-width: 480px) {
    .certifications-grid {
        grid-template-columns: 1fr; /* Single column on mobile */
        gap: 15px;
    }
    
    .search-wrapper input {
        padding: 12px 15px 12px 45px;
        font-size: 0.9rem;
    }
    
    .sort-btn {
        padding: 8px 16px;
        font-size: 0.85rem;
    }
    
    .cert-card {
        padding: 20px 15px;
    }

    .cert-badge {
        width: 56px;
        height: 56px;
    }
}


/* ── No-results state ───────────────────────────── */
.no-results {
    display: none;
    text-align: center;
    padding: 50px 20px;
}

.no-results i {
    font-size: 3rem;
    color: var(--text-muted);
    margin-bottom: 20px;
}

.no-results h3 {
    color: var(--text);
    margin-bottom: 8px;
}

.no-results p {
    color: var(--text-muted);
}
