/* ==========================================================================
   DESIGN SYSTEM - GERADOR DE CERTIFICADOS PREMIUM
   ========================================================================== */

:root {
    /* UI Dashboard Colors (Sleek Dark Modern) */
    --ui-bg-main: #0f0c1b;
    --ui-bg-sidebar: rgba(22, 19, 38, 0.75);
    --ui-card-bg: rgba(35, 30, 60, 0.5);
    --ui-border: rgba(255, 255, 255, 0.08);
    --ui-text-main: #e2e1e6;
    --ui-text-muted: #8d89a5;
    --ui-accent: #d48396;
    --ui-accent-grad: linear-gradient(135deg, #d48396 0%, #b35d72 100%);
    --ui-accent-hover: #c47285;
    --ui-success: #60c595;
    --shadow-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.3), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.5), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

/* ==========================================================================
   RESET & GLOBAL STYLES
   ========================================================================== */

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

body {
    font-family: 'Montserrat', sans-serif;
    background-color: var(--ui-bg-main);
    color: var(--ui-text-main);
    overflow-x: hidden;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* Scrollbar Customization */
::-webkit-scrollbar {
    width: 6px;
}
::-webkit-scrollbar-track {
    background: rgba(15, 12, 27, 0.5);
}
::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.12);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--ui-accent);
}

/* ==========================================================================
   LAYOUT STRUCTURE
   ========================================================================== */

.app-container {
    display: flex;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
}

/* ==========================================================================
   SIDEBAR - CONFIGURATION PANEL
   ========================================================================== */

.sidebar {
    width: 440px;
    min-width: 440px;
    height: 100%;
    background-color: var(--ui-bg-sidebar);
    border-right: 1px solid var(--ui-border);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    display: flex;
    flex-direction: column;
    z-index: 10;
    box-shadow: 10px 0 30px rgba(0, 0, 0, 0.3);
}

.sidebar-header {
    padding: 24px;
    border-bottom: 1px solid var(--ui-border);
}

.logo-area {
    display: flex;
    align-items: center;
    gap: 16px;
}

.logo-icon {
    font-size: 28px;
    color: var(--ui-accent);
    background: rgba(212, 131, 150, 0.15);
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    border: 1px solid rgba(212, 131, 150, 0.25);
    box-shadow: 0 0 15px rgba(212, 131, 150, 0.1);
}

.logo-area h1 {
    font-family: 'Cinzel', serif;
    font-size: 20px;
    font-weight: 700;
    letter-spacing: 1px;
    background: linear-gradient(135deg, #fff 30%, var(--ui-accent) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.logo-area .subtitle {
    font-size: 11px;
    color: var(--ui-text-muted);
    text-transform: uppercase;
    letter-spacing: 2px;
    display: block;
    margin-top: 2px;
}

/* Editor Form */
.editor-form {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 28px;
}

.form-section {
    background: var(--ui-card-bg);
    border: 1px solid var(--ui-border);
    border-radius: 16px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 18px;
    transition: all 0.3s ease;
}

.form-section:hover {
    border-color: rgba(212, 131, 150, 0.2);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

.section-title {
    font-size: 14px;
    font-weight: 600;
    color: #fff;
    text-transform: uppercase;
    letter-spacing: 1px;
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid var(--ui-border);
    padding-bottom: 10px;
    margin-bottom: 4px;
}

.section-title i {
    color: var(--ui-accent);
}

/* Input Fields */
.input-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.input-group label {
    font-size: 11px;
    font-weight: 500;
    color: var(--ui-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.8px;
}

.input-group input[type="text"],
.input-group select,
.input-group textarea,
.input-group input[type="date"] {
    background-color: rgba(15, 12, 27, 0.6);
    border: 1px solid var(--ui-border);
    border-radius: 8px;
    color: #fff;
    padding: 11px 14px;
    font-size: 13.5px;
    font-family: inherit;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.input-group input:focus,
.input-group select:focus,
.input-group textarea:focus,
.input-group input[type="date"]:focus {
    outline: none;
    border-color: var(--ui-accent);
    background-color: rgba(15, 12, 27, 0.9);
    box-shadow: 0 0 0 3px rgba(212, 131, 150, 0.15);
}

.input-group textarea {
    resize: vertical;
    min-height: 70px;
    line-height: 1.4;
}

.grid-2-cols {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

.label-heading {
    font-size: 11px;
    font-weight: 500;
    color: var(--ui-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    margin-bottom: -6px;
}

/* Themes Selector */
.theme-selector {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.theme-btn {
    background-color: rgba(15, 12, 27, 0.4);
    border: 1px solid var(--ui-border);
    border-radius: 10px;
    padding: 8px 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all 0.25s ease;
    color: var(--ui-text-main);
    text-align: left;
}

.theme-btn:hover {
    background-color: rgba(15, 12, 27, 0.7);
    border-color: rgba(255, 255, 255, 0.2);
}

.theme-btn.active {
    background-color: rgba(212, 131, 150, 0.1);
    border-color: var(--ui-accent);
    box-shadow: 0 0 10px rgba(212, 131, 150, 0.15);
}

.color-preview {
    width: 24px;
    height: 24px;
    border-radius: 6px;
    display: block;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.15);
}

.theme-name {
    font-size: 12px;
    font-weight: 500;
}

/* Checkboxes */
.checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 4px;
}

.checkbox-container {
    display: block;
    position: relative;
    padding-left: 28px;
    cursor: pointer;
    font-size: 12.5px;
    color: var(--ui-text-main);
    user-select: none;
    line-height: 1.5;
}

.checkbox-container input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

.checkmark {
    position: absolute;
    top: 2px;
    left: 0;
    height: 18px;
    width: 18px;
    background-color: rgba(15, 12, 27, 0.6);
    border: 1px solid var(--ui-border);
    border-radius: 4px;
    transition: all 0.2s ease;
}

.checkbox-container:hover input ~ .checkmark {
    border-color: rgba(255, 255, 255, 0.3);
}

.checkbox-container input:checked ~ .checkmark {
    background-color: var(--ui-accent);
    border-color: var(--ui-accent);
}

.checkmark:after {
    content: "";
    position: absolute;
    display: none;
}

.checkbox-container input:checked ~ .checkmark:after {
    display: block;
}

.checkbox-container .checkmark:after {
    left: 6px;
    top: 2px;
    width: 4px;
    height: 9px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

/* Download Container & Primary Button */
.download-container {
    margin-top: 10px;
    padding-bottom: 12px;
}

.btn-primary {
    width: 100%;
    background: var(--ui-accent-grad);
    border: none;
    border-radius: 12px;
    color: #fff;
    padding: 16px 20px;
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    box-shadow: 0 8px 24px rgba(179, 93, 114, 0.3);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

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

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

.btn-primary:hover {
    box-shadow: 0 12px 30px rgba(179, 93, 114, 0.45);
    transform: translateY(-2px);
    background: linear-gradient(135deg, var(--ui-accent-hover) 0%, #a25064 100%);
}

.btn-primary:active {
    transform: translateY(0);
    box-shadow: 0 4px 12px rgba(179, 93, 114, 0.25);
}

.btn-icon {
    font-size: 16px;
}

.spinner {
    font-size: 18px;
}

/* ==========================================================================
   MAIN WORKSPACE - LIVE PREVIEW AREA
   ========================================================================== */

.preview-area {
    flex: 1;
    height: 100%;
    background: radial-gradient(circle at center, #1b162f 0%, #0d0a17 100%);
    display: flex;
    flex-direction: column;
    padding: 30px;
    overflow-y: auto;
    align-items: center;
}

.preview-header {
    width: 100%;
    max-width: 900px;
    text-align: center;
    margin-bottom: 24px;
}

.preview-header h2 {
    font-size: 16px;
    font-weight: 600;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.preview-header h2 i {
    color: var(--ui-accent);
}

.preview-header p {
    font-size: 12.5px;
    color: var(--ui-text-muted);
    margin-top: 4px;
}

/* Certificate Responsive Wrapper */
.certificate-wrapper {
    width: 100%;
    max-width: 900px;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.5);
    border-radius: 6px;
    overflow: hidden;
    margin: auto 0;
    transition: transform 0.4s ease;
}

/* ==========================================================================
   THEMED CERTIFICATE DESIGN (A4 proportions: 1.414 aspect ratio)
   ========================================================================== */

.certificate-preview {
    width: 100%;
    aspect-ratio: 1.414 / 1;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    user-select: none;
    padding: 5% 5.5%;
    box-shadow: inset 0 0 100px rgba(197, 155, 108, 0.15); /* Efeito de profundidade sutil */
}

/* Definição de Gradientes Metálicos Luxuosos */
:root {
    --gold-foil: linear-gradient(135deg, #bf953f 0%, #fcf6ba 25%, #b38728 50%, #fbf5b7 75%, #aa771c 100%);
    --rose-foil: linear-gradient(90deg, #9d465b 0%, #d48396 30%, #f3bdc8 50%, #d48396 70%, #9d465b 100%);
    --gold-shine: radial-gradient(circle at 30% 30%, #fff8d6 0%, #bf953f 55%, #8c6212 100%);
}

/* Certificate Themes Variable Declaration */
.theme-rose {
    --cert-bg: radial-gradient(circle at center, #fdfbf7 0%, #faf3e8 100%);
    --cert-accent: #b35d72; /* Rosa Chá */
    --cert-accent-secondary: #bf953f; /* Ouro Metálico */
    --cert-text-dark: #3a272c; /* Marrom escuro */
    --cert-text-accent: #b35d72;
    --cert-border-main: #bf953f;
    --cert-border-inner: #d48396;
}

.theme-gold {
    --cert-bg: radial-gradient(circle at center, #fcfaf5 0%, #f4eee2 100%);
    --cert-accent: #b5985b; /* Ouro rico */
    --cert-accent-secondary: #b38728; /* Bronze dourado */
    --cert-text-dark: #292929; /* Preto suave */
    --cert-text-accent: #b5985b;
    --cert-border-main: #b38728;
    --cert-border-inner: #fcf6ba;
}

.theme-sage {
    --cert-bg: radial-gradient(circle at center, #f9fbf7 0%, #ebf0e6 100%);
    --cert-accent: #657e65; /* Verde sálvia */
    --cert-accent-secondary: #bf953f; /* Ouro */
    --cert-text-dark: #202d20; /* Verde escuro */
    --cert-text-accent: #657e65;
    --cert-border-main: #bf953f;
    --cert-border-inner: #657e65;
}

.theme-lavender {
    --cert-bg: radial-gradient(circle at center, #faf9fc 0%, #f1eef6 100%);
    --cert-accent: #6d7ab5; /* Lavanda suave */
    --cert-accent-secondary: #bf953f; /* Ouro */
    --cert-text-dark: #1f253d; /* Azul marinho escuro */
    --cert-text-accent: #6d7ab5;
    --cert-border-main: #bf953f;
    --cert-border-inner: #6d7ab5;
}

/* Fundo Texturizado (Fase V12 Definitiva - Papel Algodão de Luxo Real) */
.certificate-background {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url('background-premium.jpg?v=12');
    background-size: cover;
    background-position: center;
    z-index: 1;
}

/* Molduras e Bordas Clássicas Folheadas a Ouro */
.certificate-border {
    position: absolute;
    top: 3.5%;
    left: 2.5%;
    right: 2.5%;
    bottom: 3.5%;
    border: 3px solid transparent;
    border-image: var(--gold-foil) 1;
    z-index: 2;
    pointer-events: none;
    box-shadow: 0 0 15px rgba(191, 149, 63, 0.2);
}

.certificate-border:before {
    /* Pequenos cantos vintage finos */
    content: '';
    position: absolute;
    top: -8px;
    left: -8px;
    right: -8px;
    bottom: -8px;
    border: 1px solid transparent;
    border-image: var(--gold-foil) 1;
    opacity: 0.4;
}

.inner-border {
    position: absolute;
    top: 6px;
    left: 6px;
    right: 6px;
    bottom: 6px;
    border: 1px solid var(--cert-border-inner);
    opacity: 0.6;
    transition: border-color 0.5s ease;
}

/* Flores Bordadas nos Cantos - Overlay total do certificado */
.crochet-corner {
    position: absolute;
    z-index: 3;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.floral-corner {
    position: absolute;
    z-index: 3;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.floral-corner img {
    width: 100%;
    height: auto;
    display: block;
    filter: drop-shadow(0 2px 6px rgba(0,0,0,0.08));
}

.top-left-floral {
    top: 0;
    left: 0;
    width: 24%;
}

.bottom-right-floral {
    bottom: -1%;
    right: -1%;
    width: 25%;
}

/* Ocultar etiqueta de couro repetida no preview se os cantos reais estiverem ativos */
.certificate-preview:not(.hide-corners) .leather-tag {
    display: none !important;
}

/* Ramo Floral Superior Esquerdo */
.floral-branch {
    position: absolute;
    top: 4.5%;
    left: 3.2%;
    width: 14%;
    height: auto;
    aspect-ratio: 1/1;
    z-index: 3;
    color: var(--cert-accent-secondary);
    opacity: 0.9;
    transform: rotate(-10deg);
    pointer-events: none;
    filter: drop-shadow(0 2px 5px rgba(0,0,0,0.05));
    transition: color 0.5s ease, opacity 0.3s ease;
}

/* ==========================================================================
   CERTIFICATE TEXT CONTENT LAYOUT (Ajustado para evitar cortes verticais)
   ========================================================================== */

.certificate-content {
    position: relative;
    z-index: 5;
    width: 90%;
    height: 92%;
    display: flex;
    flex-direction: column;
    justify-content: space-between; /* Distribui dinamicamente para evitar clipping */
    align-items: center;
    text-align: center;
    color: var(--cert-text-dark);
    padding: 1% 0;
    transition: color 0.5s ease;
}

/* Cabeçalho */
.cert-header {
    margin-bottom: 0.5%;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.cert-title-main {
    font-family: 'Cinzel', serif;
    font-size: clamp(20px, 4.8vw, 44px); /* Aumentado para correspondência visual */
    font-weight: 700;
    letter-spacing: 11px;
    margin-right: -11px;
    background: var(--gold-foil);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0px 1px 2px rgba(0, 0, 0, 0.15));
    display: inline-block;
}

.cert-title-sub {
    font-family: 'Cinzel', serif;
    font-size: clamp(8px, 1.5vw, 14px);
    font-weight: 600;
    letter-spacing: 4px;
    margin-right: -4px;
    color: var(--cert-text-dark);
    opacity: 0.75;
    margin-top: 2px;
}

.divider-hearts {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-top: 6px;
    width: 250px;
}

.divider-line {
    flex: 1;
    height: 1px;
    background: var(--gold-foil);
    opacity: 0.6;
}

.heart-icon {
    font-size: clamp(8px, 1.2vw, 12px);
    color: var(--cert-accent);
    filter: drop-shadow(0 1px 2px rgba(0,0,0,0.1));
}

/* Certificamos que... */
.cert-certify {
    font-family: 'Great Vibes', cursive;
    font-size: clamp(18px, 3.6vw, 32px); /* Aumentado para correspondência visual */
    color: var(--cert-text-accent);
    margin: 0.5% 0;
}

/* Moldura do Nome folheada a ouro */
.student-name-box {
    width: 82%;
    max-width: 650px;
    padding: 6px 0;
    position: relative;
    margin: 0.5% 0;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.04);
}

.student-name-box:before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border: 2px solid transparent;
    border-image: var(--gold-foil) 1;
}

.student-name-box:after {
    content: '';
    position: absolute;
    top: 4px;
    left: 4px;
    right: 4px;
    bottom: 4px;
    border: 0.5px solid var(--cert-accent-secondary);
    opacity: 0.3;
}

.student-name-inner-box {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 40px; /* Margem lateral confortável para afastar dos losangos */
    position: relative;
    min-height: 52px; /* Garante altura vertical constante e centralização matemática */
}

.student-name-inner-box:before,
.student-name-inner-box:after {
    content: '♦';
    position: absolute;
    color: var(--cert-accent-secondary);
    font-size: clamp(6px, 0.8vw, 10px);
    top: 50%;
    transform: translateY(-50%);
    opacity: 0.8;
}

.student-name-inner-box:before { left: 12px; }
.student-name-inner-box:after { right: 12px; }

.student-name {
    margin: 0; /* Zera margens padrão do h2 */
    line-height: 1.2; /* Altura de linha limpa e controlada */
    font-family: 'Montserrat', sans-serif;
    font-size: clamp(20px, 3.8vw, 36px);
    font-weight: 700;
    letter-spacing: 0.5px;
    color: var(--cert-text-dark);
    filter: drop-shadow(0px 1px 1.5px rgba(0, 0, 0, 0.08));
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: center;
    width: 100%;
}

/* Concluiu com êxito */
.cert-concluded {
    font-size: clamp(8px, 1.3vw, 12px);
    font-weight: 400;
    letter-spacing: 1.5px;
    color: var(--cert-text-dark);
    opacity: 0.75;
    margin: 0.3% 0;
}

/* Nome do Curso */
.course-name {
    font-family: 'Playfair Display', serif;
    font-size: clamp(24px, 4.8vw, 44px); /* Aumentado consideravelmente para imponência */
    font-weight: 700;
    font-style: normal;
    letter-spacing: 2px;
    color: var(--cert-text-dark);
    text-shadow: 0px 1px 1px rgba(0,0,0,0.05);
    margin: 0.4% 0;
}

/* Faixa/Ribbon de Especialidade Dourada/Rosa Metálica */
.course-specialty-wrapper {
    position: relative;
    margin: 0.6% 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.course-specialty {
    background: var(--rose-foil); /* Gradiente na própria faixa */
    color: #fff;
    font-family: 'Montserrat', sans-serif;
    font-size: clamp(8px, 1.3vw, 11.5px);
    font-weight: 600;
    letter-spacing: 2.5px;
    padding: 7px 42px; /* Padding horizontal ampliado para evitar vazamento sobre as caudas */
    box-shadow: 0 4px 12px rgba(179, 93, 114, 0.25);
    z-index: 2;
    border-top: 1px solid rgba(255, 255, 255, 0.4);
    border-bottom: 1px solid rgba(0, 0, 0, 0.2);
    transition: background-color 0.5s ease;
    white-space: nowrap;
}

.course-specialty:before, .course-specialty:after {
    /* Linhas douradas de luxo na borda da faixa */
    content: '';
    position: absolute;
    left: 0;
    width: 100%;
    height: 1px;
    background: var(--gold-foil);
}
.course-specialty:before { top: 0; }
.course-specialty:after { bottom: 0; }

.ribbon-tail.left {
    left: -12px;
    border-width: 12.5px 12px 12.5px 0;
    border-color: var(--cert-accent) transparent var(--cert-accent) var(--cert-accent);
    filter: brightness(0.75);
    transform: translateY(2px);
}

.ribbon-tail.right {
    right: -12px;
    border-width: 12.5px 0 12.5px 12px;
    border-color: var(--cert-accent) var(--cert-accent) var(--cert-accent) transparent;
    filter: brightness(0.75);
    transform: translateY(2px);
}

/* Texto Descritivo */
.course-description {
    font-family: 'Montserrat', sans-serif;
    font-size: clamp(10.5px, 1.45vw, 13.5px); /* Aumentado para legibilidade excelente */
    font-weight: 400;
    line-height: 1.55;
    max-width: 78%;
    opacity: 0.85;
    margin: 2% 0 0.6% 0; /* Margem superior aumentada para afastar e respirar abaixo do Ribbon */
}

.decorative-heart-line {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-bottom: 1%;
    color: var(--cert-accent-secondary);
    opacity: 0.7;
}

.heart-small-dots {
    width: 25px;
    height: 1px;
    border-top: 1px dotted var(--cert-accent-secondary);
}

.heart-symbol {
    font-size: 8px;
}

/* Assinaturas & Data no Rodapé */
.cert-footer {
    width: 66%; /* Reduzido de 72% para 66% para harmonização perfeita com crochês menores */
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-top: 2%;
}

.date-container {
    width: 25%;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
}

.signature-container {
    width: 40%;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
}

.seal-container-footer {
    width: 25%;
    display: flex;
    justify-content: center;
    align-items: flex-end;
    position: relative;
}

.cert-date {
    font-size: clamp(9px, 1.4vw, 12px);
    font-weight: 500;
    color: var(--cert-text-dark);
    margin-bottom: 4px;
    letter-spacing: 0.5px;
}

.date-line, .signature-line {
    width: 100%;
    height: 1px;
    background-color: var(--cert-text-dark);
    opacity: 0.3;
    margin-bottom: 8px;
}

.date-label {
    font-size: clamp(7px, 1vw, 9px);
    font-weight: 500;
    color: var(--cert-text-dark);
    letter-spacing: 1.5px;
    opacity: 0.7;
}

.signature-handwritten {
    font-size: clamp(18px, 3.8vw, 32px);
    color: var(--cert-text-dark);
    margin-bottom: -10px;
    z-index: 3;
    user-select: none;
    transform: rotate(0deg); /* Alinhada reta para acompanhar a linha e não parecer torta */
    transition: font-family 0.3s ease;
}

/* Font Classes para Cursive */
.signature-style-greatvibes {
    font-family: 'Great Vibes', cursive;
}
.signature-style-alexbrush {
    font-family: 'Alex Brush', cursive;
}
.signature-style-pinyon {
    font-family: 'Pinyon Script', cursive;
    font-size: clamp(26px, 5.5vw, 48px);
}

.signature-line {
    width: 100%;
    height: 1px;
    background-color: var(--cert-text-dark);
    opacity: 0.3;
    margin-bottom: 8px;
}

.instructor-name {
    font-size: clamp(10px, 1.5vw, 13px);
    font-weight: 600;
    color: var(--cert-accent);
    letter-spacing: 0.5px;
    margin-bottom: 2px;
}

.instructor-role {
    font-size: clamp(8px, 1.1vw, 9.5px);
    font-weight: 500;
    color: var(--cert-text-dark);
    letter-spacing: 2px;
    opacity: 0.7;
}

/* ==========================================================================
   SEALS & TAGS (SECTOR DE DETALHES LUXUOSOS)
   ========================================================================== */

/* Selo Superior Direito "Feito com Amor" - Sinete de Cera Dourado 3D */
.seal-handmade {
    position: absolute;
    top: 5.5%;
    right: 5%;
    width: 9.5%;
    height: auto;
    aspect-ratio: 1/1;
    z-index: 6;
    background: var(--gold-shine);
    border-radius: 50%;
    color: #493318; /* Tom de bronze escuro para contraste */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border: 1px solid #bf953f;
    box-shadow: 
        0 6px 15px rgba(0, 0, 0, 0.25), 
        inset 0 -3px 8px rgba(0,0,0,0.35), 
        inset 0 3px 8px rgba(255,255,255,0.6);
    filter: drop-shadow(0 2px 5px rgba(0, 0, 0, 0.15));
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.seal-handmade:hover {
    transform: scale(1.05) rotate(5deg);
    box-shadow: 
        0 8px 20px rgba(0, 0, 0, 0.3), 
        inset 0 -3px 8px rgba(0,0,0,0.35), 
        inset 0 3px 8px rgba(255,255,255,0.6);
}

.seal-handmade svg {
    filter: drop-shadow(0 1px 1px rgba(255, 255, 255, 0.4)) drop-shadow(0 -1px 1px rgba(0,0,0,0.3));
}

.seal-love-tag {
    font-family: 'Great Vibes', cursive;
    font-size: clamp(6.5px, 1.1vw, 11px);
    color: #fff8eb;
    margin-top: -12%;
    transform: rotate(4deg);
    font-weight: 700;
    white-space: nowrap;
    text-shadow: 0 1px 2px rgba(73, 51, 24, 0.6);
    z-index: 2;
}

/* Carimbo Oficial Circular no Rodapé folheado a ouro */
.official-seal {
    position: relative;
    width: clamp(80px, 11vw, 115px);
    height: clamp(80px, 11vw, 115px);
    aspect-ratio: 1/1;
    z-index: 6;
    color: var(--cert-accent-secondary);
    opacity: 0.9;
    pointer-events: none;
    transform: rotate(-12deg);
    filter: drop-shadow(0 2px 6px rgba(0,0,0,0.06));
    transition: color 0.5s ease, opacity 0.3s ease;
    margin: 0 auto;
}

.seal-wrapper {
    position: relative;
    width: 100%;
    height: 100%;
}

.seal-text {
    font-family: 'Montserrat', sans-serif;
    font-size: 8px;
    font-weight: 600;
    letter-spacing: 1px;
}

.seal-monogram {
    font-family: 'Cinzel', serif;
    font-size: 16px;
    font-weight: 700;
    letter-spacing: 0px;
}

.seal-sig-overlay {
    position: absolute;
    top: 42%;
    left: 50%;
    transform: translate(-50%, -50%) rotate(-8deg);
    font-family: 'Great Vibes', cursive;
    font-size: clamp(10px, 1.6vw, 16px);
    color: var(--cert-text-dark);
    font-weight: 700;
    white-space: nowrap;
    opacity: 0.95;
    text-shadow: 0 0 5px #fcfaf5;
}

/* Etiqueta de Couro Realista no Canto Inferior Direito */
.leather-tag {
    position: absolute;
    bottom: 6%;
    right: 25px;
    background: linear-gradient(135deg, #c78d6b 0%, #a46946 100%);
    border-radius: 4px;
    padding: 6px 14px 6px 12px;
    box-shadow: -3px 3px 10px rgba(0, 0, 0, 0.25);
    z-index: 8;
    border-top: 1px dashed rgba(255, 255, 255, 0.25);
    border-left: 1px dashed rgba(255, 255, 255, 0.25);
    border-bottom: 1px dashed rgba(0, 0, 0, 0.25);
    transform: rotate(-3deg);
    pointer-events: none;
}

/* Costura da etiqueta de couro */
.leather-tag:after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    bottom: 2px;
    width: calc(100% - 2px);
    border-top: 1px dashed rgba(255, 255, 255, 0.15);
    border-left: 1px dashed rgba(255, 255, 255, 0.15);
    border-bottom: 1px dashed rgba(0, 0, 0, 0.15);
    border-radius: 2px 0 0 2px;
    pointer-events: none;
}

.leather-tag-content {
    display: flex;
    align-items: center;
    gap: 6px;
}

.tag-heart {
    color: #e57373;
    font-size: 10px;
    text-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

.tag-text {
    font-family: 'Great Vibes', cursive;
    color: #fff8f3;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

/* ==========================================================================
   RESPONSIVE SCALING & ADAPTATIONS
   ========================================================================== */

@media (max-width: 1024px) {
    .app-container {
        flex-direction: column;
        overflow-y: auto;
        height: auto;
    }

    .sidebar {
        width: 100%;
        min-width: 100%;
        height: auto;
        border-right: none;
        border-bottom: 1px solid var(--ui-border);
    }

    .preview-area {
        height: auto;
        padding: 20px;
    }
    
    .certificate-wrapper {
        margin: 20px 0;
    }
}

@media (max-width: 480px) {
    .sidebar-header, .editor-form {
        padding: 16px;
    }
    .grid-2-cols {
        grid-template-columns: 1fr;
    }
    .theme-selector {
        grid-template-columns: 1fr;
    }
}
