/* Formal Certificate Card Styling */
@import url('https://fonts.googleapis.com/css2?family=Libre+Baskerville:wght@400;700&family=Montserrat:wght@400;600&family=Roboto:wght@300;400;700&display=swap');

.certificate-card {
    background: #fff;
    color: #333;
    width: 100%;
    max-width: 900px;
    margin: 20px auto;
    padding: 60px;
    border: 1px solid #ccc;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    position: relative;
    font-family: 'Roboto', sans-serif;
    box-sizing: border-box;
    text-align: center;
}

/* Double border effect */
.certificate-card::after {
    content: "";
    position: absolute;
    top: 15px;
    left: 15px;
    right: 15px;
    bottom: 15px;
    border: 2px solid #555;
    pointer-events: none;
}

.certificate-card::before {
    content: "";
    position: absolute;
    top: 10px;
    left: 10px;
    right: 10px;
    bottom: 10px;
    border: 1px solid #888;
    pointer-events: none;
}

.cert-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 40px;
}

.cert-logo {
    width: 150px;
    height: auto;
    text-align: left;
}

.cert-qr {
    width: 80px;
    height: 80px;
    border: 1px solid #ddd;
}

.cert-main-text {
    margin: 40px 0;
}

.cert-prefix {
    font-size: 1.2rem;
    color: #666;
    font-style: italic;
    margin-bottom: 20px;
}

.cert-name {
    font-family: 'Libre+Baskerville', serif;
    font-size: 3rem;
    font-weight: 700;
    color: #111;
    margin: 20px 0;
    border-bottom: 1px solid #eee;
    display: inline-block;
    padding-bottom: 5px;
}

.cert-statement {
    font-size: 1rem;
    color: #555;
    margin: 20px 0;
}

.cert-title-large {
    font-family: 'Libre+Baskerville', serif;
    font-size: 2.5rem;
    font-weight: 700;
    color: #000;
    margin: 10px 0;
}

.cert-subtitle {
    font-size: 0.9rem;
    color: #777;
    margin-bottom: 30px;
}

.cert-provider-info {
    font-size: 0.9rem;
    color: #444;
    line-height: 1.6;
    margin: 30px 0;
}

.cert-footer {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-top: 50px;
    border-top: 1px solid #eee;
    padding-top: 30px;
}

.cert-issuer-program {
    font-weight: 600;
    color: #333;
    margin-bottom: 20px;
}

.cert-signature-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 30px;
}

.cert-signature {
    width: 120px;
    height: 40px;
    margin-bottom: 10px;
    font-family: 'Dancing Script', cursive;
    /* Generic fallback or use an image */
    font-size: 1.5rem;
    color: #222;
}

.cert-signer-name {
    font-weight: bold;
    font-size: 0.9rem;
}

.cert-signer-title {
    font-size: 0.8rem;
    color: #666;
}

.cert-date-formal {
    font-weight: bold;
    font-size: 1.1rem;
    margin-top: 20px;
}

.cert-validation {
    font-size: 0.75rem;
    color: #888;
    margin-top: 15px;
    max-width: 80%;
}

.cert-validation a {
    color: #0056b3;
    text-decoration: none;
}

/* Background watermark effect */
.cert-watermark {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 60%;
    opacity: 0.05;
    pointer-events: none;
    z-index: 0;
}

@media (max-width: 768px) {
    .certificate-card {
        padding: 30px;
    }

    .cert-name {
        font-size: 2rem;
    }

    .cert-title-large {
        font-size: 1.8rem;
    }
}

/* File Explorer Grid */
.certificate-groups {
    width: 100%;
    flex-direction: column;
    box-sizing: border-box;
    margin: 40px auto 80px;
}

.certificate-group {
    width: 100%;
    min-width: 0;
    margin-bottom: clamp(32px, 6vw, 55px);
    box-sizing: border-box;
}

.certificate-group-title {
    margin: 0;
    padding: 0 12px 16px;
    border-bottom: 2px solid rgba(69, 173, 255, 0.55);
    color: #45adff;
    font-family: 'Press Start 2P', monospace;
    font-size: clamp(0.72rem, 2vw, 1rem);
    line-height: 1.7;
    text-align: center;
    overflow-wrap: anywhere;
}

.certificate-viewer {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr));
    gap: clamp(16px, 3vw, 30px);
    padding: 20px clamp(0px, 3vw, 40px);
    margin-top: 20px;
    margin-bottom: 0;
    box-sizing: border-box;
}

.cert-icon-container {
    width: 100%;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    transition: background 0.2s, transform 0.2s;
    padding: clamp(12px, 2vw, 20px);
    border-radius: 12px;
    box-sizing: border-box;
}

.cert-thumbnail-link {
    width: 100%;
    max-width: 240px;
    aspect-ratio: 4 / 3;
    border: 1px solid #ddd;
    background: #fff;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.6);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    cursor: pointer;
    text-decoration: none;
    box-sizing: border-box;
}

.cert-file-icon {
    font-size: 3rem;
}

.cert-file-type {
    color: #333;
    font: 600 clamp(0.65rem, 2.5vw, 0.75rem) 'Montserrat', sans-serif;
    text-align: center;
}

@media (hover: hover) {
    .cert-icon-container:hover {
        background: rgba(255, 255, 255, 0.1);
        transform: translateY(-5px);
    }
}

.cert-label {
    color: #fff;
    font-size: clamp(0.65rem, 2.5vw, 0.8rem);
    text-align: center;
    font-family: 'Montserrat', sans-serif;
    line-height: 1.4;
    word-break: break-word;
    text-transform: uppercase;
    font-weight: 600;
    max-width: 100%;
    overflow-wrap: anywhere;
}

@media (max-width: 600px) {
    .certificate-groups {
        margin-top: 24px;
        margin-bottom: 40px;
    }

    .certificate-viewer {
        grid-template-columns: minmax(0, 1fr);
        padding: 16px 0;
    }

    .cert-icon-container {
        max-width: 360px;
        margin: 0 auto;
    }
}
