:root {
    --fd-gold: #cda948;
    --fd-black: #1d1d1b;
    --fd-white: #ffffff;
    --fd-gray-light: #f8f9fa;
    --fd-gray-border: #e5e7eb;
    --fd-red: #dc3545;
    --fd-hex: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
}

*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body.ficha-dinamica-page {
    font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, 'Helvetica Neue', sans-serif;
    background: var(--fd-white);
    color: var(--fd-black);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Scene */
.fd-scene {
    min-height: 80vh;
    min-height: 80svh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: var(--fd-white);
}

/* Card */
.fd-card {
    width: 100%;
    max-width: 450px;
    max-height: 120vh;
    max-height: 120svh;
    background: var(--fd-white);
    border: 2px solid var(--fd-black);
    border-radius: 20px;
    overflow-y: auto;
    overflow-x: hidden;
    position: relative;
    box-shadow: 0 20px 40px rgba(1, 0, 0, 0.15);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.fd-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 25px 50px rgba(1, 0, 0, 0.2);
}

/* Decorative Top Border */
.fd-card::before {
    content: '';
    position: sticky;
    top: 0;
    left: 0;
    right: 0;
    height: 5px;
    background: linear-gradient(90deg, var(--fd-gold) 0%, var(--fd-black) 50%, var(--fd-gold) 100%);
    z-index: 10;
    display: block;
}

/* Status Badge */
.fd-status {
    position: sticky;
    top: 5px;
    right: 0;
    left: 0;
    z-index: 9;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 2px;
    text-transform: uppercase;
    background: var(--fd-white);
    border-bottom: 1px solid var(--fd-gray-border);
}

.fd-status__dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

/* Active Status */
.fd-status--active {
    color: var(--fd-gold);
}

.fd-status--active .fd-status__dot {
    background: var(--fd-gold);
    box-shadow: 0 0 10px rgba(205, 169, 72, 0.5);
    animation: pulse-gold 2s infinite;
}

/* Inactive Status */
.fd-status--inactive {
    color: var(--fd-red);
}

.fd-status--inactive .fd-status__dot {
    background: var(--fd-red);
    box-shadow: 0 0 10px rgba(220, 53, 69, 0.5);
    animation: pulse-red 2s infinite;
}

/* Deceased Status */
.fd-status--deceased {
    color: var(--fd-black);
}

.fd-status--deceased .fd-status__dot {
    background: var(--fd-black);
    box-shadow: 0 0 10px rgba(1, 0, 0, 0.5);
    animation: pulse-black 2s infinite;
}

/* Unknown Status */
.fd-status--unknown {
    color: #6c757d;
}

.fd-status--unknown .fd-status__dot {
    background: #6c757d;
}

@keyframes pulse-gold {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(205, 169, 72, 0.7);
    }
    50% {
        box-shadow: 0 0 0 6px rgba(205, 169, 72, 0);
    }
}

@keyframes pulse-red {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(220, 53, 69, 0.7);
    }
    50% {
        box-shadow: 0 0 0 6px rgba(220, 53, 69, 0);
    }
}

@keyframes pulse-black {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(1, 0, 0, 0.7);
    }
    50% {
        box-shadow: 0 0 0 6px rgba(1, 0, 0, 0);
    }
}

/* Card Header */
.fd-card__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 25px 15px;
    gap: 15px;
}

.fd-logo {
    display: flex;
    align-items: center;
    flex: 1;
    min-width: 0;
}

.fd-logo svg {
    width: 100%;
    max-width: 200px;
    height: auto;
    max-height: 60px;
    filter: drop-shadow(0 2px 4px rgba(1, 0, 0, 0.1));
}

.fd-card__type {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--fd-gold);
    font-weight: 600;
    padding: 5px 10px;
    border: 1px solid var(--fd-gold);
    border-radius: 15px;
    white-space: nowrap;
    flex-shrink: 0;
}

/* Card Body */
.fd-card__body {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 15px 25px;
}

/* Photo Section */
.fd-photo-section {
    flex: 0 0 120px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.fd-photo {
    width: 110px;
    height: 120px;
    position: relative;
    clip-path: var(--fd-hex);
    background: var(--fd-gold);
    padding: 3px;
    transition: transform 0.3s ease;
}

.fd-photo:hover {
    transform: scale(1.03);
}

.fd-photo__border {
    position: absolute;
    inset: 0;
    background: var(--fd-black);
    clip-path: var(--fd-hex);
    z-index: 0;
}

.fd-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    clip-path: var(--fd-hex);
    position: relative;
    z-index: 1;
    filter: grayscale(30%) contrast(1.1);
    transition: filter 0.3s ease;
}

.fd-photo:hover img {
    filter: grayscale(0%) contrast(1);
}

.fd-photo__caption {
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--fd-gold);
    font-weight: 700;
    text-align: center;
    word-break: break-word;
}

/* Personal Info */
.fd-person {
    flex: 1;
    min-width: 0;
}

.fd-person__name {
    display: flex;
    flex-direction: column;
    gap: 3px;
    margin-bottom: 10px;
}

.fd-person__first {
    font-size: 20px;
    font-weight: 700;
    color: var(--fd-black);
    line-height: 1.2;
}

.fd-person__last {
    font-size: 16px;
    font-weight: 400;
    color: var(--fd-black);
    line-height: 1.2;
}

/* Estilos del título según estado */
.fd-person__title {
    display: inline-block;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 6px 14px;
    border: 1px solid var(--fd-gold);
    border-radius: 20px;
    background: rgba(205, 169, 72, 0.1);
    color: var(--fd-gold);
    transition: all 0.3s ease;
}

/* Estado Habilitado - Dorado (default) */
.fd-title--active {
    color: var(--fd-gold);
    border-color: var(--fd-gold);
    background: rgba(205, 169, 72, 0.1);
}

/* Estado Inhabilitado - Rojo */
.fd-title--inactive {
    color: #dc3545;
    border-color: #dc3545;
    background: rgba(220, 53, 69, 0.1);
}

/* Estado Fallecido - Negro */
.fd-title--deceased {
    color: var(--fd-black);
    border-color: var(--fd-black);
    background: rgba(29, 29, 27, 0.1);
}
/* Divider */
.fd-divider {
    height: 1px;
    background: linear-gradient(90deg, var(--fd-gold) 0%, var(--fd-black) 50%, var(--fd-gold) 100%);
    margin: 0 25px;
    opacity: 0.3;
}

/* Contact Info */
.fd-contact {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    padding: 15px 25px;
}

.fd-contact__item {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.fd-contact__icon {
    width: 18px;
    height: 18px;
    color: var(--fd-gold);
    flex-shrink: 0;
}

.fd-contact__content {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.fd-contact__content label {
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--fd-gold);
    font-weight: 600;
    margin-bottom: 2px;
}

.fd-contact__content span {
    font-size: 11px;
    color: var(--fd-black);
    font-weight: 500;
    word-break: break-all;
}

/* Details Grid */
.fd-details {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    padding: 15px 25px;
    background: var(--fd-gray-light);
    border-top: 1px solid var(--fd-gray-border);
    border-bottom: 1px solid var(--fd-gray-border);
}

.fd-details__item {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.fd-details__item label {
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--fd-gold);
    font-weight: 600;
    margin-bottom: 3px;
}

.fd-details__item span {
    font-size: 12px;
    color: var(--fd-black);
    font-weight: 500;
    word-break: break-word;
}

.fd-details__region {
    font-size: 15px !important;
    font-weight: 700 !important;
    color: var(--fd-black) !important;
    letter-spacing: 1px;
}

/* Card Footer */
.fd-card__footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 25px;
    gap: 15px;
}

.fd-id {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
}

.fd-id__label {
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--fd-gold);
    font-weight: 700;
}

.fd-id__value {
    font-size: 16px;
    font-weight: 800;
    color: var(--fd-black);
    letter-spacing: 1px;
}

/* QR Code */
.fd-qr {
    width: 55px;
    height: 55px;
    flex-shrink: 0;
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    grid-template-rows: repeat(7, 1fr);
    gap: 2px;
    padding: 4px;
    background: var(--fd-white);
    border: 2px solid var(--fd-black);
    border-radius: 5px;
}

.fd-qr span {
    background: var(--fd-black);
    border-radius: 1px;
}

.fd-qr span:nth-child(3n) {
    background: var(--fd-gold);
}

.fd-qr span:nth-child(4n) {
    background: var(--fd-white);
}

.fd-qr span:nth-child(5n) {
    background: var(--fd-black);
}

.fd-qr span:nth-child(7n) {
    background: var(--fd-gold);
}

/* Error Card */
.fd-card--error {
    max-width: 400px;
    padding: 40px;
    overflow-y: visible;
}

.fd-error {
    text-align: center;
}

.fd-error svg {
    width: 48px;
    height: 48px;
    color: var(--fd-gold);
    margin-bottom: 20px;
}

.fd-error h1 {
    font-size: 20px;
    color: var(--fd-black);
    margin-bottom: 10px;
}

.fd-error p {
    font-size: 14px;
    color: #6c757d;
}

/* Custom Scrollbar */
.fd-card::-webkit-scrollbar {
    width: 6px;
}

.fd-card::-webkit-scrollbar-track {
    background: var(--fd-gray-light);
}

.fd-card::-webkit-scrollbar-thumb {
    background: var(--fd-gold);
    border-radius: 3px;
}

.fd-card::-webkit-scrollbar-thumb:hover {
    background: var(--fd-black);
}

/* Responsive */
@media (max-width: 600px) {
    .fd-scene {
        padding: 10px;
    }
    
    .fd-card {
        max-width: 100%;
        max-height: 98vh;
        max-height: 98svh;
        border-radius: 15px;
    }
    
    .fd-card__header {
        flex-direction: column;
        gap: 10px;
        align-items: center;
        text-align: center;
        padding: 15px 20px 10px;
    }
    
    .fd-logo svg {
        max-width: 180px;
    }
    
    .fd-card__body {
        flex-direction: column;
        align-items: center;
        text-align: center;
        padding: 15px 20px;
        gap: 15px;
    }
    
    .fd-photo-section {
        flex: 0 0 auto;
    }
    
    .fd-person {
        width: 100%;
    }
    
    .fd-person__name {
        align-items: center;
    }
    
    .fd-divider {
        margin: 0 20px;
    }
    
    .fd-contact {
        grid-template-columns: 1fr;
        padding: 12px 20px;
        gap: 10px;
    }
    
    .fd-details {
        grid-template-columns: 1fr;
        padding: 12px 20px;
        gap: 10px;
    }
    
    .fd-card__footer {
        padding: 12px 20px;
    }
    
    .fd-status {
        font-size: 10px;
        padding: 8px 15px;
        letter-spacing: 1.5px;
    }
}

@media (max-width: 360px) {
    .fd-photo {
        width: 100px;
        height: 110px;
    }
    
    .fd-person__first {
        font-size: 18px;
    }
    
    .fd-person__last {
        font-size: 14px;
    }
    
    .fd-id__value {
        font-size: 14px;
    }
    
    .fd-qr {
        width: 50px;
        height: 50px;
    }
}

/* Landscape orientation */
@media (max-height: 700px) and (orientation: landscape) {
    .fd-card {
        max-height: 95vh;
        max-height: 95svh;
    }
    
    .fd-card__header {
        padding: 15px 20px 10px;
    }
    
    .fd-card__body {
        padding: 10px 20px;
    }
    
    .fd-contact {
        padding: 10px 20px;
    }
    
    .fd-details {
        padding: 10px 20px;
        grid-template-columns: 1fr 1fr;
    }
    
    .fd-card__footer {
        padding: 10px 20px;
    }
}

/* Print */
@media print {
    body.ficha-dinamica-page {
        background: var(--fd-white);
    }
    
    .fd-scene {
        background: var(--fd-white);
        padding: 20px;
    }
    
    .fd-card {
        box-shadow: none;
        border: 2px solid var(--fd-black);
        max-width: 400px;
        max-height: none;
        overflow: visible;
    }
    
    .fd-card:hover {
        transform: none;
        box-shadow: none;
    }
    
    .fd-photo:hover {
        transform: none;
    }
    
    .fd-status__dot {
        animation: none !important;
    }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}