/**
 * Dynamic Certificate Styles
 */

/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Georgia', 'Times New Roman', serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

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

/* Error and Welcome Messages */
.error-message,
.welcome-message {
    background: white;
    padding: 50px 40px;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
    text-align: center;
    max-width: 600px;
    margin: 0 auto;
}

.error-message h2,
.welcome-message h2 {
    color: #1a202c;
    margin-bottom: 20px;
    font-size: 32px;
    font-weight: 700;
}

.error-message p,
.welcome-message p {
    color: #4a5568;
    margin-bottom: 15px;
    font-size: 16px;
    line-height: 1.6;
}

/* Error Icon Styling */
.error-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 30px;
    background: linear-gradient(135deg, #fc8181 0%, #f56565 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: pulse 2s ease-in-out infinite;
}

.error-icon svg {
    color: white;
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(245, 101, 101, 0.7);
    }
    50% {
        transform: scale(1.05);
        box-shadow: 0 0 0 10px rgba(245, 101, 101, 0);
    }
}

/* Error Details Section */
.error-details {
    background: #fff5f5;
    border-left: 4px solid #fc8181;
    padding: 20px;
    border-radius: 8px;
    margin: 30px 0;
    text-align: left;
}

.error-id {
    font-size: 15px;
    color: #742a2a;
    margin-bottom: 10px !important;
}

.error-id strong {
    font-weight: 700;
    color: #c53030;
    font-family: 'Courier New', monospace;
    background: #fed7d7;
    padding: 2px 8px;
    border-radius: 4px;
}

.error-description {
    font-size: 14px;
    color: #742a2a;
    margin-bottom: 0 !important;
}

/* Error Action Buttons */
.error-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin: 30px 0;
    flex-wrap: wrap;
}

.error-actions .btn {
    flex: 1;
    min-width: 180px;
    justify-content: center;
}

/* Example Box Styling */
.example-box {
    background: #f7fafc;
    border: 2px dashed #cbd5e0;
    padding: 20px;
    border-radius: 8px;
    margin-top: 30px;
}

.example-label {
    font-size: 13px;
    color: #718096;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
    margin-bottom: 12px !important;
}

.example-box code {
    display: block;
    background: #2d3748;
    color: #68d391;
    padding: 12px 16px;
    border-radius: 6px;
    font-family: 'Courier New', 'Monaco', monospace;
    font-size: 14px;
    overflow-x: auto;
    white-space: nowrap;
}

.help-text {
    color: #a0aec0;
    font-size: 14px;
}

.example {
    background: #f5f5f5;
    padding: 15px;
    border-radius: 6px;
    margin-top: 20px;
}

.example code {
    background: #2d3748;
    color: #68d391;
    padding: 8px 12px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 14px;
}

.available-ids {
    margin-top: 30px;
    text-align: left;
}

.available-ids h3 {
    color: #333;
    margin-bottom: 15px;
    font-size: 20px;
}

.available-ids ul {
    list-style: none;
    padding: 0;
}

.available-ids li {
    margin: 10px 0;
}

.available-ids a {
    color: #667eea;
    text-decoration: none;
    padding: 10px 15px;
    display: block;
    background: #f5f5f5;
    border-radius: 6px;
    transition: all 0.3s ease;
}

.available-ids a:hover {
    background: #667eea;
    color: white;
    transform: translateX(5px);
}

/* Certificate Wrapper */
.certificate-wrapper {
    background: white;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

/* Certificate Container */
.certificate-container {
    position: relative;
    width: 100%;
    max-width: 1000px;
    margin: 0 auto;
    background: white;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    overflow: hidden;
    line-height: 0; /* Remove gap below image */
}

/* Certificate Background Image */
.certificate-background {
    position: relative;
    width: 100%;
    z-index: 1;
}

.certificate-image {
    width: 100%;
    height: auto;
    display: block;
}

/* Certificate Overlay for Dynamic Content */
.certificate-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2;
    pointer-events: none;
}

/**
 * Dynamic name text overlay.
 * Positioned where the original name was on the certificate.
 */
.recipient-name {
    position: absolute;
    top: 38%;
    left: 8.5%;
    width: 45%;
    height: 5%;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    font-family: 'Montserrat', 'Segoe UI', 'Arial', sans-serif;
    font-size: clamp(14px, 2vw, 26px);
    font-weight: 700;
    color: #469CDC;
    z-index: 3;
    line-height: 1.2;
}

/* Action Buttons */
.action-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 30px;
    flex-wrap: wrap;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.btn-primary {
    background: #667eea;
    color: white;
}

.btn-primary:hover {
    background: #5568d3;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: #718096;
    color: white;
}

.btn-secondary:hover {
    background: #4a5568;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(113, 128, 150, 0.4);
}

.btn:active {
    transform: translateY(0);
}

/* Employee Information */
.employee-info {
    margin-top: 30px;
    padding: 20px;
    background: #f7fafc;
    border-radius: 8px;
    border-left: 4px solid #667eea;
}

.employee-info h3 {
    color: #333;
    margin-bottom: 15px;
    font-size: 20px;
}

.employee-info p {
    color: #666;
    margin: 8px 0;
    font-size: 14px;
}

.employee-info strong {
    color: #333;
    font-weight: 600;
}

/* Responsive Design */
@media (max-width: 768px) {
    .certificate-wrapper {
        padding: 15px;
    }

    .btn {
        padding: 10px 20px;
        font-size: 14px;
    }

    .action-buttons {
        flex-direction: column;
    }

    .btn {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .error-message,
    .welcome-message {
        padding: 30px 20px;
    }

    .error-message h2,
    .welcome-message h2 {
        font-size: 24px;
    }

    .error-icon {
        width: 64px;
        height: 64px;
    }

    .error-icon svg {
        width: 48px;
        height: 48px;
    }

    .error-actions {
        flex-direction: column;
    }

    .error-actions .btn {
        width: 100%;
        min-width: unset;
    }

    .example-box code {
        font-size: 12px;
        padding: 10px 12px;
    }
}

/* Print Styles */
@media print {
    body {
        background: white;
        padding: 0;
    }

    .action-buttons,
    .employee-info {
        display: none;
    }

    .certificate-wrapper {
        box-shadow: none;
        padding: 0;
    }

    .certificate-container {
        box-shadow: none;
        border-radius: 0;
        max-width: 100%;
        page-break-inside: avoid;
    }
}
