/* ============================================================
   ПОДАРОЧНЫЕ СЕРТИФИКАТЫ
   ============================================================ */

.cert-section {
    padding: 80px 0 60px;
    background: rgba(0,0,0,0.35);
    position: relative; overflow: hidden;
}
.cert-section h2 { margin-bottom: 20px; }
.cert-subtitle {
    text-align: center;
    color: var(--text-muted);
    font-family: 'Cormorant', serif;
    font-style: italic;
    font-size: 1.15em;
    margin: 0 0 50px;
    letter-spacing: 0.5px;
}

/* ============ КАРУСЕЛЬ НА ГЛАВНОЙ ============ */
.cert-carousel {
    position: relative;
    display: flex; align-items: center; justify-content: center;
    gap: 20px; max-width: 1100px; margin: 0 auto;
    perspective: 1600px;
}
.cert-stage {
    position: relative; flex: 1;
    height: 340px;
    display: flex; align-items: center; justify-content: center;
    transform-style: preserve-3d;
}
.cert-arrow {
    width: 52px; height: 52px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    color: var(--text-muted);
    font-size: 1.4em; cursor: pointer;
    transition: all 0.25s;
    flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    user-select: none; z-index: 3;
}
.cert-arrow:hover {
    background: rgba(212, 175, 55, 0.15);
    border-color: var(--champagne);
    color: var(--champagne);
    transform: scale(1.08);
}

.cert-card {
    position: absolute;
    width: 440px; max-width: 82vw;
    border-radius: 18px; overflow: hidden;
    cursor: pointer;
    transition:
        transform 0.6s cubic-bezier(0.25, 1, 0.5, 1),
        opacity 0.6s ease,
        box-shadow 0.4s ease;
    transform-style: preserve-3d;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow:
        0 20px 50px rgba(0, 0, 0, 0.55),
        inset 0 1px 0 rgba(255, 255, 255, 0.15);
}
.cert-card img {
    display: block; width: 100%; height: auto;
    aspect-ratio: 1.586 / 1;
    object-fit: cover;
    transition: transform 0.6s ease;
    pointer-events: none;
}
.cert-card::after {
    content: '';
    position: absolute;
    top: -50%; left: -100%;
    width: 60%; height: 200%;
    background: linear-gradient(100deg,
        transparent 0%,
        rgba(255, 255, 255, 0.35) 50%,
        transparent 100%);
    transform: skewX(-20deg);
    pointer-events: none;
    z-index: 2;
}
.cert-card.is-active::after { animation: certShine 4.5s ease-in-out infinite; }
@keyframes certShine {
    0%   { left: -100%; }
    40%  { left: 150%; }
    100% { left: 150%; }
}

.cert-card.pos-active {
    transform: translateX(0) translateZ(80px) rotateY(0deg);
    opacity: 1; z-index: 5;
}
.cert-card.pos-prev {
    transform: translateX(-62%) translateZ(-100px) rotateY(35deg) scale(0.82);
    opacity: 0.55; z-index: 2;
}
.cert-card.pos-next {
    transform: translateX(62%) translateZ(-100px) rotateY(-35deg) scale(0.82);
    opacity: 0.55; z-index: 2;
}
.cert-card.pos-far-left {
    transform: translateX(-125%) translateZ(-300px) rotateY(50deg) scale(0.6);
    opacity: 0; z-index: 1; pointer-events: none;
}
.cert-card.pos-far-right {
    transform: translateX(125%) translateZ(-300px) rotateY(-50deg) scale(0.6);
    opacity: 0; z-index: 1; pointer-events: none;
}

.cert-badge {
    position: absolute;
    top: 14px; right: 14px;
    width: 60px; height: 60px;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 30%, #FBBF24 0%, #B8860B 70%, #8B6508 100%);
    box-shadow:
        0 4px 14px rgba(0, 0, 0, 0.5),
        inset 0 1px 2px rgba(255, 255, 255, 0.5),
        inset 0 -2px 4px rgba(0, 0, 0, 0.3);
    display: flex; align-items: center; justify-content: center;
    color: #3B1740;
    font-family: 'Montserrat', sans-serif;
    font-weight: 700; font-size: 0.7em;
    text-align: center; line-height: 1.1;
    z-index: 3; pointer-events: none;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.cert-badge::before {
    content: '★';
    position: absolute; top: 4px;
    font-size: 0.85em; color: #FFF5C9;
    text-shadow: 0 1px 1px rgba(0,0,0,0.4);
}

.cert-info {
    max-width: 520px;
    margin: 26px auto 0;
    text-align: center;
    min-height: 130px;
}
.cert-title {
    font-family: 'Playfair Display', serif;
    font-style: italic; font-weight: 700;
    font-size: 1.5em; color: var(--champagne);
    margin: 0 0 8px; letter-spacing: 0.3px;
}
.cert-desc {
    font-family: 'Cormorant', serif;
    font-style: italic; font-size: 1.1em;
    color: var(--text-primary);
    line-height: 1.5; margin: 0 0 18px;
}
.cert-cta {
    display: inline-flex; align-items: center;
    gap: 10px; padding: 14px 32px;
    border-radius: 50px;
    background: linear-gradient(135deg, var(--amethyst), #7E22CE);
    color: #fff;
    font-family: 'Montserrat', sans-serif;
    font-weight: 700; font-size: 0.95em;
    text-decoration: none;
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow:
        0 8px 24px rgba(168, 85, 247, 0.45),
        inset 0 1px 0 rgba(255, 255, 255, 0.35),
        inset 0 -2px 0 rgba(0, 0, 0, 0.2);
    transition: transform 0.25s, box-shadow 0.25s;
}
.cert-cta:hover {
    transform: translateY(-2px);
    box-shadow:
        0 12px 32px rgba(168, 85, 247, 0.6),
        inset 0 1px 0 rgba(255, 255, 255, 0.4),
        inset 0 -2px 0 rgba(0, 0, 0, 0.2);
}
.cert-dots {
    display: flex; justify-content: center;
    gap: 10px; margin-top: 24px;
}
.cert-dot {
    width: 10px; height: 10px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.25);
    cursor: pointer; transition: all 0.25s;
}
.cert-dot.active {
    background: var(--champagne);
    box-shadow: 0 0 12px var(--champagne);
    transform: scale(1.3);
}

/* ============ ЛАЙТБОКС ============ */
.cert-lightbox {
    position: fixed; inset: 0;
    background: rgba(10, 5, 15, 0.85);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    display: none; align-items: center; justify-content: center;
    z-index: 3000; padding: 20px; cursor: zoom-out;
}
.cert-lightbox.active { display: flex; }

/* ============================================================
   ЛАЙТБОКС С ГАЛЕРЕЕЙ — ФОТО И НАВИГАЦИЯ
   ============================================================ */

.cert-lb-stage {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    max-width: 94vw;
    max-height: 90vh;
    padding: 0 120px;
    box-sizing: border-box;
}

.cert-lb-img {
    display: block;
    max-width: 82vw;
    max-height: 88vh;
    border-radius: 16px;
    box-shadow:
        0 30px 80px rgba(0, 0, 0, 0.7),
        0 0 0 1px rgba(212, 175, 55, 0.35);
    object-fit: contain;
    cursor: default;
    user-select: none;
    -webkit-user-drag: none;
    transition: opacity 0.13s ease;
}
.cert-lb-img.is-fading { opacity: 0.25; }

/* --- Зелёные стрелки в стиле «плашек админки» --- */

.cert-lb-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 80px;
    height: 80px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Montserrat', sans-serif;
    font-weight: 900;
    font-size: 2.6em;
    line-height: 1;
    color: #052e16;
    text-shadow:
        0 2px 4px rgba(255, 255, 255, 0.55),
        0 -1px 2px rgba(0, 0, 0, 0.3);
    padding: 0 0 6px 0;
    z-index: 5;
    user-select: none;

    background: radial-gradient(circle at 35% 30%,
        #BBF7D0 0%,
        #86EFAC 25%,
        #22C55E 60%,
        #15803D 90%,
        #052e16 100%);

    box-shadow:
        0 0 30px rgba(34, 197, 94, 0.55),
        0 0 60px rgba(34, 197, 94, 0.35),
        inset 0 4px 8px rgba(255, 255, 255, 0.5),
        inset 0 -6px 12px rgba(0, 0, 0, 0.25);

    animation: certLbArrowPulse 1.6s ease-in-out infinite;
    transition: transform 0.25s, box-shadow 0.25s;
}

.cert-lb-arrow::before,
.cert-lb-arrow::after {
    content: '';
    position: absolute;
    inset: -8px;
    border-radius: 50%;
    border: 3px solid rgba(34, 197, 94, 0.6);
    animation: certLbArrowRing 2s ease-out infinite;
    pointer-events: none;
}
.cert-lb-arrow::after { animation-delay: 1s; }

@keyframes certLbArrowPulse {
    0%, 100% {
        transform: translateY(-50%) scale(1);
        box-shadow:
            0 0 30px rgba(34, 197, 94, 0.55),
            0 0 60px rgba(34, 197, 94, 0.35),
            inset 0 4px 8px rgba(255, 255, 255, 0.5),
            inset 0 -6px 12px rgba(0, 0, 0, 0.25);
    }
    50% {
        transform: translateY(-50%) scale(1.06);
        box-shadow:
            0 0 45px rgba(34, 197, 94, 0.85),
            0 0 90px rgba(34, 197, 94, 0.5),
            inset 0 4px 8px rgba(255, 255, 255, 0.6),
            inset 0 -6px 12px rgba(0, 0, 0, 0.25);
    }
}
@keyframes certLbArrowRing {
    0%   { transform: scale(1);   opacity: 1; }
    100% { transform: scale(1.8); opacity: 0; }
}

.cert-lb-arrow:hover {
    transform: translateY(-50%) scale(1.15);
    box-shadow:
        0 0 55px rgba(34, 197, 94, 1),
        0 0 110px rgba(34, 197, 94, 0.6),
        inset 0 4px 10px rgba(255, 255, 255, 0.65),
        inset 0 -6px 12px rgba(0, 0, 0, 0.25);
    animation-play-state: paused;
}
.cert-lb-arrow:active {
    transform: translateY(-50%) scale(0.95);
}
.cert-lb-arrow-prev { left: 20px; }
.cert-lb-arrow-next { right: 20px; }

/* --- Красная кнопка закрытия — в правом верхнем углу ФОТО --- */

.cert-lb-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Montserrat', sans-serif;
    font-weight: 900;
    font-size: 1.4em;
    line-height: 1;
    color: #450A0A;
    text-shadow:
        0 2px 4px rgba(255, 255, 255, 0.5),
        0 -1px 2px rgba(0, 0, 0, 0.3);
    padding: 0;
    z-index: 6;
    user-select: none;

    background: radial-gradient(circle at 35% 30%,
        #FECACA 0%,
        #FCA5A5 25%,
        #EF4444 60%,
        #991B1B 90%,
        #450A0A 100%);

    box-shadow:
        0 0 30px rgba(239, 68, 68, 0.55),
        0 0 60px rgba(239, 68, 68, 0.35),
        inset 0 4px 8px rgba(255, 255, 255, 0.5),
        inset 0 -6px 12px rgba(0, 0, 0, 0.25);

    animation: certLbClosePulse 1.6s ease-in-out infinite;
    transition: transform 0.25s, box-shadow 0.25s;
}

.cert-lb-close::before,
.cert-lb-close::after {
    content: '';
    position: absolute;
    inset: -6px;
    border-radius: 50%;
    border: 3px solid rgba(239, 68, 68, 0.6);
    animation: certLbCloseRing 2s ease-out infinite;
    pointer-events: none;
}
.cert-lb-close::after { animation-delay: 1s; }

@keyframes certLbClosePulse {
    0%, 100% {
        transform: scale(1);
        box-shadow:
            0 0 30px rgba(239, 68, 68, 0.55),
            0 0 60px rgba(239, 68, 68, 0.35),
            inset 0 4px 8px rgba(255, 255, 255, 0.5),
            inset 0 -6px 12px rgba(0, 0, 0, 0.25);
    }
    50% {
        transform: scale(1.08);
        box-shadow:
            0 0 45px rgba(239, 68, 68, 0.85),
            0 0 90px rgba(239, 68, 68, 0.55),
            inset 0 4px 8px rgba(255, 255, 255, 0.6),
            inset 0 -6px 12px rgba(0, 0, 0, 0.25);
    }
}
@keyframes certLbCloseRing {
    0%   { transform: scale(1);   opacity: 1; }
    100% { transform: scale(1.8); opacity: 0; }
}

.cert-lb-close:hover {
    transform: scale(1.15) rotate(90deg);
    box-shadow:
        0 0 55px rgba(239, 68, 68, 1),
        0 0 110px rgba(239, 68, 68, 0.6),
        inset 0 4px 10px rgba(255, 255, 255, 0.65),
        inset 0 -6px 12px rgba(0, 0, 0, 0.25);
    animation-play-state: paused;
}
.cert-lb-close:active {
    transform: scale(0.95) rotate(90deg);
}

/* --- Счётчик --- */
.cert-lb-counter {
    position: absolute;
    bottom: 16px;
    left: 50%;
    transform: translateX(-50%);
    padding: 8px 18px;
    border-radius: 30px;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(34, 197, 94, 0.5);
    color: #86EFAC;
    font-family: 'Montserrat', sans-serif;
    font-weight: 700;
    font-size: 0.9em;
    letter-spacing: 0.5px;
    white-space: nowrap;
    z-index: 5;
}

/* ============================================================
   ЛЕНТА ПРЕВЬЮ В АДМИНКЕ
   ============================================================ */

.cert-edit-thumbs-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 14px;
}

.cert-edit-thumb {
    position: relative;
    width: 120px;
    height: 76px;
    border-radius: 10px;
    background-color: rgba(0, 0, 0, 0.4);
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    border: 1px solid var(--border-glass);
    box-sizing: border-box;
    cursor: pointer;
    overflow: hidden;
    transition: all 0.2s;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}
.cert-edit-thumb:hover {
    border-color: var(--champagne);
    box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.15);
    transform: translateY(-2px);
}

.cert-edit-thumb.is-cover {
    border: 2px solid var(--champagne);
    box-shadow:
        0 0 0 3px rgba(212, 175, 55, 0.2),
        0 4px 12px rgba(212, 175, 55, 0.3);
}

.cert-thumb-badge {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 3px 6px;
    background: linear-gradient(180deg, transparent 0%, rgba(0, 0, 0, 0.85) 100%);
    color: var(--champagne);
    font-family: 'Montserrat', sans-serif;
    font-weight: 700;
    font-size: 0.65em;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    text-align: center;
    pointer-events: none;
}

.cert-edit-thumb .cert-clear-photo {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: rgba(239, 68, 68, 0.9);
    border: 2px solid var(--bg-deep);
    color: #fff;
    font-size: 0.65em;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 3;
    padding: 0;
    line-height: 1;
    opacity: 0;
    transition: opacity 0.2s, transform 0.15s;
}
.cert-edit-thumb:hover .cert-clear-photo { opacity: 1; }
.cert-edit-thumb .cert-clear-photo:hover {
    background: #dc2626;
    transform: scale(1.15);
}

.cert-edit-thumb-add {
    background: rgba(212, 175, 55, 0.06);
    border: 2px dashed rgba(212, 175, 55, 0.4);
    flex-direction: column;
    gap: 2px;
}
.cert-edit-thumb-add:hover {
    background: rgba(212, 175, 55, 0.12);
    border-color: var(--champagne);
    border-style: solid;
}
.cert-add-icon {
    font-size: 1.6em;
    color: var(--champagne);
    line-height: 1;
    font-weight: 300;
    transition: transform 0.2s;
}
.cert-edit-thumb-add:hover .cert-add-icon {
    transform: scale(1.2);
}
.cert-add-hint {
    font-family: 'Montserrat', sans-serif;
    font-size: 0.68em;
    color: var(--text-dim);
    font-weight: 600;
    text-align: center;
    line-height: 1.1;
    padding: 0 4px;
}

.cert-edit-thumb-limit {
    background: rgba(0, 0, 0, 0.3);
    border: 2px dashed rgba(255, 255, 255, 0.1);
    cursor: not-allowed;
    opacity: 0.5;
}
.cert-edit-thumb-limit:hover {
    border-color: rgba(255, 255, 255, 0.1);
    box-shadow: none;
    transform: none;
}

.cert-edit-thumb-add.loading::before {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    border-radius: 10px;
    z-index: 2;
}
.cert-edit-thumb-add.loading::after {
    content: '\f110';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    animation: certSpin 0.8s linear infinite;
    opacity: 1;
    color: var(--champagne);
    font-size: 1.6em;
    z-index: 3;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}
@keyframes certSpin {
    from { transform: translate(-50%, -50%) rotate(0deg); }
    to   { transform: translate(-50%, -50%) rotate(360deg); }
}

/* Редактор сертификатов — карточки */
.cert-editor {
    background: var(--card-glass);
    border: 1px solid var(--border-glass);
    border-radius: 20px;
    padding: 24px;
    max-width: 1100px; margin: 0 auto;
}
.cert-admin-list {
    display: flex; flex-direction: column;
    gap: 14px; margin-top: 20px;
}
.cert-edit-card {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 18px; align-items: start;
    padding: 16px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-soft);
    border-radius: 14px;
    transition: all 0.25s;
}
.cert-edit-card:hover { border-color: rgba(212, 175, 55, 0.35); }
.cert-edit-card.saved {
    background: rgba(52, 211, 153, 0.12);
    border-color: var(--emerald-soft);
}
.cert-edit-fields {
    display: flex; flex-direction: column;
    gap: 10px; min-width: 0;
}
.cert-edit-fields input,
.cert-edit-fields textarea {
    width: 100%; padding: 10px 14px;
    border: 1px solid #444;
    background: rgba(0, 0, 0, 0.35);
    color: var(--text-primary);
    border-radius: 8px;
    font-family: inherit; font-size: 0.95em;
    box-sizing: border-box;
    transition: border-color 0.2s;
    resize: vertical;
}
.cert-edit-fields input:focus,
.cert-edit-fields textarea:focus {
    outline: none; border-color: var(--champagne);
    box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.12);
}
.cert-edit-fields textarea { min-height: 60px; }
.cert-edit-row { display: grid; grid-template-columns: 1fr; gap: 10px; }
.cert-edit-toggle {
    display: flex; align-items: center;
    gap: 8px; font-size: 0.88em;
    color: var(--text-muted);
    cursor: pointer; user-select: none;
    margin-top: 4px;
}
.cert-edit-toggle input[type="checkbox"] {
    width: 18px; height: 18px;
    accent-color: var(--emerald-soft);
    cursor: pointer;
}
.cert-edit-actions { display: flex; flex-direction: column; gap: 8px; }
.cert-edit-actions button {
    width: 44px; height: 44px;
    border-radius: 10px; border: none;
    cursor: pointer; font-size: 1em;
    transition: all 0.2s;
    display: flex; align-items: center; justify-content: center;
}
.cert-file-input { display: none; }

/* ============================================================
   МОБИЛЬНАЯ ВЕРСИЯ
   ============================================================ */

@media (max-width: 900px) {
    .cert-lb-stage { padding: 0 90px; }
    .cert-lb-arrow { width: 64px; height: 64px; font-size: 2em; }
    .cert-lb-arrow-prev { left: 12px; }
    .cert-lb-arrow-next { right: 12px; }
    .cert-lb-img { max-width: 78vw; }
    .cert-lb-close { width: 46px; height: 46px; font-size: 1.2em; top: 8px; right: 8px; }
}

@media (max-width: 600px) {
    .cert-lb-stage { padding: 0 60px; }
    .cert-lb-arrow { width: 52px; height: 52px; font-size: 1.7em; }
    .cert-lb-arrow-prev { left: 6px; }
    .cert-lb-arrow-next { right: 6px; }
    .cert-lb-arrow::before,
    .cert-lb-arrow::after { inset: -5px; border-width: 2px; }
    .cert-lb-img { max-width: 72vw; max-height: 82vh; border-radius: 12px; }
    .cert-lb-counter { font-size: 0.8em; padding: 6px 14px; bottom: 12px; }
    .cert-lb-close {
        width: 40px; height: 40px; font-size: 1em;
        top: 6px; right: 6px;
    }
    .cert-lb-close::before,
    .cert-lb-close::after { inset: -4px; border-width: 2px; }

    .cert-edit-thumbs-row { gap: 6px; }
    .cert-edit-thumb { width: 90px; height: 57px; border-radius: 8px; }
    .cert-add-icon { font-size: 1.3em; }
    .cert-add-hint { font-size: 0.6em; }
    .cert-thumb-badge { font-size: 0.58em; padding: 2px 4px; }
    .cert-edit-thumb .cert-clear-photo {
        width: 20px; height: 20px; font-size: 0.6em;
    }

    .cert-editor { padding: 14px; border-radius: 16px; }
    .cert-admin-list { gap: 8px; margin-top: 12px; }
    .cert-edit-card {
        grid-template-columns: 1fr;
        gap: 10px; padding: 10px; border-radius: 10px;
    }
    .cert-edit-actions {
        flex-direction: row;
        justify-content: flex-end; gap: 6px;
    }
    .cert-edit-actions button { width: 36px; height: 36px; }
}