* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Tajawal', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    overflow-x: hidden;
}

.certificate-container {
    position: relative;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.background-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    z-index: -2;
}

.animated-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    z-index: -1;
}

.circle {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    animation: float 20s infinite ease-in-out;
}

.circle-1 {
    width: 300px;
    height: 300px;
    top: 10%;
    left: 10%;
    animation-delay: 0s;
}

.circle-2 {
    width: 200px;
    height: 200px;
    top: 60%;
    right: 10%;
    animation-delay: 5s;
}

.circle-3 {
    width: 150px;
    height: 150px;
    bottom: 10%;
    left: 50%;
    animation-delay: 10s;
}

@keyframes float {
    0%, 100% {
        transform: translateY(0) translateX(0);
    }
    25% {
        transform: translateY(-30px) translateX(30px);
    }
    50% {
        transform: translateY(-60px) translateX(-30px);
    }
    75% {
        transform: translateY(-30px) translateX(-60px);
    }
}

.content-wrapper {
    width: 100%;
    max-width: 600px;
    z-index: 1;
}

.logo-section {
    text-align: center;
    margin-bottom: 30px;
    animation: fadeInDown 0.8s ease-out;
}

.main-logo {
    max-width: 180px;
    height: auto;
    filter: drop-shadow(0 10px 30px rgba(0, 0, 0, 0.3));
    animation: pulse 2s infinite ease-in-out;
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

.certificate-card {
    background: rgba(255, 255, 255, 0.98);
    border-radius: 24px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    animation: fadeInUp 0.8s ease-out;
    backdrop-filter: blur(10px);
}

.card-header-custom {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 40px 30px;
    text-align: center;
    color: white;
    position: relative;
    overflow: hidden;
}

.card-header-custom::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.1) 0%, transparent 70%);
    animation: rotate 20s linear infinite;
}

@keyframes rotate {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

.icon-wrapper {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 80px;
    height: 80px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    margin-bottom: 20px;
    position: relative;
    z-index: 1;
    animation: bounceIn 1s ease-out;
}

.icon-wrapper svg {
    color: white;
}

.main-title {
    font-size: 2rem;
    font-weight: 800;
    margin-bottom: 10px;
    position: relative;
    z-index: 1;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.subtitle {
    font-size: 1.1rem;
    font-weight: 400;
    opacity: 0.95;
    position: relative;
    z-index: 1;
}

.card-body-custom {
    padding: 40px 30px;
}

.certificate-form {
    margin-bottom: 30px;
}

.form-group-custom {
    margin-bottom: 25px;
}

.form-label-custom {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1rem;
    font-weight: 600;
    color: #333;
    margin-bottom: 12px;
}

.form-label-custom svg {
    color: #667eea;
}

.form-control-custom {
    width: 100%;
    padding: 16px 20px;
    font-size: 1.1rem;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    transition: all 0.3s ease;
    font-family: 'Tajawal', sans-serif;
    background: #f8f9fa;
}

.form-control-custom:focus {
    outline: none;
    border-color: #667eea;
    background: white;
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
    transform: translateY(-2px);
}

.validation-message {
    display: block;
    margin-top: 8px;
    font-size: 0.9rem;
    font-weight: 500;
}

.btn-submit {
    width: 100%;
    padding: 18px 30px;
    font-size: 1.2rem;
    font-weight: 700;
    color: white;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    box-shadow: 0 10px 30px rgba(102, 126, 234, 0.4);
    position: relative;
    overflow: hidden;
}

.btn-submit::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.5s ease;
}

.btn-submit:hover::before {
    left: 100%;
}

.btn-submit:hover {
    transform: translateY(-3px);
    box-shadow: 0 15px 40px rgba(102, 126, 234, 0.5);
}

.btn-submit:active {
    transform: translateY(-1px);
}

.btn-submit.loading {
    opacity: 0.8;
    cursor: wait;
}

.info-section {
    margin-top: 30px;
}

.info-card {
    display: flex;
    align-items: flex-start;
    gap: 15px;
    padding: 20px;
    background: linear-gradient(135deg, #e3f2fd 0%, #f3e5f5 100%);
    border-radius: 12px;
    border-right: 4px solid #667eea;
}

.info-card svg {
    color: #667eea;
    flex-shrink: 0;
    margin-top: 2px;
}

.info-card p {
    margin: 0;
    color: #555;
    line-height: 1.6;
}

.success-card .card-header-custom {
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
}

.success-icon {
    background: rgba(255, 255, 255, 0.25);
}

.error-card .card-header-custom {
    background: linear-gradient(135deg, #eb3349 0%, #f45c43 100%);
}

.error-icon {
    background: rgba(255, 255, 255, 0.25);
}

.success-message,
.error-message {
    margin-bottom: 30px;
}

.certificate-preview {
    text-align: center;
    margin-bottom: 30px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 12px;
}

.certificate-image {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    transition: transform 0.3s ease;
}

.certificate-image:hover {
    transform: scale(1.02);
}

.pdf-preview {
    padding: 40px;
    text-align: center;
}

.pdf-preview svg {
    color: #d32f2f;
    margin-bottom: 15px;
}

.file-type {
    font-size: 1.2rem;
    font-weight: 600;
    color: #666;
    margin: 0;
}

.certificate-info {
    background: white;
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 25px;
    border: 2px solid #e0e0e0;
}

.info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
}

.info-label {
    font-weight: 600;
    color: #666;
}

.info-value {
    font-weight: 700;
    color: #333;
    font-size: 1.1rem;
}

.congratulations-message {
    display: flex;
    align-items: flex-start;
    gap: 15px;
    padding: 25px;
    background: linear-gradient(135deg, #fff9c4 0%, #fff59d 100%);
    border-radius: 12px;
    margin-bottom: 25px;
    border-right: 4px solid #fbc02d;
}

.congratulations-message svg {
    color: #f57f17;
    flex-shrink: 0;
    margin-top: 2px;
}

.congratulations-message p {
    margin: 0;
    color: #555;
    line-height: 1.8;
    font-size: 1.05rem;
}

.action-buttons {
    display: flex;
    gap: 15px;
    margin-bottom: 25px;
}

.btn-download,
.btn-print {
    flex: 1;
    padding: 16px 24px;
    font-size: 1.1rem;
    font-weight: 700;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    text-decoration: none;
    border: none;
}

.btn-download {
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
    color: white;
    box-shadow: 0 8px 20px rgba(17, 153, 142, 0.3);
}

.btn-download:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 30px rgba(17, 153, 142, 0.4);
    color: white;
}

.btn-print {
    background: white;
    color: #667eea;
    border: 2px solid #667eea;
}

.btn-print:hover {
    background: #667eea;
    color: white;
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.3);
}

.print-success-message {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 20px;
    background: linear-gradient(135deg, #c8e6c9 0%, #a5d6a7 100%);
    border-radius: 12px;
    margin-bottom: 20px;
    border-right: 4px solid #4caf50;
    animation: slideInRight 0.5s ease-out;
}

.print-success-message svg {
    color: #2e7d32;
    flex-shrink: 0;
}

.print-success-message p {
    margin: 0;
    color: #1b5e20;
    line-height: 1.6;
}

.support-section {
    margin-bottom: 25px;
}

.support-card {
    background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%);
    padding: 30px;
    border-radius: 12px;
    text-align: center;
    margin-bottom: 25px;
    border: 2px solid #2196f3;
}

.support-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 80px;
    height: 80px;
    background: white;
    border-radius: 50%;
    margin-bottom: 20px;
}

.support-icon svg {
    color: #2196f3;
}

.support-card h3 {
    font-size: 1.5rem;
    font-weight: 700;
    color: #1565c0;
    margin-bottom: 15px;
}

.support-card p {
    color: #555;
    margin-bottom: 20px;
    line-height: 1.6;
}

.whatsapp-btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 16px 30px;
    background: #25d366;
    color: white;
    text-decoration: none;
    border-radius: 12px;
    font-weight: 700;
    font-size: 1.1rem;
    transition: all 0.3s ease;
    box-shadow: 0 8px 20px rgba(37, 211, 102, 0.3);
}

.whatsapp-btn:hover {
    background: #20ba5a;
    transform: translateY(-3px);
    box-shadow: 0 12px 30px rgba(37, 211, 102, 0.4);
    color: white;
}

.phone-number {
    font-family: 'Courier New', monospace;
    font-weight: 700;
    letter-spacing: 1px;
}

.tips-section {
    background: white;
    padding: 25px;
    border-radius: 12px;
    border: 2px solid #e0e0e0;
}

.tips-section h4 {
    font-size: 1.2rem;
    font-weight: 700;
    color: #333;
    margin-bottom: 15px;
}

.tips-section ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.tips-section li {
    padding: 10px 0 10px 30px;
    position: relative;
    color: #555;
    line-height: 1.6;
}

.tips-section li::before {
    content: '✓';
    position: absolute;
    right: 0;
    color: #667eea;
    font-weight: 700;
    font-size: 1.2rem;
}

.btn-back {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 14px 24px;
    background: white;
    color: #667eea;
    text-decoration: none;
    border: 2px solid #667eea;
    border-radius: 12px;
    font-weight: 600;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.btn-back:hover {
    background: #667eea;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.3);
}

.footer-custom {
    text-align: center;
    padding: 20px;
    margin-top: 30px;
    color: white;
    font-size: 0.95rem;
    opacity: 0.9;
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes bounceIn {
    0% {
        opacity: 0;
        transform: scale(0.3);
    }
    50% {
        opacity: 1;
        transform: scale(1.05);
    }
    70% {
        transform: scale(0.9);
    }
    100% {
        transform: scale(1);
    }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(50px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.shake-animation {
    animation: shake 0.5s ease-in-out;
}

@keyframes shake {
    0%, 100% {
        transform: translateX(0);
    }
    25% {
        transform: translateX(-10px);
    }
    75% {
        transform: translateX(10px);
    }
}

@media (max-width: 768px) {
    .main-title {
        font-size: 1.5rem;
    }

    .subtitle {
        font-size: 1rem;
    }

    .card-header-custom {
        padding: 30px 20px;
    }

    .card-body-custom {
        padding: 30px 20px;
    }

    .icon-wrapper {
        width: 60px;
        height: 60px;
    }

    .icon-wrapper svg {
        width: 32px;
        height: 32px;
    }

    .action-buttons {
        flex-direction: column;
    }

    .btn-download,
    .btn-print {
        width: 100%;
    }

    .info-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }

    .main-logo {
        max-width: 140px;
    }
}

@media print {
    body {
        background: white;
    }

    .certificate-container {
        background: white;
    }

    .animated-bg,
    .background-overlay,
    .action-buttons,
    .btn-back,
    .footer-custom,
    .card-header-custom,
    .congratulations-message,
    .certificate-info {
        display: none !important;
    }

    .certificate-card {
        box-shadow: none;
        border: none;
    }

    .certificate-preview {
        background: white;
        padding: 0;
    }

    .certificate-image {
        max-width: 100%;
        box-shadow: none;
    }
}
