/* ============================================================
   CERTIFICATES PAGE - STYLESHEET
   Author: Mohamed Darwish
   Description: Styles for the Licenses & Certifications page
   ============================================================ */

/* ==================== GOOGLE FONTS ==================== */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

/* ==================== RESET & BASE ==================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* ==================== CSS VARIABLES ==================== */
:root {
    --primary-bg:    #14b8a6;
    --secondary-bg:  #0d9488;
    --card-bg:       #ffffff;
    --text-dark:     #1f2937;
    --text-gray:     #6b7280;
    --text-light:    #9ca3af;
    --border-color:  #e5e7eb;
    --hover-color:   #0891b2;
    --shadow-sm:     0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md:     0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg:     0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --shadow-hover:  0 20px 25px -5px rgba(0, 0, 0, 0.1);
}

/* ==================== BODY ==================== */
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: linear-gradient(135deg, var(--primary-bg) 0%, var(--secondary-bg) 100%);
    min-height: 100vh;
    color: var(--text-dark);
    line-height: 1.6;
}

/* ==================== CONTAINER ==================== */
.container {
    max-width: 1400px;
    margin: 0 auto;
}

/* ==================== HEADER ==================== */
.page-header {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-color);
    padding: 40px 60px;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    max-width: 1280px;
    margin: 0 auto;
}

/* Back link button */
.back-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--text-gray);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 20px;
    transition: all 0.2s ease;
}

.back-link:hover {
    color: var(--hover-color);
    gap: 12px;
}

/* Page title */
.header-title h1 {
    font-size: 32px;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 12px;
}

/* Decorative underline below title */
.title-line {
    width: 120px;
    height: 3px;
    background: linear-gradient(90deg, var(--primary-bg), var(--secondary-bg));
    border-radius: 2px;
}

/* ==================== CERTIFICATES SECTION ==================== */
.certificates-section {
    padding: 60px 60px 80px;
}

/* Grid layout for certificate cards */
.certificates-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
    gap: 30px;
    max-width: 1280px;
    margin: 0 auto;
}

/* ==================== CERTIFICATE CARD ==================== */
.certificate-card {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 32px;
    box-shadow: var(--shadow-md);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    position: relative;
    border: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 20px;
    /* Fade-in animation applied via nth-child below */
    animation: fadeInUp 0.5s ease forwards;
    opacity: 0;
}

/* Hover state */
.certificate-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-hover);
    border-color: var(--primary-bg);
}

/* Expired card styling */
.certificate-card.expired {
    opacity: 0.65;
    border-color: #EF4444;
}

.certificate-card.expired::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: #EF4444;
    border-radius: 12px 12px 0 0;
}

/* ---- Card Header ---- */
.cert-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

/* Company logo box */
.cert-logo {
    width: 64px;
    height: 64px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f9fafb;
    border: 1px solid var(--border-color);
    overflow: hidden;
    flex-shrink: 0;
}

.cert-logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 8px;
}

.cert-logo i {
    font-size: 28px;
}

/* External link icon (top-right of card) */
.external-link {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-light);
    background: transparent;
    transition: all 0.2s ease;
    text-decoration: none;
    flex-shrink: 0;
}

.certificate-card:hover .external-link {
    background: #f3f4f6;
    color: var(--hover-color);
}

/* ---- Card Content ---- */
.cert-content {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Certificate name */
.cert-content h3 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-dark);
    line-height: 1.4;
    transition: color 0.2s ease;
}

.certificate-card:hover .cert-content h3 {
    color: var(--hover-color);
}

/* Issuer name */
.cert-issuer {
    font-size: 14px;
    color: var(--text-gray);
    font-weight: 500;
}

/* ---- Card Footer ---- */
.cert-footer {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
    margin-top: auto;
}

/* Issue date */
.cert-date {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--text-gray);
    font-weight: 500;
}

.cert-date i {
    font-size: 12px;
}

/* Expiry status - color is set dynamically via JS */
.cert-expiry {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 600;
}

/* ==================== LOADING STATE ==================== */
.loading-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 80px 20px;
}

/* Spinning loader circle */
.loader {
    width: 48px;
    height: 48px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-state p {
    color: white;
    font-size: 16px;
    font-weight: 500;
}

/* ==================== FOOTER ==================== */
.page-footer {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    padding: 30px 60px;
    border-top: 1px solid var(--border-color);
    text-align: center;
}

.page-footer p {
    color: var(--text-gray);
    font-size: 14px;
    margin: 8px 0;
}

/* Certificate count badge */
.badge {
    display: inline-block;
    background: linear-gradient(135deg, var(--primary-bg), var(--secondary-bg));
    color: white;
    padding: 4px 12px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 14px;
    margin-left: 6px;
}

.last-updated {
    font-size: 13px;
    color: var(--text-light);
}

/* ==================== ANIMATIONS ==================== */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Staggered animation delays for each card */
.certificate-card:nth-child(1) { animation-delay: 0.05s; }
.certificate-card:nth-child(2) { animation-delay: 0.10s; }
.certificate-card:nth-child(3) { animation-delay: 0.15s; }
.certificate-card:nth-child(4) { animation-delay: 0.20s; }
.certificate-card:nth-child(5) { animation-delay: 0.25s; }
.certificate-card:nth-child(6) { animation-delay: 0.30s; }
.certificate-card:nth-child(7) { animation-delay: 0.35s; }
.certificate-card:nth-child(8) { animation-delay: 0.40s; }
.certificate-card:nth-child(9) { animation-delay: 0.45s; }

/* ==================== RESPONSIVE - TABLET ==================== */
@media (max-width: 1024px) {
    .certificates-grid {
        grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    }
}

/* ==================== RESPONSIVE - MOBILE ==================== */
@media (max-width: 768px) {
    .page-header,
    .certificates-section,
    .page-footer {
        padding-left: 24px;
        padding-right: 24px;
    }

    .certificates-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .header-title h1 {
        font-size: 24px;
    }
}

/* ==================== RESPONSIVE - SMALL MOBILE ==================== */
@media (max-width: 480px) {
    .certificate-card {
        padding: 24px;
    }

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

    .cert-content h3 {
        font-size: 16px;
    }
}
