/* --- THEME VARIABLES --- */
:root {
    --theme-color: #003366; /* Dark Blue */
    --container-bg: #ffffff;
    --border-color: #dee2e6;
    --text-color: #495057;
    --heading-color: #003366; /* Dark Blue */
    --background-color: #f8f7fa;
    --primary-text-color: #ffffff;
    --fail-bg: #f8d7da;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    margin: 0;
    padding: 20px 0;
    padding-top: 60px;
    background-color: var(--background-color);
    color: var(--text-color);
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100vh;
}

.container {
    background-color: var(--container-bg);
    padding: 40px;
    border-radius: 12px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.08);
    max-width: 800px;
    width: 95%;
    box-sizing: border-box;
    margin-bottom: 20px;
    border-top: 5px solid var(--theme-color);
}

.main-title {
    text-align: center;
    font-weight: 700;
    margin-bottom: 10px;
    font-size: 2em;
    color: var(--heading-color);
}

h1 {
    color: var(--heading-color);
    text-align: center;
    margin-bottom: 30px;
    font-size: 1.5em;
    font-weight: 600;
}

h2 {
    font-size: 1.1em;
    color: var(--theme-color);
    border-bottom: 2px solid #f1f1f1;
    padding-bottom: 10px;
    margin-top: 30px;
    margin-bottom: 20px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* --- Banner --- */
.disclaimer-banner {
    display: block;
    text-align: center;
    padding: 12px;
    width: 100%;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1000;
    font-size: 0.9em;
    font-weight: 500;
    text-decoration: none;
    background-color: #f8d7da;
    color: #58151c;
    border-bottom: 1px solid #f5c6cb;
}

/* --- Buttons --- */
.homepage-button {
    display: block;
    text-align: center;
    font-weight: bold;
    margin: 0 auto 25px auto;
    text-decoration: none;
    font-size: 1em;
    padding: 10px 20px;
    border-radius: 8px;
    color: var(--primary-text-color);
    background-color: var(--theme-color);
    width: fit-content;
}

.action-btn {
    background-color: #6c757d;
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 1em;
    cursor: pointer;
    width: 100%;
    margin-bottom: 10px;
    font-weight: 600;
    transition: background 0.2s;
}

.action-btn.generate { background-color: var(--theme-color); font-size: 1.1em; }
.action-btn.copy { background-color: #007bff; }
.action-btn.email { background-color: #28a745; }
.action-btn.clear-sig { background-color: #dc3545; font-size: 0.8em; padding: 5px 10px; width: auto; margin-top: 5px;}
.action-btn:hover { opacity: 0.9; }

.btn-group {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 15px;
}

/* --- Form Elements --- */
.input-group { margin-bottom: 15px; }
.input-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    color: var(--heading-color);
    font-size: 0.9em;
}

.reg-ref {
    font-weight: 400;
    color: #868e96;
    font-size: 0.85em;
    margin-left: 5px;
}

.input-group input, .input-group select, .input-group textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-sizing: border-box;
    font-size: 1em;
    font-family: inherit;
}
.input-group textarea { resize: vertical; min-height: 80px; }

/* Inline Note Logic */
.inline-note {
    display: none; /* Hidden by default */
    margin-top: 8px;
}
.inline-note input {
    border-color: #e35d6a;
    background-color: #fff5f5;
    font-size: 0.9em;
    padding: 8px;
}

/* Auto-Expand Textarea */
textarea.auto-expand {
    field-sizing: content; 
    min-height: 40px;
}

.checkbox-group {
    display: flex;
    align-items: center;
    gap: 12px;
    background-color: #f8f9fa;
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 15px;
    border: 1px solid var(--border-color);
}
.checkbox-group input[type="checkbox"] { width: 1.2em; height: 1.2em; accent-color: var(--theme-color); }
.checkbox-group label { margin: 0; font-weight: 500; }

/* --- Signatures --- */
#signature-section {
    display: none; 
    margin-top: 20px;
    border-top: 2px dashed #dee2e6;
    padding-top: 20px;
}

.cert-details-box {
    background-color: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    border: 1px solid #dee2e6;
}

.section-header {
    font-size: 1em;
    color: var(--theme-color);
    margin-top: 0;
    margin-bottom: 15px;
    border-bottom: 1px solid #dee2e6;
    padding-bottom: 5px;
}

.sig-container { margin-bottom: 20px; }

canvas {
    border: 1px solid #ced4da;
    border-radius: 4px;
    background: #fff;
    cursor: crosshair;
    touch-action: none; 
    width: 100%;
}

.waiver-text {
    font-size: 0.85em;
    color: #6c757d;
    font-style: italic;
    margin-bottom: 15px;
    line-height: 1.4;
}

.two-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

#reportOutput {
    background-color: #f1f3f5;
    border: 1px solid #ced4da;
    color: #212529;
    font-family: monospace;
    font-size: 0.9em;
}

.calc-display {
    background-color: #e6f4ea; 
    border: 1px solid #c3e6cb;
    color: #0f5132;
    padding: 10px;
    border-radius: 6px;
    text-align: center;
    font-weight: bold;
    margin-bottom: 15px;
    display: none; 
}
.calc-display.visible { display: block; }

/* Print Styles */
@media print {
    .disclaimer-banner, .homepage-button, .action-btn, .btn-group, .clear-sig { display: none !important; }
    body { padding-top: 0; background-color: white; }
    .container { box-shadow: none; border: none; width: 100%; max-width: 100%; padding: 0; }
    #reportOutput { border: none; background: white; white-space: pre-wrap; font-size: 11pt; width: 100%; }
    textarea { border: 1px solid #eee; }
    #signature-section { display: block !important; page-break-inside: avoid;}
    canvas { border: 1px solid #000; }
}

@media (max-width: 600px) {
    .two-col { grid-template-columns: 1fr; gap: 0; }
    .container { padding: 20px; }
}