/**
 * Digicard Card Styles
 *
 * Estilos premium para la tarjeta digital standalone.
 * Se carga condicionalmente solo en single-digicard.
 *
 * @package Cadena_Child
 * @since 1.3.0
 */

/* ==========================================================================
   1. Standalone Page Reset
   ========================================================================== */

body.single-digicard {
    margin: 0 !important;
    padding: 0 !important;
    background: var(--dc-bg, linear-gradient(135deg, #667eea 0%, #764ba2 100%)) !important;
    height: 100vh;
    height: 100dvh;
    overflow: hidden !important;
}

body.single-digicard .wp-site-blocks {
    padding: 0 !important;
    margin: 0 !important;
    max-width: none !important;
}

body.single-digicard .wp-site-blocks>* {
    margin: 0 !important;
    padding: 0 !important;
    max-width: none !important;
}

/* ==========================================================================
   2. Page Wrapper
   ========================================================================== */

.digicard-page {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100vh;
    height: 100dvh;
    padding: 24px 16px;
    box-sizing: border-box;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow: hidden;
}

/* ==========================================================================
   3. Card Container
   ========================================================================== */

.digicard-card {
    position: relative;
    width: 100%;
    max-width: 420px;
    height: calc(100vh - 48px);
    height: calc(100dvh - 48px);
    background: var(--dc-bg, linear-gradient(135deg, #667eea 0%, #764ba2 100%));
    border-radius: 28px;
    box-shadow:
        0 4px 6px rgba(0, 0, 0, 0.07),
        0 20px 60px rgba(0, 0, 0, 0.18);
    overflow: hidden;
    animation: dcFadeInUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) both;
    display: flex;
    flex-direction: column;
}

/* ==========================================================================
   4. QR Button
   ========================================================================== */

.digicard-qr-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 44px;
    height: 44px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.18);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.25);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--dc-icon, #fff);
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 2;
    -webkit-tap-highlight-color: transparent;
}

.digicard-qr-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    color: var(--dc-icon, #fff);
    transform: scale(1.08);
}

.digicard-qr-btn:active {
    transform: scale(0.95);
}

/* ==========================================================================
   5. Profile Section
   ========================================================================== */

.digicard-profile {
    text-align: center;
    padding: 78px 32px 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    flex-shrink: 0;
}

.digicard-avatar-wrapper {
    width: 110px;
    height: 110px;
    margin: 0 auto 20px;
    border-radius: 50%;
    overflow: hidden;
    box-shadow:
        0 0 0 4px rgba(255, 255, 255, 0.35),
        0 8px 30px rgba(0, 0, 0, 0.15);
    animation: dcFadeInUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) 0.1s both;
}

.digicard-avatar-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.digicard-name {
    margin: 0 0 8px !important;
    font-size: 1.65rem !important;
    font-weight: 700 !important;
    color: var(--dc-text, #fff) !important;
    letter-spacing: -0.025em;
    line-height: 1.2 !important;
    animation: dcFadeInUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) 0.15s both;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

.digicard-description {
    margin: 0 auto !important;
    font-size: 0.925rem !important;
    color: var(--dc-text, #fff) !important;
    opacity: 0.85;
    line-height: 1.55 !important;
    max-width: 300px;
    animation: dcFadeInUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) 0.2s both;
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ==========================================================================
   6. CTA Action Buttons
   ========================================================================== */

.digicard-actions {
    padding: 0 28px 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    flex-shrink: 0;
    animation: dcFadeInUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) 0.25s both;
}

.digicard-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 15px 24px;
    border-radius: 16px;
    font-size: 0.975rem;
    font-weight: 600;
    text-decoration: none !important;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    cursor: pointer;
    border: none;
    font-family: inherit;
    -webkit-tap-highlight-color: transparent;
}

/* WhatsApp CTA */
.digicard-btn-whatsapp {
    background: var(--dc-accent, #25D366);
    color: #fff !important;
}

.digicard-btn-whatsapp:hover {
    filter: brightness(1.1);
    transform: translateY(-2px);
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.2);
    color: #fff !important;
}

.digicard-btn-whatsapp:active {
    transform: translateY(0) scale(0.98);
}

/* Custom Link CTA */
.digicard-btn-custom {
    background: rgba(255, 255, 255, 0.15);
    color: #fff !important;
    border: 2px solid rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.digicard-btn-custom:hover {
    border-color: rgba(255, 255, 255, 0.5);
    background: rgba(255, 255, 255, 0.25);
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
    color: #fff !important;
}

.digicard-btn-custom:active {
    transform: translateY(0) scale(0.98);
}

/* ==========================================================================
   7. Social Icons
   ========================================================================== */

.digicard-socials {
    display: flex;
    justify-content: center;
    gap: 14px;
    padding: 4px 28px 28px;
    flex-wrap: wrap;
    flex-shrink: 0;
    animation: dcFadeInUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) 0.3s both;
}

.digicard-social-icon {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.18);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--dc-icon, #fff);
    text-decoration: none !important;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    -webkit-tap-highlight-color: transparent;
}

.digicard-social-icon:hover {
    transform: scale(1.12) translateY(-3px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
}

.digicard-social-icon:active {
    transform: scale(0.95);
}

/* Brand colors on hover */
.digicard-social-icon.dc-facebook:hover {
    background: #1877F2;
    color: #fff;
}

.digicard-social-icon.dc-instagram:hover {
    background: #E4405F;
    color: #fff;
}

.digicard-social-icon.dc-tiktok:hover {
    background: #010101;
    color: #fff;
}

.digicard-social-icon.dc-email:hover {
    background: #EA4335;
    color: #fff;
}

.digicard-social-icon.dc-phone:hover {
    background: #34B7F1;
    color: #fff;
}

.digicard-social-icon.dc-web:hover {
    background: #6366f1;
    color: #fff;
}

.digicard-social-icon.dc-linkedin:hover {
    background: #0A66C2;
    color: #fff;
}

/* ==========================================================================
   8. Location Footer
   ========================================================================== */

.digicard-location {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 20px 28px;
    background: rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    text-decoration: none !important;
    color: #fff !important;
    transition: background 0.2s ease;
    animation: dcFadeInUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) 0.35s both;
    margin-top: auto;
}

.digicard-location:hover {
    background: rgba(0, 0, 0, 0.28);
}

.digicard-location-icon {
    flex-shrink: 0;
    width: 42px;
    height: 42px;
    border-radius: 14px;
    background: var(--dc-accent, #6366f1);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
}

.digicard-location-text {
    flex: 1;
    min-width: 0;
}

.digicard-location-label {
    font-size: 0.75rem !important;
    font-weight: 700 !important;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: rgba(255, 255, 255, 0.6) !important;
    margin: 0 0 3px !important;
}

.digicard-location-address {
    font-size: 0.875rem !important;
    color: rgba(255, 255, 255, 0.9) !important;
    margin: 0 !important;
    line-height: 1.45 !important;
}

/* ==========================================================================
   9. QR Overlay
   ========================================================================== */

.digicard-qr-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 99999;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    background: var(--dc-bg, linear-gradient(135deg, #667eea 0%, #764ba2 100%));
}

.digicard-qr-overlay.is-active {
    display: flex;
    animation: dcFadeIn 0.3s ease-out;
}

.digicard-qr-back {
    position: absolute;
    top: max(env(safe-area-inset-top, 16px), 20px);
    left: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 22px;
    background: rgba(255, 255, 255, 0.18);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 14px;
    color: #fff;
    font-size: 0.925rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.25s ease;
    -webkit-tap-highlight-color: transparent;
}

.digicard-qr-back:hover {
    background: rgba(255, 255, 255, 0.28);
}

.digicard-qr-content {
    text-align: center;
    animation: dcFadeInUp 0.5s cubic-bezier(0.16, 1, 0.3, 1) 0.1s both;
}

.digicard-qr-image {
    width: 230px;
    height: 230px;
    background: #fff;
    border-radius: 24px;
    padding: 18px;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.2);
    margin: 0 auto 28px;
    box-sizing: border-box;
}

.digicard-qr-image img {
    width: 100%;
    height: 100%;
    display: block;
    border-radius: 4px;
}

.digicard-qr-name {
    font-size: 1.5rem !important;
    font-weight: 700 !important;
    color: #fff !important;
    margin: 0 0 8px !important;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.digicard-qr-hint {
    font-size: 0.95rem !important;
    color: rgba(255, 255, 255, 0.8) !important;
    margin: 0 !important;
}

/* ==========================================================================
   9b. Gallery Circles
   ========================================================================== */

.digicard-galleries {
    display: flex;
    justify-content: center;
    gap: 20px;
    padding: 4px 28px 24px;
    flex-wrap: wrap;
    flex-shrink: 0;
    animation: dcFadeInUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) 0.32s both;
}

.digicard-gallery-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    outline: none;
    -webkit-tap-highlight-color: transparent;
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.digicard-gallery-item:hover {
    transform: scale(1.08);
}

.digicard-gallery-item:active {
    transform: scale(0.95);
}

.digicard-gallery-thumb {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    overflow: hidden;
    box-shadow:
        0 0 0 3px rgba(255, 255, 255, 0.3),
        0 4px 12px rgba(0, 0, 0, 0.15);
    display: block;
}

.digicard-gallery-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.digicard-gallery-title {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--dc-text, #fff);
    opacity: 0.8;
    max-width: 80px;
    text-align: center;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ==========================================================================
   9c. Gallery Overlay & Viewer
   ========================================================================== */

.digicard-gallery-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 99999;
    flex-direction: column;
    align-items: center;
    background: var(--dc-bg, linear-gradient(135deg, #667eea 0%, #764ba2 100%));
}

.digicard-gallery-overlay.is-active {
    display: flex;
    animation: dcFadeIn 0.3s ease-out;
}

.digicard-gallery-overlay-title {
    color: #fff;
    font-size: 1.1rem !important;
    font-weight: 700 !important;
    margin: 0 !important;
    padding: 72px 24px 12px;
    text-align: center;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}

.digicard-gallery-viewer {
    flex: 1;
    width: 100%;
    max-width: 480px;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.digicard-gallery-track {
    display: flex;
    flex: 1;
    transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    will-change: transform;
}

.digicard-gallery-slide {
    flex: 0 0 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    box-sizing: border-box;
}

.digicard-gallery-slide img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

/* Nav Buttons */
.dc-gallery-prev,
.dc-gallery-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    color: #fff;
    font-size: 1.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    -webkit-tap-highlight-color: transparent;
    z-index: 2;
}

.dc-gallery-prev {
    left: 12px;
}

.dc-gallery-next {
    right: 12px;
}

.dc-gallery-prev:hover,
.dc-gallery-next:hover {
    background: rgba(255, 255, 255, 0.3);
}

@media (max-width: 480px) {

    .dc-gallery-prev,
    .dc-gallery-next {
        display: none;
    }
}

/* Dots */
.dc-gallery-dots {
    display: flex;
    justify-content: center;
    gap: 8px;
    padding: 12px 0 4px;
}

.dc-gallery-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    cursor: pointer;
    transition: all 0.25s ease;
}

.dc-gallery-dot.is-active {
    background: #fff;
    transform: scale(1.3);
}

/* Counter */
.dc-gallery-counter {
    text-align: center;
    color: rgba(255, 255, 255, 0.6) !important;
    font-size: 0.8rem !important;
    margin: 0 0 max(env(safe-area-inset-bottom, 12px), 16px) !important;
    font-weight: 600;
}

/* ==========================================================================
   9d. Video Circles & Overlay
   ========================================================================== */

/* Play icon overlay on circle */
.digicard-video-thumb {
    position: relative;
    background: rgba(0, 0, 0, 0.3);
}

.digicard-video-play {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.25);
    border-radius: 50%;
}

.digicard-video-play::after {
    content: '';
    display: block;
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 8px 0 8px 14px;
    border-color: transparent transparent transparent var(--dc-icon, #fff);
    margin-left: 3px;
}

/* Video slide content */
.digicard-video-slide {
    flex-direction: column;
    padding: 16px;
}

/* Self-hosted video */
.dc-video-player {
    width: 100%;
    max-height: 70vh;
    display: block;
    border-radius: 14px;
    background: #000;
    object-fit: contain;
}

/* Embed (YouTube/Vimeo) */
.dc-video-embed-wrap {
    position: relative;
    width: 100%;
    padding-bottom: 56.25%;
    /* 16:9 */
    height: 0;
    overflow: hidden;
    background: #000;
    border-radius: 14px;
}

.dc-video-embed {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
    border-radius: 14px;
}

/* ==========================================================================
   10. Animations
   ========================================================================== */

@keyframes dcFadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes dcFadeInUp {
    from {
        opacity: 0;
        transform: translateY(16px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ==========================================================================
   11. Responsive - Mobile Fullscreen
   ========================================================================== */

@media (max-width: 480px) {
    .digicard-page {
        padding: 0;
        align-items: stretch;
    }

    .digicard-card {
        border-radius: 0;
        max-width: 100%;
        height: 100vh;
        height: 100dvh;
    }

    .digicard-location {
        border-radius: 0;
    }
}

/* Prefer reduced motion */
@media (prefers-reduced-motion: reduce) {

    .digicard-card,
    .digicard-avatar-wrapper,
    .digicard-name,
    .digicard-description,
    .digicard-actions,
    .digicard-socials,
    .digicard-location,
    .digicard-qr-overlay.is-active,
    .digicard-qr-content {
        animation: none !important;
    }

    .digicard-btn,
    .digicard-social-icon,
    .digicard-qr-btn {
        transition: none !important;
    }
}

/* ==========================================================================
   12. Empresa Badge (on linked person cards)
   ========================================================================== */

.dc-empresa-badge {
    position: absolute;
    top: 20px;
    left: 20px;
    right: 68px;
    /* avoid QR button overlap */
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px 6px 6px;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 40px;
    text-decoration: none !important;
    color: var(--dc-text, #fff) !important;
    z-index: 2;
    max-width: calc(100% - 92px);
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    animation: dcFadeInUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) 0.05s both;
    -webkit-tap-highlight-color: transparent;
}

.dc-empresa-badge:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
    color: var(--dc-text, #fff) !important;
}

.dc-empresa-badge img {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    background: rgba(255, 255, 255, 0.2);
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.25);
}

.dc-empresa-badge span {
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    opacity: 0.9;
}

/* ==========================================================================
   13. Cargo / Position Subtitle
   ========================================================================== */

.digicard-cargo {
    margin: -2px auto 6px !important;
    font-size: 0.82rem !important;
    font-weight: 600 !important;
    color: var(--dc-accent, #a78bfa) !important;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    opacity: 0.95;
    animation: dcFadeInUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) 0.17s both;
}