/* Custom Glassmorphism & Print Styles & Layouts */

/* Glass Panel Base */
.glass-panel {
    background: rgba(17, 24, 39, 0.7);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
}

/* Theme: White/Light */
.theme-light .glass-panel {
    background: rgba(255, 255, 255, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.6);
    color: #1a202c;
}


/* Theme: Dark (Premium) */
.theme-dark .glass-panel {
    background: linear-gradient(145deg, rgba(17, 24, 39, 0.95), rgba(0, 0, 0, 0.98));
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: #f3f4f6;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.8);
}

.theme-dark #displayKey {
    color: #38bdf8;
}

/* Theme: Gold (Luxury) */
.theme-gold .glass-panel {
    background: linear-gradient(135deg, #1c1c1c 0%, #000000 100%);
    border: 1px solid rgba(255, 215, 0, 0.4);
    color: #ffd700;
    box-shadow: 0 10px 40px -10px rgba(255, 215, 0, 0.15);
}

.theme-gold .glass-panel::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at top right, rgba(255, 215, 0, 0.15), transparent 60%);
    pointer-events: none;
}

.theme-gold #displayKey {
    color: #efefef;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.3);
}

/* Adjust logo for Gold theme to be gold-ish or keep original */
.theme-gold .logo-pix {
    filter: brightness(0) saturate(100%) invert(86%) sepia(26%) saturate(6382%) hue-rotate(359deg) brightness(101%) contrast(106%) !important;
    opacity: 1 !important;
}

/* Theme: Cyberpunk */
.theme-cyber .glass-panel {
    background: linear-gradient(180deg, rgba(15, 23, 42, 0.9), rgba(88, 28, 135, 0.4));
    border: 1px solid rgba(6, 182, 212, 0.5);
    color: #22d3ee;
    box-shadow: 0 0 30px rgba(6, 182, 212, 0.2), inset 0 0 20px rgba(236, 72, 153, 0.1);
}

.theme-cyber #displayKey {
    color: #ec4899;
    text-shadow: 0 0 8px #ec4899;
    font-family: 'Courier New', monospace;
    /* Tech feel */
    letter-spacing: 0.05em;
}

.theme-cyber .logo-pix {
    filter: drop-shadow(0 0 5px rgba(34, 211, 238, 0.8));
}

/* Theme: Forest (Nature) */
.theme-forest .glass-panel {
    background: linear-gradient(160deg, #064e3b 0%, #022c22 100%);
    border: 1px solid rgba(52, 211, 153, 0.3);
    color: #ecfccb;
    box-shadow: 0 10px 40px -10px rgba(6, 78, 59, 0.5);
}

.theme-forest #displayKey {
    color: #34d399;
}

.theme-forest .logo-pix {
    filter: brightness(0) invert(1) opacity(0.9);
}

/* Theme: Ocean (Deep Blue) */
.theme-ocean .glass-panel {
    background: linear-gradient(180deg, #0c4a6e 0%, #082f49 100%);
    border: 1px solid rgba(56, 189, 248, 0.3);
    color: #e0f2fe;
}

.theme-ocean #displayKey {
    color: #7dd3fc;
}

.theme-ocean .logo-pix {
    filter: brightness(0) invert(1) opacity(0.9);
}

/* Theme: Sunset (Warm) */
.theme-sunset .glass-panel {
    background: linear-gradient(135deg, #7c2d12 0%, #431407 100%);
    border: 1px solid rgba(251, 146, 60, 0.3);
    color: #ffedd5;
}

.theme-sunset #displayKey {
    color: #fb923c;
}

.theme-sunset .logo-pix {
    filter: brightness(0) invert(1) opacity(0.9);
}

/* Theme: Monochrome (Minimalist) */
.theme-mono .glass-panel {
    background: #171717;
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #e5e5e5;
    box-shadow: none;
}

.theme-mono #displayKey {
    color: #ffffff;
    font-weight: 300;
}

.theme-mono .logo-pix {
    filter: grayscale(100%) brightness(200%);
}

/* --- Layouts --- */

/* Modern (Default) */
/* .layout-modern #plateBg uses the default flex-col from HTML structure */

/* Card (Business) */
.layout-card #plateBg {
    background: rgba(255, 255, 255, 0.9);
    /* More solid for card look */
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.theme-dark .layout-card #plateBg {
    background: rgba(30, 41, 59, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.layout-card #qrImageContainer {
    background: white;
    padding: 1rem;
    border-radius: 1rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    margin-bottom: 1rem;
}

.theme-dark .layout-card #qrImageContainer {
    background: white;
    /* QR always needs white for contrast usually, or very light grey */
}

.layout-card .pague-com-label {
    /* Make label distinct */
    background: rgba(0, 0, 0, 0.05);
    padding: 4px 12px;
    border-radius: 99px;
    font-size: 0.6rem;
}

.theme-dark .layout-card .pague-com-label {
    background: rgba(255, 255, 255, 0.1);
}

/* Minimal (Clean) */
.layout-minimal #plateBg {
    background: transparent !important;
    /* Let background grid show through or just glass */
    border: none;
    box-shadow: none;
    backdrop-filter: none;
}

/* Re-add glass to a persistent container if needed, but minimal usually means floating elements */
/* Actually, let's keep the glass but make it very subtle */
.layout-minimal #plateBg.glass-panel {
    background: rgba(255, 255, 255, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
}

.theme-dark .layout-minimal #plateBg.glass-panel {
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.layout-minimal .pague-com-label {
    display: none;
}

.layout-minimal #displayKey {
    font-weight: 400;
    /* Thinner */
    font-size: 0.9rem;
    opacity: 0.9;
}

.layout-minimal .logo-pix {
    height: 2.5rem;
    /* Smaller logo */
    opacity: 0.8;
}

.layout-minimal #glow1,
.layout-minimal #glow2 {
    opacity: 0.3;
    /* Subtle glows */
}

.layout-minimal .footer-icon {
    display: none;
}

/* Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

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

/* --- New Layouts (Corporate, Elegant, Tech) --- */

/* Corporate (Badge Style) */
.layout-corporate #plateBg {
    background: white;
    border: 1px solid rgba(0, 0, 0, 0.1);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
}

.theme-dark .layout-corporate #plateBg {
    background: #111827;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.layout-corporate #plateBg::before {
    /* Solid Header Block */
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 100px;
    /* Reduced from 140px */
    background: var(--color-brand-600, #0284c7);
    /* Fallback */
    border-radius: 24px 24px 0 0;
    z-index: 0;
}

/* Dynamic color overrides for Corporate Header based on theme */
.theme-dark.layout-corporate #plateBg::before {
    background: #1f2937;
}

/* Dark header */
.theme-gold.layout-corporate #plateBg::before {
    background: linear-gradient(135deg, #FFD700, #B8860B);
}

.theme-forest.layout-corporate #plateBg::before {
    background: #064e3b;
}

.theme-ocean.layout-corporate #plateBg::before {
    background: #0c4a6e;
}

.theme-sunset.layout-corporate #plateBg::before {
    background: #7c2d12;
}

.theme-cyber.layout-corporate #plateBg::before {
    background: #0f172a;
    border-bottom: 2px solid #22d3ee;
}

.theme-mono.layout-corporate #plateBg::before {
    background: #000;
}

.layout-corporate .pague-com-label {
    color: rgba(255, 255, 255, 0.9);
    background: rgba(0, 0, 0, 0.15) !important;
    padding: 2px 8px;
    border-radius: 4px;
    margin-bottom: 4px;
    font-size: 0.55rem;
}

.layout-corporate .logo-pix {
    filter: brightness(0) invert(1) !important;
    /* Force white logo on header */
    opacity: 0.95 !important;
    height: 2rem !important;
    /* Smaller logo */
    margin-bottom: 0;
}

.layout-corporate #qrImageContainer {
    z-index: 10;
    background: white;
    padding: 1rem;
    border-radius: 12px;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
    margin-top: 20px;
    /* Push down/overlap */
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.theme-dark .layout-corporate #qrImageContainer {
    background: #1f2937;
    border: 1px solid rgba(255, 255, 255, 0.1);
}


/* Elegant (Frame/Serif) */
.layout-elegant #plateBg {
    border: 1px solid rgba(0, 0, 0, 0.1);
    background: #fffdf5;
    /* Warm white */
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
}

.theme-dark .layout-elegant #plateBg {
    background: #0f0f10;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.layout-elegant #plateBg::after {
    /* Double Border Effect */
    content: '';
    position: absolute;
    inset: 12px;
    border: 2px solid rgba(0, 0, 0, 0.08);
    /* Inner rim */
    border-radius: 16px;
    pointer-events: none;
}

.theme-dark .layout-elegant #plateBg::after {
    border-color: rgba(255, 255, 255, 0.1);
}

.layout-elegant #displayName,
.layout-elegant #displayKey,
.layout-elegant p {
    font-family: 'Times New Roman', serif;
    letter-spacing: 0.05em;
}

.layout-elegant #displayName {
    text-transform: uppercase;
    font-weight: normal;
    border-bottom: 1px solid currentColor;
    padding-bottom: 4px;
    margin-bottom: 4px;
}

/* Tech (Futuristic/Cyber) */
.layout-tech #plateBg {
    background: #0a0a0a;
    border: 1px solid #333;
    /* Grid Pattern */
    background-image: linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
    background-size: 20px 20px;
}

/* Fix for Light Theme + Tech Layout (FORCE UPDATE) */
.theme-light.layout-tech #plateBg {
    background: #f0f9ff !important;
    /* Light tech blue */
    border: 1px solid #cbd5e1 !important;
    color: #0f172a !important;
    /* Dark text */
    /* Darker Grid Pattern */
    background-image: linear-gradient(rgba(0, 0, 0, 0.05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 0, 0, 0.05) 1px, transparent 1px) !important;
}

.theme-light.layout-tech #displayKey,
.theme-light.layout-tech #displayName {
    color: #0369a1 !important;
    /* Darker blue for contrast */
}

.theme-light.layout-tech #qrImageContainer {
    background: rgba(255, 255, 255, 0.8) !important;
    box-shadow: 0 0 15px rgba(14, 165, 233, 0.2);
    /* Update Tech corners to be visible on light bg if needed, or keep cyan */
}

.layout-tech #displayKey,
.layout-tech #displayName {
    font-family: 'Courier New', monospace;
    text-transform: lowercase;
}

.layout-tech #qrImageContainer {
    position: relative;
    padding: 10px;
    background: rgba(0, 0, 0, 0.5);
    /* Tech corners using gradients */
    background:
        linear-gradient(to right, #0ea5e9 2px, transparent 2px) 0 0,
        linear-gradient(to bottom, #0ea5e9 2px, transparent 2px) 0 0,
        linear-gradient(to left, #0ea5e9 2px, transparent 2px) 100% 0,
        linear-gradient(to bottom, #0ea5e9 2px, transparent 2px) 100% 0,
        linear-gradient(to left, #0ea5e9 2px, transparent 2px) 100% 100%,
        linear-gradient(to top, #0ea5e9 2px, transparent 2px) 100% 100%,
        linear-gradient(to right, #0ea5e9 2px, transparent 2px) 0 100%,
        linear-gradient(to top, #0ea5e9 2px, transparent 2px) 0 100%;
    background-repeat: no-repeat;
    background-size: 15px 15px;
    /* Corner size */
    box-shadow: 0 0 15px rgba(14, 165, 233, 0.1);
}

.layout-tech .pague-com-label {
    font-family: 'Courier New', monospace;
    background: transparent !important;
    color: #0ea5e9;
    /* Cyan 500 */
    border: 1px solid #0ea5e9;
    padding: 4px 12px;
    font-size: 0.65rem;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    border-radius: 4px;
    box-shadow: 0 0 10px rgba(14, 165, 233, 0.3);
    position: relative;
    overflow: hidden;
}

.layout-tech .pague-com-label::before {
    /* Scanline effect */
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(14, 165, 233, 0.2), transparent);
    animation: scanline 3s infinite linear;
}

@keyframes scanline {
    0% {
        left: -100%;
    }

    100% {
        left: 100%;
    }
}

.layout-tech #glow1,
.layout-tech #glow2 {
    filter: blur(80px);
    /* Enhance blur */
    opacity: 0.4;
}

.animate-fade-in-up {
    animation: fadeInUp 0.6s ease-out forwards;
}

.perspective-1000 {
    perspective: 1000px;
}

/* Print Styles */
@media print {
    @page {
        margin: 0;
        size: auto;
    }

    /* Hide everything except printArea by collapsing their display */
    body>*:not(#printArea) {
        display: none !important;
    }

    /* Ensure body/html fill the page and have no overflow */
    html,
    body {
        height: 100vh;
        width: 100vw;
        overflow: hidden;
        margin: 0;
        padding: 0;
        background: white;
    }

    #printArea {
        display: flex !important;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        align-items: center;
        justify-content: center;
        background: white;
        z-index: 9999;
        /* Ensure dark background prints if needed */
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    #printArea * {
        visibility: visible;
    }


    /* Force background graphics */
    * {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    /* Maintain Glassmorphism on Print */
    .glass-panel {
        box-shadow: none !important;
        /* Remove shadow for cleaner print */
        border: 1px solid rgba(0, 0, 0, 0.1) !important;
        /* Simple border */
        overflow: hidden !important;
        border-radius: 24px !important;
        /* Remove mask image that might clip content weirdly */
        mask-image: none;
        -webkit-mask-image: none;
    }

    /* Standard ID-1 (CR80) Size for Crachá */
    .print-cracha .glass-panel {
        width: 54mm !important;
        height: 86mm !important;
        border-radius: 3mm !important;
        padding: 4mm !important;
    }

    /* Adjust inner elements for the smaller print size */
    .print-cracha #companyPlaceholder span {
        font-size: 6pt !important;
    }

    .print-cracha #displayName {
        font-size: 10pt !important;
    }

    .print-cracha #displayRole {
        font-size: 8pt !important;
    }

    .print-cracha #displaySector {
        font-size: 6pt !important;
    }

    .print-cracha #clientLogo {
        height: 10mm !important;
    }

    .print-cracha #photoContainer {
        width: 25mm !important;
        height: 25mm !important;
        border-width: 1mm !important;
    }

    .print-cracha svg {
        width: 10mm !important;
    }

    /* Pix Plate Size (Keep original or set specific) */
    .print-pix .glass-panel {
        width: 100mm !important;
        height: 140mm !important;
    }

    /* Hide glows on print to prevent ink waste/blobs */
    #glow1,
    #glow2 {
        display: none !important;
    }
}

