* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Solway', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Georgia, serif;
    background: #1a1a1a;
    color: #e8e8e8;
    line-height: 1.6;
    overflow-x: hidden;
}

.main {
    min-height: 100vh;
    padding: 2rem 2rem 1rem;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}

.header {
    text-align: center;
    margin-bottom: 3rem;
}

.header h1 {
    font-size: 2.8rem;
    font-weight: 700;
    margin-bottom: 0.8rem;
    letter-spacing: 1px;
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: #b0b0b0;
    text-decoration: none;
    font-size: 1rem;
    margin-bottom: 2rem;
    transition: all 0.3s ease;
}

.back-link:hover {
    color: #e8e8e8;
    transform: translateX(-5px);
}

.certification-section {
    margin-bottom: 2.5rem;
}

.certification-section:last-child {
    margin-bottom: 0;
}

.section-title {
    font-size: 1.5rem;
    font-weight: 600;
    margin-top: 0;
    margin-bottom: 1rem;
    color: #e8e8e8;
}

.certifications-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(15vw, 1fr));
    gap: 2rem;
    margin-top: 2rem;
}

.certification-section .certifications-grid {
    margin-top: 1rem;
}

.certifications-grid--training {
    grid-template-columns: repeat(4, 1fr);
}

.filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 2rem;
    align-items: center;
}

.filter-btn-icon {
    display: block;
    object-fit: contain;
}

.filter-btn .fa-th-large {
    font-size: 1.1rem;
}

.filter-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    padding: 0.5rem 0.75rem;
    min-height: 2.5rem;
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 500;
    color: #b0b0b0;
    background: #252525;
    border: 1px solid #3a3a3a;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.filter-btn:hover {
    color: #e8e8e8;
    border-color: #4a4a4a;
    background: #2a2a2a;
}

.filter-btn[aria-pressed="true"] {
    color: #1a1a1a;
    background: #e8e8e8;
    border-color: #e8e8e8;
}

.filter-btn--icon-only {
    min-width: 2.5rem;
}

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

.certification-item {
    background: #252525;
    border: 1px solid #3a3a3a;
    border-radius: 8px;
    overflow: hidden;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    min-height: 0;
}

.certification-item:hover {
    transform: translateY(-5px);
    border-color: #4a4a4a;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.certification-image-wrap {
    flex: 1 1 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 120px;
    padding: 1rem;
    background: #1e1e1e;
}

.certification-image {
    width: 100%;
    height: auto;
    display: block;
    object-fit: contain;
    max-height: 180px;
}

.certification-details {
    padding: 1rem 1.1rem 1.2rem;
    border-top: 1px solid #3a3a3a;
    background: #252525;
}

.certification-title {
    font-size: 1.05rem;
    font-weight: 600;
    line-height: 1.35;
    color: #e8e8e8;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.loading {
    text-align: center;
    padding: 3rem;
    font-size: 1.1rem;
    color: #b0b0b0;
}

.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: #b0b0b0;
}

.empty-state i {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    animation: fadeIn 0.3s ease;
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    position: relative;
    width: 100%;
    max-width: 95vw;
    max-height: 90%;
    margin: auto;
    animation: zoomIn 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.modal-image-wrapper {
    position: relative;
    flex: 1;
    max-width: 90vw;
    max-height: 90vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-image {
    max-width: 100%;
    max-height: 90vh;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal-image.loaded {
    opacity: 1;
}

.modal-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 1.2rem;
    display: none;
}

.modal-loading.active {
    display: block;
}

.close-btn {
    position: fixed;
    top: 8px;
    right: 8px;
    background: transparent;
    border: 0;
    color: #fff;
    width: 32px;
    height: 32px;
    padding: 0;
    font-size: 1.5rem;
    line-height: 1;
    border-radius: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0.75;
    transition: opacity 0.2s ease;
}

.close-btn:hover {
    opacity: 1;
}

.nav-btn {
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.2s ease;
    flex-shrink: 0;
}

.nav-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: scale(1.05);
}

.nav-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}


@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes zoomIn {
    from { transform: scale(0.8); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

@media (max-width: 768px), (max-height: 600px) {
    .main {
        padding: 2rem max(1rem, env(safe-area-inset-right)) 2rem max(1rem, env(safe-area-inset-left));
    }

    .back-link {
        min-height: 2.75rem;
        padding: 0.25rem 0;
        margin-bottom: 1.5rem;
    }

    .header h1 {
        font-size: 1.8rem;
    }

    .filter-bar {
        justify-content: center;
        margin-bottom: 1.5rem;
    }

    .filter-btn {
        min-height: 2.75rem;
    }

    .filter-btn--icon-only,
    .filter-btn:not(.filter-btn--icon-only) {
        min-width: 2.75rem;
        padding-left: 0.5rem;
        padding-right: 0.5rem;
    }

    .filter-btn:not(.filter-btn--icon-only) span {
        display: none;
    }

    .certifications-grid,
    .certifications-grid--training {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .modal-content {
        max-width: 95%;
        padding-left: max(0, env(safe-area-inset-left));
        padding-right: max(0, env(safe-area-inset-right));
    }

    .close-btn {
        top: max(8px, env(safe-area-inset-top));
        right: max(8px, env(safe-area-inset-right));
        min-width: 2.75rem;
        min-height: 2.75rem;
        width: 2.75rem;
        height: 2.75rem;
    }

    .nav-btn {
        display: none;
    }
}

@media (max-width: 380px) {
    .main {
        padding: 1.5rem max(1rem, env(safe-area-inset-right)) 1.5rem max(1rem, env(safe-area-inset-left));
    }

    .header h1 {
        font-size: 1.5rem;
    }

    .section-title {
        font-size: 1.25rem;
    }
}
