/* ==========================================================================
   DESIGN SYSTEM & VARIABLES - CÓDIGO DO CÉREBRO
   ========================================================================== */
:root {
    /* Main App Palette (Dark Cyber) */
    --bg-dark: #030712;
    --bg-card: rgba(10, 20, 38, 0.45);
    --border-glass: rgba(0, 242, 254, 0.15);
    --border-glass-hover: rgba(225, 0, 255, 0.3);
    
    --color-cyan: #00f2fe;
    --color-purple: #9d4edd;
    --color-pink: #ff3366;
    --color-teal: #00ff87;
    --color-gold: #ffd700;
    --color-text-primary: #f3f4f6;
    --color-text-secondary: #9ca3af;
    
    /* Gradients */
    --grad-cyber: linear-gradient(135deg, var(--color-cyan) 0%, var(--color-purple) 100%);
    --grad-text: linear-gradient(90deg, var(--color-cyan) 0%, #a855f7 100%);
    --grad-dark: linear-gradient(180deg, #030712 0%, #081125 100%);

    /* Fonts */
    --font-primary: 'Outfit', sans-serif;
    --font-heading: 'Space Grotesk', sans-serif;
    --font-tech: 'Orbitron', sans-serif;
    --font-serif: 'Playfair Display', serif;
    
    /* Transitions */
    --transition-fast: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--bg-dark);
    color: var(--color-text-primary);
    font-family: var(--font-primary);
    line-height: 1.5;
    overflow-x: hidden;
    position: relative;
    min-height: 100vh;
}

/* Background Effects */
#neural-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -2;
    pointer-events: none;
}

.grid-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        linear-gradient(rgba(0, 242, 254, 0.02) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 242, 254, 0.02) 1px, transparent 1px);
    background-size: 40px 40px;
    z-index: -1;
    pointer-events: none;
}

/* App Layout */
.app-container {
    max-width: 1600px;
    margin: 0 auto;
    padding: 1.5rem 2rem 3rem 2rem;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    gap: 1.5rem;
}

/* Header */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-family: var(--font-tech);
    font-size: 1.4rem;
    font-weight: 900;
    color: #fff;
    letter-spacing: 1px;
}

.accent-text {
    color: var(--color-cyan);
}

.glow-icon {
    font-size: 1.7rem;
    color: var(--color-cyan);
    filter: drop-shadow(0 0 8px rgba(0, 242, 254, 0.8));
    animation: pulseGlow 3s infinite alternate;
}

.header-badge {
    background: rgba(0, 242, 254, 0.1);
    border: 1px solid rgba(0, 242, 254, 0.3);
    color: var(--color-cyan);
    padding: 0.4rem 1rem;
    border-radius: 50px;
    font-size: 0.8rem;
    font-weight: 600;
    font-family: var(--font-tech);
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Main Grid */
.main-content {
    display: grid;
    grid-template-columns: 420px 1fr;
    gap: 2rem;
    align-items: start;
    flex-grow: 1;
}

@media (max-width: 1100px) {
    .main-content {
        grid-template-columns: 1fr;
    }
}

/* Glassmorphism Panel (Control Panel) */
.glass-card {
    background: var(--bg-card);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid var(--border-glass);
    border-radius: 16px;
    padding: 2rem;
    box-shadow: 0 10px 40px 0 rgba(0, 0, 0, 0.3), 0 0 20px rgba(0, 242, 254, 0.02) inset;
    transition: var(--transition-fast);
}

.glass-card:hover {
    border-color: var(--border-glass-hover);
    box-shadow: 0 10px 40px 0 rgba(0, 0, 0, 0.4), 0 0 30px rgba(225, 0, 255, 0.04) inset;
}

.panel-section-header {
    margin-bottom: 1.5rem;
}

.panel-section-header h2 {
    font-family: var(--font-heading);
    font-size: 1.35rem;
    color: #fff;
    margin-bottom: 0.35rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.panel-section-header p {
    font-size: 0.9rem;
    color: var(--color-text-secondary);
}

/* Form Styles */
.form-group {
    margin-bottom: 1.25rem;
}

.form-row {
    display: flex;
    gap: 1rem;
}

.form-group.half {
    flex: 1;
    width: 50%;
}

label {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--color-text-primary);
    margin-bottom: 0.5rem;
    font-family: var(--font-heading);
}

.input-wrapper, .select-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-wrapper i, .select-wrapper i {
    position: absolute;
    left: 1rem;
    color: var(--color-text-secondary);
    font-size: 0.95rem;
    pointer-events: none;
}

input[type="text"], input[type="date"], select {
    width: 100%;
    background: rgba(13, 27, 42, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 0.75rem 1rem 0.75rem 2.5rem;
    color: #fff;
    font-family: var(--font-primary);
    font-size: 0.95rem;
    outline: none;
    transition: var(--transition-fast);
}

input[type="text"]:focus, input[type="date"]:focus, select:focus {
    border-color: var(--color-cyan);
    box-shadow: 0 0 10px rgba(0, 242, 254, 0.2);
    background: rgba(13, 27, 42, 0.6);
}

select {
    cursor: pointer;
    appearance: none;
}

.select-wrapper::after {
    content: '\f107';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    position: absolute;
    right: 1rem;
    color: var(--color-text-secondary);
    pointer-events: none;
}

input[readonly] {
    background: rgba(255, 255, 255, 0.03);
    color: var(--color-text-secondary);
    border-color: rgba(255, 255, 255, 0.05);
    cursor: not-allowed;
}

/* Action Buttons */
.action-buttons {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-top: 1.75rem;
}

.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    background: var(--grad-cyber);
    color: #fff;
    font-family: var(--font-tech);
    font-weight: 700;
    font-size: 0.95rem;
    padding: 0.95rem 1.5rem;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    text-decoration: none;
    box-shadow: 0 4px 20px rgba(0, 242, 254, 0.35);
    transition: var(--transition-fast);
    position: relative;
    overflow: hidden;
    text-transform: uppercase;
}

.btn-primary::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.25), transparent);
    transition: 0.5s;
}

.btn-primary:hover::before {
    left: 100%;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(225, 0, 255, 0.45);
}

.btn-group {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
}

.btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    background: rgba(13, 27, 42, 0.6);
    color: var(--color-text-primary);
    border: 1px solid var(--border-glass);
    font-family: var(--font-tech);
    font-size: 0.8rem;
    font-weight: 600;
    padding: 0.8rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    transition: var(--transition-fast);
}

.btn-secondary:hover {
    background: rgba(0, 242, 254, 0.1);
    border-color: var(--color-cyan);
    box-shadow: 0 0 15px rgba(0, 242, 254, 0.15);
}

.divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.08);
    margin: 1.75rem 0;
}

/* Guidelines Box */
.rules-box h3 {
    font-family: var(--font-heading);
    font-size: 1rem;
    color: #fff;
    margin-bottom: 0.65rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.rules-box ul {
    list-style-type: none;
    padding-left: 0;
}

.rules-box li {
    font-size: 0.8rem;
    color: var(--color-text-secondary);
    margin-bottom: 0.45rem;
    position: relative;
    padding-left: 1rem;
    line-height: 1.4;
}

.rules-box li::before {
    content: '•';
    color: var(--color-cyan);
    position: absolute;
    left: 0;
    font-weight: bold;
}

/* Right Panel: Preview Area */
.preview-panel {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    overflow: hidden;
}

.preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.preview-tabs {
    display: flex;
    background: rgba(10, 20, 38, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    padding: 0.3rem;
}

.tab-btn {
    background: transparent;
    border: none;
    color: var(--color-text-secondary);
    padding: 0.5rem 1.25rem;
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 0.85rem;
    border-radius: 6px;
    cursor: pointer;
    transition: var(--transition-fast);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.tab-btn:hover {
    color: #fff;
}

.tab-btn.active {
    background: var(--grad-cyber);
    color: #fff;
    box-shadow: 0 0 10px rgba(0, 242, 254, 0.2);
}

.zoom-indicator {
    font-size: 0.8rem;
    color: var(--color-text-secondary);
    background: rgba(255, 255, 255, 0.03);
    padding: 0.4rem 0.8rem;
    border-radius: 4px;
    font-family: var(--font-tech);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Preview Stage Layout */
.preview-stage-container {
    background: rgba(2, 4, 10, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 2rem;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    overflow: auto;
    min-height: 600px;
    box-shadow: inset 0 4px 30px rgba(0,0,0,0.5);
    position: relative;
}

/* Preview stage container for certificates */
.preview-stage {
    display: flex;
    flex-direction: column;
    gap: 30px;
    align-items: center;
    width: 100%;
    max-width: 1123px;
    transform-origin: top center;
}

/* Wrapper to establish bounds for the A4 scaling */
.certificate-wrapper {
    width: 100%;
    max-width: 1123px;
    background: #000;
    position: relative;
    overflow: hidden;
    border-radius: 8px;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.6);
}

/* ==========================================================================
   CERTIFICATE CARDS INTERNAL DESIGN (A4 landscape scale: 1123px x 794px)
   ========================================================================== */
.certificate-container {
    width: 1123px;
    height: 794px;
    position: relative;
    padding: 70px 90px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    overflow: hidden;
    transform-origin: top left;
    box-sizing: border-box;
}

/* Themes: Light & Dark */
.certificate-container.theme-light {
    background-color: #ffffff;
    color: #030712;
}

.certificate-container.theme-dark {
    background-color: #050a15;
    color: #f3f4f6;
    border: 1px solid rgba(0, 242, 254, 0.15);
}

/* Background Neural Grid SVG overlay */
.certificate-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: none;
}

.certificate-bg svg {
    width: 100%;
    height: 100%;
}

.theme-dark .neural-circle-outer { stroke: rgba(0, 242, 254, 0.12); }
.theme-dark .neural-circle-middle { stroke: rgba(157, 78, 221, 0.15); }
.theme-dark line { stroke: rgba(0, 242, 254, 0.08); }
.theme-dark circle[fill] { fill: rgba(0, 242, 254, 0.4); }

/* Corner Corner Indicators */
.corner {
    position: absolute;
    width: 25px;
    height: 25px;
    z-index: 2;
}

.theme-light .corner {
    border-color: #cbd5e1;
}

.theme-dark .corner {
    border-color: rgba(0, 242, 254, 0.5);
    filter: drop-shadow(0 0 3px var(--color-cyan));
}

.corner.top-left {
    top: 30px;
    left: 30px;
    border-top: 1.5px solid;
    border-left: 1.5px solid;
}

.corner.top-right {
    top: 30px;
    right: 30px;
    border-top: 1.5px solid;
    border-right: 1.5px solid;
}

.corner.bottom-left {
    bottom: 30px;
    left: 30px;
    border-bottom: 1.5px solid;
    border-left: 1.5px solid;
}

.corner.bottom-right {
    bottom: 30px;
    right: 30px;
    border-bottom: 1.5px solid;
    border-right: 1.5px solid;
}

/* Certificate Body Layout */
.cert-body {
    position: relative;
    z-index: 3;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
}

/* Page 1 Specific Styling */
.logo-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.6rem;
    margin-top: 15px;
}

.cert-logo-icon {
    color: #1e293b;
    transition: var(--transition-fast);
}

.theme-dark .cert-logo-icon {
    color: var(--color-cyan);
    filter: drop-shadow(0 0 10px rgba(0, 242, 254, 0.8));
}

.cert-company-name {
    font-family: var(--font-tech);
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: 7px;
    color: #1e293b;
    margin-right: -7px; /* Offset the letter spacing */
}

.theme-dark .cert-company-name {
    color: #f3f4f6;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.1);
}

.cert-title {
    font-family: var(--font-heading);
    font-size: 2.1rem;
    font-weight: 700;
    letter-spacing: 3px;
    color: #000000;
    line-height: 1.3;
    margin-top: 20px;
}

.theme-dark .cert-title {
    color: #fff;
}

.cert-title-large {
    display: block;
    font-size: 2.85rem;
    font-weight: 800;
    letter-spacing: 5px;
    margin-top: 0.5rem;
}

/* Gold Divider */
.gold-divider-glow {
    width: 60%;
    height: 1.5px;
    background: linear-gradient(90deg, transparent 0%, rgba(212, 175, 55, 0.7) 50%, transparent 100%);
    margin: 25px 0;
    position: relative;
}

.theme-dark .gold-divider-glow {
    background: linear-gradient(90deg, transparent 0%, var(--color-cyan) 30%, var(--color-purple) 70%, transparent 100%);
}

.gold-divider-glow::before {
    content: '';
    position: absolute;
    width: 8px;
    height: 8px;
    background-color: #d4af37;
    border-radius: 50%;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.theme-dark .gold-divider-glow::before {
    background-color: var(--color-cyan);
    box-shadow: 0 0 10px var(--color-cyan);
}

.cert-subtitle {
    font-size: 1.2rem;
    color: #64748b;
    font-weight: 400;
    line-height: 1.8;
}

.theme-dark .cert-subtitle {
    color: var(--color-text-secondary);
}

/* Page 1 Footer */
.cert-footer {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.8rem;
    margin-bottom: 10px;
}

.cert-brand-bottom {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.35rem;
}

.cert-brand-bottom .brand-title {
    font-family: var(--font-tech);
    font-size: 0.85rem;
    font-weight: 800;
    letter-spacing: 5px;
    color: #0f172a;
    margin-right: -5px;
}

.theme-dark .cert-brand-bottom .brand-title {
    color: #fff;
}

.cert-brand-bottom .brand-subtitle {
    font-family: var(--font-heading);
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 4px;
    color: #64748b;
    margin-right: -4px;
}

.theme-dark .cert-brand-bottom .brand-subtitle {
    color: var(--color-text-secondary);
}

.metadata-row {
    width: 100%;
    display: flex;
    justify-content: space-between;
    font-family: var(--font-tech);
    font-size: 0.65rem;
    color: #94a3b8;
    letter-spacing: 1px;
}

.theme-dark .metadata-row {
    color: rgba(255, 255, 255, 0.4);
}

/* Page 2 Specific Styling (The actual certificate) */
.p2-body {
    justify-content: space-between;
    padding: 10px 0;
}

.cert-top-tag {
    font-family: var(--font-heading);
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 5px;
    color: #d4af37;
}

.theme-dark .cert-top-tag {
    color: var(--color-cyan);
    text-shadow: 0 0 8px rgba(0, 242, 254, 0.3);
}

.cert-certifica {
    font-size: 1.15rem;
    color: #64748b;
    font-weight: 400;
    margin-top: 15px;
}

.theme-dark .cert-certifica {
    color: var(--color-text-secondary);
}

.cert-student-name {
    font-family: var(--font-serif);
    font-size: 3.2rem;
    font-weight: 700;
    font-style: italic;
    color: #0f172a;
    margin: 15px 0;
    text-shadow: 1px 1px 1px rgba(0,0,0,0.05);
}

.theme-dark .cert-student-name {
    color: #ffffff;
    text-shadow: 0 0 15px rgba(255,255,255,0.2);
}

.cert-desc-text {
    font-size: 0.95rem;
    color: #334155;
    line-height: 1.6;
    font-weight: 400;
}

.theme-dark .cert-desc-text {
    color: var(--color-text-primary);
}

.cert-desc-subtext {
    font-size: 0.85rem;
    color: #64748b;
    line-height: 1.6;
    font-weight: 400;
    margin-top: 8px;
}

.theme-dark .cert-desc-subtext {
    color: var(--color-text-secondary);
}

/* Competencies block */
.competencies-section {
    width: 90%;
    background: rgba(248, 250, 252, 0.7);
    border: 1px solid #f1f5f9;
    border-radius: 8px;
    padding: 20px 25px;
    margin: 20px 0;
}

.theme-dark .competencies-section {
    background: rgba(10, 20, 38, 0.4);
    border: 1px solid rgba(0, 242, 254, 0.1);
}

.competencies-title {
    font-family: var(--font-heading);
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 4px;
    color: #64748b;
    margin-bottom: 15px;
    text-align: center;
}

.theme-dark .competencies-title {
    color: var(--color-text-secondary);
}

.competencies-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px 30px;
    text-align: left;
}

.comp-item {
    font-size: 0.75rem;
    color: #475569;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
}

.theme-dark .comp-item {
    color: var(--color-text-primary);
}

.comp-item i {
    color: #d4af37;
    font-size: 0.7rem;
}

.theme-dark .comp-item i {
    color: var(--color-teal);
    filter: drop-shadow(0 0 2px var(--color-teal));
}

.comp-item.full-width {
    grid-column: span 2;
    justify-content: center;
}

/* Quote */
.cert-quote {
    font-size: 0.9rem;
    font-style: italic;
    font-weight: 500;
    color: #64748b;
    margin-top: 10px;
    line-height: 1.5;
}

.theme-dark .cert-quote {
    color: var(--color-text-secondary);
}

/* Page 2 Footer */
.p2-footer {
    margin-top: 20px;
    gap: 1.2rem;
}

.font-sm {
    font-size: 0.6rem !important;
    letter-spacing: 3px !important;
}

.verif-id-label {
    margin-right: 15px;
}

.doc-date-text {
    font-weight: 600;
    color: #475569;
}

.theme-dark .doc-date-text {
    color: var(--color-text-primary);
}

.status-box {
    border: 1px solid #cbd5e1;
    padding: 2px 8px;
    border-radius: 3px;
    font-weight: 700;
    color: #475569;
}

.theme-dark .status-box {
    border-color: rgba(0, 242, 254, 0.3);
    color: var(--color-cyan);
    background: rgba(0, 242, 254, 0.05);
}

.text-right {
    text-align: right;
}

/* Hidden elements helper */
.hidden-preview {
    display: none !important;
}

/* Layout showing both (Flex row landscape) */
.layout-both {
    display: flex;
    flex-direction: column;
    gap: 40px;
    align-items: center;
    width: 100%;
}

/* ==========================================================================
   ANIMATIONS & EFFECTS
   ========================================================================== */
@keyframes pulseGlow {
    0% {
        filter: drop-shadow(0 0 4px rgba(0, 242, 254, 0.6));
    }
    100% {
        filter: drop-shadow(0 0 12px rgba(0, 242, 254, 1));
    }
}

.pulse-btn {
    animation: buttonPulse 2s infinite;
}

@keyframes buttonPulse {
    0% {
        box-shadow: 0 0 0 0 rgba(0, 242, 254, 0.5);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(0, 242, 254, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(0, 242, 254, 0);
    }
}
