/* ============================================
   KOODI CERTIFICATE SYSTEM - STYLES
   Font: Rubik - BRUTAL STYLE
   ============================================ */

/* Modal Overlay */
.certificate-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(26, 26, 46, 0.95);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 99999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    font-family: 'Rubik', sans-serif;
    padding: 20px;
}

.certificate-modal.active {
    opacity: 1;
    visibility: visible;
}

.certificate-modal.hidden {
    display: none;
}

/* Modal Content - BRUTAL STYLE */
.certificate-modal-content {
    background: #ffffff;
    border-radius: 30px;
    padding: 35px;
    padding-top: 50px;
    max-width: 900px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    border: 4px solid #131010;
    box-shadow: 12px 12px 0px #131010;
    animation: modalSlideIn 0.3s ease-out;
    font-family: 'Rubik', sans-serif;
}

@keyframes modalSlideIn {
    from {
        transform: translateY(-30px) scale(0.95);
        opacity: 0;
    }
    to {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

/* Close Button - BRUTAL STYLE */
.close-certificate-modal {
    position: absolute;
    top: 15px;
    right: 15px;
    background: #FF4E99;
    border: 3px solid #131010;
    color: #fff;
    font-size: 1.5rem;
    cursor: pointer;
    transition: all 0.2s ease;
    width: 45px;
    height: 45px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Rubik', sans-serif;
    box-shadow: 4px 4px 0px #131010;
    z-index: 10;
}

.close-certificate-modal:hover {
    background: #FF9F00;
    transform: translate(-2px, -2px);
    box-shadow: 6px 6px 0px #131010;
}

/* Header - BRUTAL STYLE */
.certificate-header {
    text-align: center;
    margin-bottom: 30px;
}

.certificate-header h2 {
    color: #131010;
    font-size: 2em;
    margin-bottom: 10px;
    font-family: 'Rubik', sans-serif;
    font-weight: 900;
}

.certificate-header p {
    color: #555;
    font-size: 1.1em;
    margin: 8px 0;
    font-family: 'Rubik', sans-serif;
    font-weight: 500;
}

.certificate-header .course-name-highlight {
    color: #FF4E99;
    font-weight: 700;
}

.certificate-header .subtitle {
    color: #888;
    font-size: 14px;
    margin-top: 20px;
}

/* ============================================
   NAME INPUT SECTION
   ============================================ */
.certificate-name-section {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 16px;
    padding: 25px;
    margin-bottom: 25px;
    border: 2px solid rgba(255, 78, 153, 0.3);
}

.certificate-name-section label {
    display: block;
    color: #fff;
    font-size: 16px;
    margin-bottom: 12px;
    font-weight: 600;
    font-family: 'Rubik', sans-serif;
}

.certificate-name-section label span {
    color: #FF4E99;
}

.certificate-name-input {
    width: 100%;
    padding: 16px 20px;
    font-size: 18px;
    font-family: 'Rubik', sans-serif;
    font-weight: 500;
    background: #0F0F1A;
    border: 3px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    color: #fff;
    outline: none;
    transition: all 0.3s;
    text-align: center;
}

.certificate-name-input:focus {
    border-color: #FF4E99;
    box-shadow: 0 0 20px rgba(255, 78, 153, 0.3);
}

.certificate-name-input::placeholder {
    color: #555;
}

/* ============================================
   DESIGN OPTIONS GRID
   ============================================ */
.certificate-designs {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
    margin-bottom: 25px;
}

@media (max-width: 768px) {
    .certificate-designs {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .certificate-designs {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }

    .certificate-modal-content {
        padding: 20px;
    }
}

/* Design Option */
.design-option {
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    background: rgba(255, 255, 255, 0.03);
}

.design-option:hover {
    transform: translateY(-5px) scale(1.02);
    border-color: #009DFF;
    box-shadow: 0 10px 30px rgba(0, 157, 255, 0.3);
}

.design-option.selected {
    border-color: #C6DF2B;
    box-shadow: 0 0 30px rgba(198, 223, 43, 0.5),
                0 0 60px rgba(198, 223, 43, 0.2);
    transform: scale(1.02);
}

.design-option.selected::before {
    content: '✓';
    position: absolute;
    top: 8px;
    right: 8px;
    width: 28px;
    height: 28px;
    background: #C6DF2B;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #000;
    font-size: 16px;
    font-weight: bold;
    z-index: 2;
    animation: checkmarkPop 0.3s ease-out;
}

@keyframes checkmarkPop {
    from { transform: scale(0); }
    to { transform: scale(1); }
}

.design-option img {
    width: 100%;
    height: auto;
    display: block;
    transition: transform 0.3s;
}

.design-option:hover img {
    transform: scale(1.05);
}

.design-number {
    position: absolute;
    bottom: 8px;
    left: 8px;
    background: rgba(0, 0, 0, 0.85);
    color: #fff;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: bold;
    font-family: 'Rubik', sans-serif;
}

.design-label {
    position: absolute;
    bottom: 8px;
    right: 8px;
    background: rgba(0, 0, 0, 0.85);
    color: #aaa;
    padding: 4px 10px;
    border-radius: 15px;
    font-size: 10px;
    font-family: 'Rubik', sans-serif;
}

/* ============================================
   PREVIEW SECTION
   ============================================ */
.certificate-preview-section {
    margin: 25px 0;
    text-align: center;
    padding: 25px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 20px;
    border: 2px solid rgba(255, 255, 255, 0.1);
}

.certificate-preview-section.hidden {
    display: none;
}

.certificate-preview-section h3 {
    color: #fff;
    margin-bottom: 20px;
    font-size: 18px;
    font-family: 'Rubik', sans-serif;
    font-weight: 600;
}

/* Certificate Preview Container */
.certificate-preview {
    position: relative;
    display: inline-block;
    max-width: 100%;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
}

.certificate-preview img {
    max-width: 100%;
    max-height: 350px;
    display: block;
}

/* Certificate Text Overlay */
.certificate-text {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    font-family: 'Rubik', sans-serif;
}

/* ============================================
   TEXT POSITIONS - KOODI CERTIFICATE DESIGN
   Based on actual certificate layout
   ============================================ */

/* ТЕМА (Course name) - під написом "ТЕМА" */
.certificate-preview .cert-tema {
    position: absolute;
    top: 47%;
    left: 50%;
    transform: translateX(-50%);
    font-size: clamp(12px, 2.5vw, 18px);
    font-weight: 700;
    color: #1a1a2e;
    text-align: center;
    white-space: nowrap;
    font-family: 'Rubik', sans-serif;
}

/* Ім'я користувача - під написом "для" */
.certificate-preview .cert-name {
    position: absolute;
    top: 58%;
    left: 50%;
    transform: translateX(-50%);
    font-size: clamp(11px, 2.2vw, 16px);
    font-weight: 600;
    color: #1a1a2e;
    text-align: center;
    white-space: nowrap;
    font-family: 'Rubik', sans-serif;
}

/* Дата - зліва внизу */
.certificate-preview .cert-date {
    position: absolute;
    top: 72%;
    left: 30%;
    transform: translateX(-50%);
    font-size: clamp(8px, 1.5vw, 11px);
    font-weight: 500;
    color: #333;
    font-family: 'Rubik', sans-serif;
}

/* Команда KOODI - справа внизу */
.certificate-preview .cert-team {
    position: absolute;
    top: 72%;
    left: 69%;
    transform: translateX(-50%);
    font-size: clamp(8px, 1.5vw, 11px);
    font-weight: 700;
    color: #333;
    font-family: 'Rubik', sans-serif;
}

/* ============================================
   ДИЗАЙНИ 5-8 (Row 2 - Кудик зліва, текст правіше)
   ============================================ */

/* Дизайн 5 (Row 2 з Кудиком) */
.certificate-preview.design-5 .cert-tema {
    top: 47%;
    left: 69%;
}

.certificate-preview.design-5 .cert-name {
    top: 58%;
    left: 69%;
}

.certificate-preview.design-5 .cert-date {
    top: 72%;
    left: 57%;
}

.certificate-preview.design-5 .cert-team {
    top: 72%;
    left: 83%;
}

/* Дизайн 7 (Row 2 з Кудиком) */
.certificate-preview.design-7 .cert-tema {
    top: 47%;
    left: 69%;
}

.certificate-preview.design-7 .cert-name {
    top: 58%;
    left: 69%;
}

.certificate-preview.design-7 .cert-date {
    top: 72%;
    left: 57%;
}

.certificate-preview.design-7 .cert-team {
    top: 72%;
    left: 83%;
}

/* ============================================
   ДИЗАЙН 6 (Помаранч + Кудик)
   ============================================ */
.certificate-preview.design-6 .cert-tema {
    top: 45%;
    left: 69%;
}

.certificate-preview.design-6 .cert-name {
    top: 55%;
    left: 69%;
}

.certificate-preview.design-6 .cert-date {
    top: 70%;
    left: 57%;
}

.certificate-preview.design-6 .cert-team {
    top: 70%;
    left: 83%;
}

/* ============================================
   ДИЗАЙН 8 (Зелений + Кудик)
   ============================================ */
.certificate-preview.design-8 .cert-tema {
    top: 42%;
    left: 69%;
}

.certificate-preview.design-8 .cert-name {
    top: 52%;
    left: 69%;
}

.certificate-preview.design-8 .cert-date {
    top: 66%;
    left: 57%;
}

.certificate-preview.design-8 .cert-team {
    top: 66%;
    left: 83%;
}

/* ============================================
   ACTIONS
   ============================================ */
.certificate-actions {
    text-align: center;
    margin-top: 25px;
}

.btn-get-certificate {
    background: linear-gradient(135deg, #FF4E99, #FF9F00);
    color: #fff;
    border: none;
    padding: 18px 50px;
    font-size: 18px;
    font-weight: 700;
    border-radius: 35px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
    box-shadow: 0 8px 30px rgba(255, 78, 153, 0.5);
    font-family: 'Rubik', sans-serif;
}

.btn-get-certificate:hover:not(:disabled) {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 15px 40px rgba(255, 78, 153, 0.6);
}

.btn-get-certificate:active:not(:disabled) {
    transform: translateY(0) scale(1);
}

.btn-get-certificate:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-get-certificate.loading {
    pointer-events: none;
}

.btn-get-certificate.loading::after {
    content: '';
    display: inline-block;
    width: 18px;
    height: 18px;
    margin-left: 12px;
    border: 3px solid #fff;
    border-top-color: transparent;
    border-radius: 50%;
    animation: btnSpinner 0.8s linear infinite;
    vertical-align: middle;
}

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

/* ============================================
   CONFETTI
   ============================================ */
.confetti {
    position: fixed;
    width: 12px;
    height: 12px;
    top: -15px;
    z-index: 999999;
    animation: confetti-fall linear forwards;
    pointer-events: none;
}

@keyframes confetti-fall {
    0% {
        opacity: 1;
        transform: translateY(0) rotate(0deg);
    }
    100% {
        opacity: 0;
        transform: translateY(100vh) rotate(720deg);
    }
}

/* ============================================
   SUCCESS STATE
   ============================================ */
.certificate-success {
    text-align: center;
    padding: 40px;
}

.certificate-success .success-icon {
    font-size: 80px;
    margin-bottom: 20px;
    animation: successBounce 0.6s ease-out;
}

@keyframes successBounce {
    0% { transform: scale(0); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

.certificate-success h3 {
    color: #C6DF2B;
    font-size: 28px;
    margin-bottom: 15px;
    font-family: 'Rubik', sans-serif;
    font-weight: 700;
}

.certificate-success p {
    color: #fff;
    font-size: 16px;
    margin-bottom: 10px;
    font-family: 'Rubik', sans-serif;
}

.certificate-success .btn-download {
    background: linear-gradient(135deg, #C6DF2B, #009DFF);
    color: #1A1A2E;
    border: none;
    padding: 15px 40px;
    font-size: 16px;
    font-weight: 700;
    border-radius: 30px;
    cursor: pointer;
    margin-top: 20px;
    transition: all 0.3s;
    font-family: 'Rubik', sans-serif;
}

.certificate-success .btn-download:hover {
    transform: scale(1.05);
}

.certificate-success .btn-close {
    background: transparent;
    border: 2px solid rgba(255, 255, 255, 0.3);
    color: #fff;
    padding: 12px 35px;
    font-size: 14px;
    border-radius: 25px;
    cursor: pointer;
    margin-top: 15px;
    margin-left: 10px;
    transition: all 0.3s;
    font-family: 'Rubik', sans-serif;
}

.certificate-success .btn-close:hover {
    border-color: #FF4E99;
    color: #FF4E99;
}

/* ============================================
   SCROLLBAR
   ============================================ */
.certificate-modal-content::-webkit-scrollbar {
    width: 8px;
}

.certificate-modal-content::-webkit-scrollbar-track {
    background: #f0f0f0;
    border-radius: 4px;
}

.certificate-modal-content::-webkit-scrollbar-thumb {
    background: #131010;
    border-radius: 4px;
}

.certificate-modal-content::-webkit-scrollbar-thumb:hover {
    background: #333;
}

/* Hidden canvas */
#certificateCanvas {
    display: none;
}

/* ============================================
   ГАЛЕРЕЯ СЕРТИФІКАТІВ
   ============================================ */

.certificates-gallery-content {
    max-width: 900px;
}

.certificates-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 25px;
    padding: 10px 0;
    max-height: 60vh;
    overflow-y: auto;
}

.certificates-loading,
.no-certificates {
    grid-column: 1 / -1;
    text-align: center;
    padding: 50px 30px;
    background: #f8f8f8;
    border-radius: 20px;
    border: 3px dashed #131010;
}

.no-certificates .no-certs-icon {
    font-size: 4rem;
    margin-bottom: 20px;
}

.no-certificates h3 {
    color: #131010;
    margin-bottom: 10px;
    font-family: 'Rubik', sans-serif;
    font-weight: 800;
    font-size: 1.5rem;
}

.no-certificates p {
    color: #555;
    font-family: 'Rubik', sans-serif;
    font-size: 1rem;
}

/* Certificate Card - BRUTAL STYLE */
.certificate-card {
    background: #ffffff;
    border-radius: 20px;
    overflow: hidden;
    border: 3px solid #131010;
    transition: all 0.2s ease;
    box-shadow: 6px 6px 0px #131010;
}

.certificate-card:hover {
    transform: translate(-3px, -3px);
    box-shadow: 9px 9px 0px #131010;
}

.cert-card-image {
    position: relative;
    overflow: hidden;
    margin: 12px;
    border-radius: 16px;
    border: 3px solid #131010;
    background: #f8f8f8;
}

/* Certificate preview inside gallery card */
.cert-card-image .certificate-preview {
    position: relative;
    display: block;
    width: 100%;
    box-shadow: none;
    border-radius: 0;
}

.cert-card-image .certificate-preview img {
    width: 100%;
    height: auto;
    display: block;
    max-height: none;
}

.certificate-card:hover .cert-card-image .certificate-preview img {
    transform: scale(1.02);
    transition: transform 0.3s;
}

/* Text on gallery certificate cards */
.cert-card-image .certificate-preview .cert-tema {
    font-size: clamp(10px, 2vw, 14px);
}

.cert-card-image .certificate-preview .cert-name {
    font-size: clamp(9px, 1.8vw, 12px);
}

.cert-card-image .certificate-preview .cert-date,
.cert-card-image .certificate-preview .cert-team {
    font-size: clamp(6px, 1.2vw, 9px);
}

.cert-card-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.85));
    padding: 30px 15px 10px;
    display: none; /* Прибрано, бо тепер текст на сертифікаті */
}

.cert-card-name {
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    font-family: 'Rubik', sans-serif;
}

.cert-card-info {
    padding: 15px 18px;
}

.cert-card-info h4 {
    color: #131010;
    font-size: 1.1rem;
    margin: 0 0 8px 0;
    font-family: 'Rubik', sans-serif;
    font-weight: 800;
}

.cert-card-date {
    color: #555;
    font-size: 0.9rem;
    margin: 0;
    font-family: 'Rubik', sans-serif;
    font-weight: 500;
}

.cert-card-actions {
    display: flex;
    gap: 12px;
    padding: 0 18px 18px;
}

.cert-action-btn {
    flex: 1;
    padding: 12px 16px;
    border: 3px solid #131010;
    border-radius: 12px;
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: 'Rubik', sans-serif;
    box-shadow: 4px 4px 0px #131010;
}

.cert-action-btn.download {
    background: #C6DF2B;
    color: #131010;
}

.cert-action-btn.download:hover {
    transform: translate(-2px, -2px);
    box-shadow: 6px 6px 0px #131010;
}

.cert-action-btn.share {
    background: #ffffff;
    color: #131010;
}

.cert-action-btn.share:hover {
    background: #FF4E99;
    color: #ffffff;
    transform: translate(-2px, -2px);
    box-shadow: 6px 6px 0px #131010;
}

/* Scrollbar for gallery - BRUTAL STYLE */
.certificates-gallery::-webkit-scrollbar {
    width: 8px;
}

.certificates-gallery::-webkit-scrollbar-track {
    background: #f0f0f0;
    border-radius: 4px;
}

.certificates-gallery::-webkit-scrollbar-thumb {
    background: #131010;
    border-radius: 4px;
}

.certificates-gallery::-webkit-scrollbar-thumb:hover {
    background: #333;
}

/* Mobile responsive */
@media (max-width: 600px) {
    .certificates-gallery {
        grid-template-columns: 1fr;
    }

    .cert-card-actions {
        flex-direction: column;
    }
}

/* ============================================
   КНОПКА "МОЇ СЕРТИФІКАТИ"
   ============================================ */
.my-certificates-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 18px 35px;
    background: #FF9F00;
    color: #131010;
    border: 3px solid #131010;
    border-radius: 15px;
    font-size: 1.1em;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: 'Rubik', sans-serif;
    box-shadow: 5px 5px 0px #131010;
}

.my-certificates-btn:hover {
    transform: translate(-2px, -2px);
    box-shadow: 7px 7px 0px #131010;
}

.my-certificates-btn:active {
    transform: translate(2px, 2px);
    box-shadow: 3px 3px 0px #131010;
}

.my-certificates-btn .btn-icon,
.my-certificates-btn i {
    font-size: 1.1em;
}
