"""
AI Processor - HTML Templates for Print Versions

Contains HTML/CSS header templates for Q&A, Cloze, and Multiple Choice print output.
"""


def get_qa_html_header(title: str) -> str:
    """Get HTML header for Q&A print version."""
    return f"""<!DOCTYPE html>
<html lang="de">
<head>
<meta charset="UTF-8">
<title>{title} - Fragen</title>
<style>
  @media print {{
    .no-print {{ display: none; }}
    .page-break {{ page-break-before: always; }}
  }}
  body {{
    font-family: Arial, sans-serif;
    max-width: 800px;
    margin: 40px auto;
    padding: 20px;
    line-height: 1.6;
  }}
  h1 {{ font-size: 24px; margin-bottom: 8px; }}
  .meta {{ color: #666; margin-bottom: 24px; }}
  .question-block {{
    margin-bottom: 32px;
    padding-bottom: 16px;
    border-bottom: 1px dashed #ccc;
  }}
  .question-number {{ font-weight: bold; color: #333; }}
  .question-text {{ font-size: 16px; margin: 8px 0; }}
  .answer-lines {{ margin-top: 12px; }}
  .answer-line {{ border-bottom: 1px solid #999; height: 28px; }}
  .answer {{
    margin-top: 8px;
    padding: 8px;
    background: #e8f5e9;
    border-left: 3px solid #4caf50;
  }}
  .key-terms {{ font-size: 12px; color: #666; margin-top: 8px; }}
  .key-terms span {{
    background: #fff3e0;
    padding: 2px 6px;
    border-radius: 3px;
    margin-right: 4px;
  }}
</style>
</head>
<body>
"""


def get_cloze_html_header(title: str) -> str:
    """Get HTML header for cloze print version."""
    return f"""<!DOCTYPE html>
<html lang="de">
<head>
<meta charset="UTF-8">
<title>{title} - Lueckentext</title>
<style>
  @media print {{
    .no-print {{ display: none; }}
    .page-break {{ page-break-before: always; }}
  }}
  body {{
    font-family: Arial, sans-serif;
    max-width: 800px;
    margin: 40px auto;
    padding: 20px;
    line-height: 1.8;
  }}
  h1 {{ font-size: 24px; margin-bottom: 8px; }}
  .meta {{ color: #666; margin-bottom: 24px; }}
  .cloze-item {{
    margin-bottom: 24px;
    padding: 16px;
    background: #f9f9f9;
    border-radius: 8px;
  }}
  .cloze-number {{ font-weight: bold; color: #333; margin-bottom: 8px; }}
  .cloze-sentence {{ font-size: 16px; line-height: 2; }}
  .gap {{
    display: inline-block;
    min-width: 80px;
    border-bottom: 2px solid #333;
    margin: 0 4px;
    text-align: center;
  }}
  .gap-filled {{
    display: inline-block;
    padding: 2px 8px;
    background: #e8f5e9;
    border: 1px solid #4caf50;
    border-radius: 4px;
    font-weight: bold;
  }}
  .translation {{
    margin-top: 12px;
    padding: 8px;
    background: #e3f2fd;
    border-left: 3px solid #2196f3;
    font-size: 14px;
    color: #555;
  }}
  .translation-label {{ font-size: 12px; color: #777; margin-bottom: 4px; }}
  .word-bank {{
    margin-top: 32px;
    padding: 16px;
    background: #fff3e0;
    border-radius: 8px;
  }}
  .word-bank-title {{ font-weight: bold; margin-bottom: 12px; }}
  .word {{
    display: inline-block;
    padding: 4px 12px;
    margin: 4px;
    background: white;
    border: 1px solid #ddd;
    border-radius: 4px;
  }}
</style>
</head>
<body>
"""


def get_mc_html_header(title: str) -> str:
    """Get HTML header for MC print version."""
    return f"""<!DOCTYPE html>
<html lang="de">
<head>
<meta charset="UTF-8">
<title>{title} - Multiple Choice</title>
<style>
  @media print {{
    .no-print {{ display: none; }}
    .page-break {{ page-break-before: always; }}
    body {{ font-size: 14pt; }}
  }}
  body {{
    font-family: Arial, Helvetica, sans-serif;
    max-width: 800px;
    margin: 40px auto;
    padding: 20px;
    line-height: 1.6;
    color: #000;
  }}
  h1 {{
    font-size: 28px;
    margin-bottom: 8px;
    border-bottom: 2px solid #000;
    padding-bottom: 8px;
  }}
  .meta {{ color: #333; margin-bottom: 32px; font-size: 14px; }}
  .instructions {{
    background: #f5f5f5;
    padding: 12px 16px;
    border-radius: 4px;
    margin-bottom: 24px;
    font-size: 14px;
  }}
  .question-block {{
    margin-bottom: 28px;
    padding-bottom: 16px;
    border-bottom: 1px solid #ddd;
  }}
  .question-number {{ font-weight: bold; font-size: 18px; color: #000; margin-bottom: 8px; }}
  .question-text {{ font-size: 16px; margin: 8px 0 16px 0; line-height: 1.5; }}
  .options {{ margin-left: 20px; }}
  .option {{
    display: flex;
    align-items: flex-start;
    margin-bottom: 12px;
    padding: 8px 12px;
    border: 1px solid #ccc;
    border-radius: 4px;
    background: #fff;
  }}
  .option-correct {{
    background: #e8f5e9;
    border-color: #4caf50;
    border-width: 2px;
  }}
  .option-checkbox {{
    width: 20px;
    height: 20px;
    border: 2px solid #333;
    border-radius: 50%;
    margin-right: 12px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
  }}
  .option-checkbox.checked::after {{
    content: "\\2713";
    font-weight: bold;
    color: #4caf50;
  }}
  .option-label {{ font-weight: bold; margin-right: 8px; min-width: 24px; }}
  .option-text {{ flex: 1; }}
  .explanation {{
    margin-top: 8px;
    padding: 8px 12px;
    background: #e3f2fd;
    border-left: 3px solid #2196f3;
    font-size: 13px;
    color: #333;
  }}
  .answer-key {{
    margin-top: 40px;
    padding: 16px;
    background: #f5f5f5;
    border-radius: 8px;
  }}
  .answer-key-title {{
    font-weight: bold;
    font-size: 18px;
    margin-bottom: 12px;
    border-bottom: 1px solid #999;
    padding-bottom: 8px;
  }}
  .answer-key-grid {{
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 8px;
  }}
  .answer-key-item {{
    padding: 8px;
    text-align: center;
    background: white;
    border: 1px solid #ddd;
    border-radius: 4px;
  }}
  .answer-key-q {{ font-weight: bold; }}
  .answer-key-a {{ color: #4caf50; font-weight: bold; }}
</style>
</head>
<body>
"""
