#!/usr/bin/env python3
"""Generate Social Media Content Factory SOP as a professional Word document."""

from docx import Document
from docx.shared import Inches, Pt, Cm, RGBColor, Emu
from docx.enum.text import WD_ALIGN_PARAGRAPH
from docx.enum.table import WD_TABLE_ALIGNMENT
from docx.enum.section import WD_ORIENT
from docx.oxml.ns import qn, nsdecls
from docx.oxml import parse_xml
import os

# Colors
NAVY = RGBColor(0x00, 0x2B, 0x5C)
GOLD = RGBColor(0xC8, 0x96, 0x2E)
DARK_GRAY = RGBColor(0x33, 0x33, 0x33)
MEDIUM_GRAY = RGBColor(0x66, 0x66, 0x66)
LIGHT_GOLD_BG = "FFF8E7"
WHITE = RGBColor(0xFF, 0xFF, 0xFF)

doc = Document()

# -- Default font setup --
style = doc.styles['Normal']
font = style.font
font.name = 'Calibri'
font.size = Pt(11)
font.color.rgb = DARK_GRAY

# -- Heading styles --
for i in range(1, 4):
    hs = doc.styles[f'Heading {i}']
    hf = hs.font
    hf.name = 'Calibri'
    hf.color.rgb = NAVY
    hf.bold = True
    if i == 1:
        hf.size = Pt(20)
    elif i == 2:
        hf.size = Pt(15)
    else:
        hf.size = Pt(12)

# -- Page margins --
for section in doc.sections:
    section.top_margin = Cm(2.5)
    section.bottom_margin = Cm(2.5)
    section.left_margin = Cm(2.5)
    section.right_margin = Cm(2.5)

# ============================================================
# HELPER FUNCTIONS
# ============================================================

def add_gold_line():
    """Add a gold horizontal rule."""
    p = doc.add_paragraph()
    p.alignment = WD_ALIGN_PARAGRAPH.CENTER
    run = p.add_run("━" * 60)
    run.font.color.rgb = GOLD
    run.font.size = Pt(10)
    p.space_after = Pt(6)

def add_section_header(number, title):
    """Add a numbered section heading with gold accent line."""
    doc.add_paragraph()  # spacer
    h = doc.add_heading(f"SECTION {number}: {title}", level=1)
    h.alignment = WD_ALIGN_PARAGRAPH.LEFT
    add_gold_line()

def add_subsection(title):
    """Add a subsection heading."""
    h = doc.add_heading(title, level=2)
    return h

def add_sub_subsection(title):
    """Add a sub-subsection heading."""
    h = doc.add_heading(title, level=3)
    return h

def add_body(text):
    """Add body paragraph."""
    p = doc.add_paragraph(text)
    p.style.font.name = 'Calibri'
    return p

def add_bullet(text, bold_prefix=None):
    """Add a bullet point, optionally with bold prefix."""
    p = doc.add_paragraph(style='List Bullet')
    if bold_prefix:
        run = p.add_run(bold_prefix)
        run.bold = True
        run.font.name = 'Calibri'
        run.font.size = Pt(11)
        run.font.color.rgb = DARK_GRAY
        run2 = p.add_run(text)
        run2.font.name = 'Calibri'
        run2.font.size = Pt(11)
        run2.font.color.rgb = DARK_GRAY
    else:
        run = p.add_run(text)
        run.font.name = 'Calibri'
        run.font.size = Pt(11)
        run.font.color.rgb = DARK_GRAY
    return p

def add_gold_callout(text):
    """Add a gold-accented callout box using a single-cell table."""
    tbl = doc.add_table(rows=1, cols=1)
    tbl.alignment = WD_TABLE_ALIGNMENT.CENTER
    cell = tbl.cell(0, 0)
    cell.text = ""
    p = cell.paragraphs[0]
    run = p.add_run(text)
    run.font.name = 'Calibri'
    run.font.size = Pt(11)
    run.font.color.rgb = NAVY
    run.bold = True
    p.alignment = WD_ALIGN_PARAGRAPH.CENTER
    # Shade cell
    shading = parse_xml(f'<w:shd {nsdecls("w")} w:fill="{LIGHT_GOLD_BG}"/>')
    cell._tc.get_or_add_tcPr().append(shading)
    doc.add_paragraph()  # spacer

def add_step(step_num, title):
    """Add a workflow step heading."""
    p = doc.add_paragraph()
    run = p.add_run(f"Step {step_num} — {title}")
    run.bold = True
    run.font.name = 'Calibri'
    run.font.size = Pt(13)
    run.font.color.rgb = NAVY
    return p

def add_email_format(text):
    """Add email format example in a styled box."""
    p = doc.add_paragraph()
    run = p.add_run(text)
    run.font.name = 'Calibri'
    run.font.size = Pt(11)
    run.italic = True
    run.font.color.rgb = GOLD

# ============================================================
# TITLE PAGE
# ============================================================

# Add spacing before title
for _ in range(6):
    doc.add_paragraph()

# Title
title_p = doc.add_paragraph()
title_p.alignment = WD_ALIGN_PARAGRAPH.CENTER
run = title_p.add_run("Social Media Content Factory")
run.font.name = 'Calibri'
run.font.size = Pt(32)
run.font.color.rgb = NAVY
run.bold = True

title_p2 = doc.add_paragraph()
title_p2.alignment = WD_ALIGN_PARAGRAPH.CENTER
run = title_p2.add_run("Standard Operating Procedure")
run.font.name = 'Calibri'
run.font.size = Pt(26)
run.font.color.rgb = NAVY
run.bold = True

# Gold separator
add_gold_line()

# Subtitle
sub_p = doc.add_paragraph()
sub_p.alignment = WD_ALIGN_PARAGRAPH.CENTER
run = sub_p.add_run("Rob Lobster Media Operations\nfor Lynch Family Businesses")
run.font.name = 'Calibri'
run.font.size = Pt(16)
run.font.color.rgb = MEDIUM_GRAY

# Lobster emoji
emoji_p = doc.add_paragraph()
emoji_p.alignment = WD_ALIGN_PARAGRAPH.CENTER
run = emoji_p.add_run("🦞")
run.font.size = Pt(36)

# Date
date_p = doc.add_paragraph()
date_p.alignment = WD_ALIGN_PARAGRAPH.CENTER
run = date_p.add_run("March 31, 2026")
run.font.name = 'Calibri'
run.font.size = Pt(14)
run.font.color.rgb = GOLD
run.bold = True

# Contact
contact_p = doc.add_paragraph()
contact_p.alignment = WD_ALIGN_PARAGRAPH.CENTER
run = contact_p.add_run("rob.lobster.claw@gmail.com")
run.font.name = 'Calibri'
run.font.size = Pt(12)
run.font.color.rgb = MEDIUM_GRAY

# Page break
doc.add_page_break()

# ============================================================
# TABLE OF CONTENTS (manual)
# ============================================================

toc_h = doc.add_heading("TABLE OF CONTENTS", level=1)
toc_h.alignment = WD_ALIGN_PARAGRAPH.LEFT
add_gold_line()

toc_items = [
    ("Section 1", "Overview"),
    ("Section 2", "Platforms"),
    ("Section 3", "Content Calendar — Weekly Posting Schedule"),
    ("Section 4", "Content Creation Workflow"),
    ("Section 5", "What Rob Needs from Joe and Staff"),
    ("Section 6", "Analytics and Metrics Tracking"),
    ("Section 7", "Brand Voice Guidelines"),
    ("Section 8", "Content Ideas Bank"),
    ("Section 9", "Posting Best Practices"),
]

for num, title in toc_items:
    p = doc.add_paragraph()
    run1 = p.add_run(f"{num}:  ")
    run1.bold = True
    run1.font.name = 'Calibri'
    run1.font.size = Pt(12)
    run1.font.color.rgb = NAVY
    run2 = p.add_run(title)
    run2.font.name = 'Calibri'
    run2.font.size = Pt(12)
    run2.font.color.rgb = DARK_GRAY

doc.add_page_break()

# ============================================================
# SECTION 1: OVERVIEW
# ============================================================

add_section_header("1", "OVERVIEW")

add_body("Rob Lobster manages all social media content creation for the following Lynch Family Businesses:")

add_bullet("lumber, hardware, paint, Benjamin Moore", bold_prefix="Tuckerton Lumber Company (TLC) — ")
add_bullet("portable storage units, approaching $1M revenue", bold_prefix="Surfbox Portable Storage — ")
add_bullet("realtor with offices in Ship Bottom + Crosswicks", bold_prefix="Keli Lynch Real Estate — ")
add_bullet("interior design and home staging", bold_prefix="Keli Lynch Staging & Design — ")
add_bullet("any additional Lynch family ventures", bold_prefix="Future: ")

doc.add_paragraph()
add_subsection("Content Tone")
add_body("Humor-driven. Think Curb Your Enthusiasm, Seinfeld, Saturday Night Live.")

add_gold_callout("NOT corporate. NOT boring. The kind of content people share, screenshot, and tag their friends in.")

add_body("Click-bait taglines when done right. Never the same type of content twice — always unique, always fresh.")

# ============================================================
# SECTION 2: PLATFORMS
# ============================================================

add_section_header("2", "PLATFORMS")

add_subsection("Phase 1 (Now)")
add_bullet("Facebook (all businesses)")
add_bullet("Instagram (all businesses)")

add_subsection("Phase 2 (Future)")
add_bullet("TikTok")
add_bullet("Twitter/X")
add_bullet("Snapchat")
add_bullet("YouTube Shorts")
add_bullet("LinkedIn (for B2B lumber/construction content)")

# ============================================================
# SECTION 3: CONTENT CALENDAR
# ============================================================

add_section_header("3", "CONTENT CALENDAR — WEEKLY POSTING SCHEDULE")

# Calendar table
tbl = doc.add_table(rows=8, cols=2)
tbl.style = 'Table Grid'
tbl.alignment = WD_TABLE_ALIGNMENT.CENTER

# Header row
for i, text in enumerate(["Day", "Content Focus"]):
    cell = tbl.cell(0, i)
    cell.text = ""
    p = cell.paragraphs[0]
    run = p.add_run(text)
    run.bold = True
    run.font.name = 'Calibri'
    run.font.size = Pt(11)
    run.font.color.rgb = WHITE
    p.alignment = WD_ALIGN_PARAGRAPH.CENTER
    shading = parse_xml(f'<w:shd {nsdecls("w")} w:fill="002B5C"/>')
    cell._tc.get_or_add_tcPr().append(shading)

calendar_data = [
    ("Monday", "TLC post — product tip, job site content, lumber industry humor"),
    ("Tuesday", "Surfbox post — storage hacks, moving humor, seasonal push"),
    ("Wednesday", "Keli Real Estate post — new listing, market data, open house"),
    ("Thursday", "TLC post — behind the scenes, employee spotlight, customer story"),
    ("Friday", "Keli Staging/Design post — before/after, design tips, staging humor"),
    ("Saturday", "Wild card — best raw content from the week, any business"),
    ("Sunday", "Rest or engagement day — respond to comments, share customer posts"),
]

for row_idx, (day, content) in enumerate(calendar_data, 1):
    cell0 = tbl.cell(row_idx, 0)
    cell0.text = ""
    p = cell0.paragraphs[0]
    run = p.add_run(day)
    run.bold = True
    run.font.name = 'Calibri'
    run.font.size = Pt(11)
    run.font.color.rgb = NAVY
    
    cell1 = tbl.cell(row_idx, 1)
    cell1.text = ""
    p = cell1.paragraphs[0]
    run = p.add_run(content)
    run.font.name = 'Calibri'
    run.font.size = Pt(11)
    run.font.color.rgb = DARK_GRAY
    
    # Alternate row shading
    if row_idx % 2 == 0:
        for ci in range(2):
            shading = parse_xml(f'<w:shd {nsdecls("w")} w:fill="{LIGHT_GOLD_BG}"/>')
            tbl.cell(row_idx, ci)._tc.get_or_add_tcPr().append(shading)

# Set column widths
for row in tbl.rows:
    row.cells[0].width = Inches(1.5)
    row.cells[1].width = Inches(4.5)

doc.add_paragraph()
add_gold_callout("Goal: Minimum 5 posts per week across all platforms. Ramp to 7+ as we build momentum.")

# ============================================================
# SECTION 4: CONTENT CREATION WORKFLOW
# ============================================================

add_section_header("4", "CONTENT CREATION WORKFLOW")

# Step 1
add_step(1, "RAW CONTENT SUBMISSION")
add_body("Joe or staff sends raw content (photos, videos, voice memos, ideas) to:")
add_gold_callout("rob.lobster.claw@gmail.com")

add_body("Email subject line format:")
add_email_format("RAW / [Company] / [brief description]")

doc.add_paragraph()
add_body("Examples:")
add_bullet("RAW / TLC / raccoon caught in lumber yard")
add_bullet("RAW / Surfbox / customer loading unit at the beach")
add_bullet("RAW / Keli RE / new listing 381 West 12th Ship Bottom")
add_bullet("RAW / Keli Staging / before and after kitchen reno")
add_bullet("RAW / TLC / funny customer interaction")

doc.add_paragraph()
add_body("What to include in the email:")
add_bullet("Photos and/or video (attached or links)")
add_bullet("Brief description of what happened / context")
add_bullet("Any specific message Joe wants to convey")
add_bullet("Who is in the content (for tagging/permissions)")
add_bullet('Any deadline (e.g., "post before weekend")')

# Step 2
doc.add_paragraph()
add_step(2, "ROB CREATES 3 CONCEPTS")
add_body("Rob reviews raw content and emails back 3 creative concepts within 24 hours.")

add_body("Email subject line format:")
add_email_format("CONCEPT / [Platform(s)] / [2-Word Summary] / [Company]")

doc.add_paragraph()
add_body("Examples:")
add_bullet("CONCEPT / Instagram+Facebook / Raccoon Release / Tuckerton Lumber")
add_bullet("CONCEPT / Facebook / Beach Storage / Surfbox")
add_bullet("CONCEPT / Instagram / Kitchen Glow-Up / Keli Staging")

doc.add_paragraph()
add_body("Email body includes:")
add_bullet("Thumbnail of raw content")
add_bullet("CONCEPT 1: Title, tagline, style description, recommended platform")
add_bullet("CONCEPT 2: Title, tagline, style description, recommended platform")
add_bullet("CONCEPT 3: Title, tagline, style description, recommended platform")
add_bullet("ROB'S RECOMMENDATION: which concept and why")
add_bullet("Estimated completion time")

# Step 3
doc.add_paragraph()
add_step(3, "JOE REVIEWS AND DIRECTS")
add_body("Joe replies with one of these shorthand commands:")

# Commands table
tbl = doc.add_table(rows=7, cols=2)
tbl.style = 'Table Grid'
tbl.alignment = WD_TABLE_ALIGNMENT.CENTER

commands = [
    ('"Go 1"', "Build concept 1"),
    ('"Go 2"', "Build concept 2"),
    ('"Go 3"', "Build concept 3"),
    ('"Go 2 but change tagline to..."', "Build with modifications"),
    ('"None — try again"', "Rob creates 3 new concepts"),
    ('"Go 1, post it"', "Skip final review, post immediately"),
    ('"Hold"', "Save for later, don't build yet"),
]

for row_idx, (cmd, desc) in enumerate(commands):
    cell0 = tbl.cell(row_idx, 0)
    cell0.text = ""
    p = cell0.paragraphs[0]
    run = p.add_run(cmd)
    run.bold = True
    run.font.name = 'Calibri'
    run.font.size = Pt(11)
    run.font.color.rgb = NAVY
    
    cell1 = tbl.cell(row_idx, 1)
    cell1.text = ""
    p = cell1.paragraphs[0]
    run = p.add_run(desc)
    run.font.name = 'Calibri'
    run.font.size = Pt(11)
    run.font.color.rgb = DARK_GRAY
    
    if row_idx % 2 == 1:
        for ci in range(2):
            shading = parse_xml(f'<w:shd {nsdecls("w")} w:fill="{LIGHT_GOLD_BG}"/>')
            tbl.cell(row_idx, ci)._tc.get_or_add_tcPr().append(shading)

for row in tbl.rows:
    row.cells[0].width = Inches(2.5)
    row.cells[1].width = Inches(3.5)

# Step 4
doc.add_paragraph()
add_step(4, "ROB BUILDS THE POST")
add_body("Rob creates the full post:")
add_bullet("Edits video/photo (cropping, text overlays, transitions, music)")
add_bullet("Writes caption with hashtags")
add_bullet("Formats for each platform (square for feed, 9:16 for reels/stories)")
add_bullet("Checks for errors, typos, brand consistency")
add_bullet("Adds company logo/watermark")

# Step 5
doc.add_paragraph()
add_step(5, "FINAL APPROVAL")
add_body("Rob emails completed post for review.")

add_body("Email subject line format:")
add_email_format("FINAL / [Platform(s)] / [2-Word Summary] / [Company]")

doc.add_paragraph()
add_body("Email body includes:")
add_bullet("Final image/video attached")
add_bullet("Caption text (copy-paste ready)")
add_bullet("Hashtags")
add_bullet("Recommended posting time")
add_bullet("Any platform-specific notes")

# Step 6
doc.add_paragraph()
add_step(6, "POSTING")
add_body('Joe replies "Approved" and Rob delivers the ready-to-post files + caption. Initially Joe or staff posts manually. Future: Rob may get direct posting access.')

# ============================================================
# SECTION 5: WHAT ROB NEEDS
# ============================================================

add_section_header("5", "WHAT ROB NEEDS FROM JOE AND STAFF")

add_subsection("From Joe (One-Time Setup)")
add_bullet("TLC logo (PNG, transparent background)")
add_bullet("Surfbox logo (PNG, transparent background)")
add_bullet("Keli Real Estate logo/branding")
add_bullet("Keli Staging logo/branding (if separate)")
add_bullet('Brand colors for each company (hex codes or "use what\'s on the website")')
add_bullet("Social media account handles for all platforms")
add_bullet("Login credentials for each social account (for future direct posting)")
add_bullet("Google Analytics access (for website traffic tracking)")
add_bullet("Any existing brand guidelines or style preferences")

add_subsection("From Staff (Ongoing)")
add_bullet("Photos and videos from the lumber yard, job sites, deliveries")
add_bullet("Customer testimonials and reviews (screenshot or quote)")
add_bullet("New product arrivals at TLC")
add_bullet("Surfbox customer photos (with permission)")
add_bullet("Before/after staging photos from Keli")
add_bullet("New listings from Keli (address, photos, price, key features)")
add_bullet("Funny moments, behind-the-scenes clips, anything entertaining")
add_bullet("Employee milestones, birthdays, work anniversaries")
add_bullet("Community events TLC or Surfbox is involved in")

doc.add_paragraph()
add_body("Staff email format (same as Joe):")
add_email_format("RAW / [Company] / [brief description]")
add_body("Send to: rob.lobster.claw@gmail.com")

add_subsection("Who Should Be Sending Content")

# Staff table
tbl = doc.add_table(rows=7, cols=2)
tbl.style = 'Table Grid'
tbl.alignment = WD_TABLE_ALIGNMENT.CENTER

# Header
for i, text in enumerate(["Person", "Content Area"]):
    cell = tbl.cell(0, i)
    cell.text = ""
    p = cell.paragraphs[0]
    run = p.add_run(text)
    run.bold = True
    run.font.name = 'Calibri'
    run.font.size = Pt(11)
    run.font.color.rgb = WHITE
    p.alignment = WD_ALIGN_PARAGRAPH.CENTER
    shading = parse_xml(f'<w:shd {nsdecls("w")} w:fill="002B5C"/>')
    cell._tc.get_or_add_tcPr().append(shading)

staff_data = [
    ("Paul Devaney (TLC Manager)", "Yard operations, customer interactions"),
    ("Joe Young (Manager)", "Sales floor, deliveries"),
    ("Edwin (Junior Manager)", "Day-to-day yard moments"),
    ("Neal and Denise (Outside Sales)", "Job site photos, contractor projects"),
    ("Keli Lynch", "Listings, staging projects, open houses"),
    ("Anyone with a phone", "Anything funny or interesting at work"),
]

for row_idx, (person, area) in enumerate(staff_data, 1):
    cell0 = tbl.cell(row_idx, 0)
    cell0.text = ""
    p = cell0.paragraphs[0]
    run = p.add_run(person)
    run.bold = True
    run.font.name = 'Calibri'
    run.font.size = Pt(11)
    run.font.color.rgb = DARK_GRAY
    
    cell1 = tbl.cell(row_idx, 1)
    cell1.text = ""
    p = cell1.paragraphs[0]
    run = p.add_run(area)
    run.font.name = 'Calibri'
    run.font.size = Pt(11)
    run.font.color.rgb = DARK_GRAY
    
    if row_idx % 2 == 0:
        for ci in range(2):
            shading = parse_xml(f'<w:shd {nsdecls("w")} w:fill="{LIGHT_GOLD_BG}"/>')
            tbl.cell(row_idx, ci)._tc.get_or_add_tcPr().append(shading)

for row in tbl.rows:
    row.cells[0].width = Inches(2.5)
    row.cells[1].width = Inches(3.5)

# ============================================================
# SECTION 6: ANALYTICS
# ============================================================

add_section_header("6", "ANALYTICS AND METRICS TRACKING")

add_body("Rob will track and report weekly on the following metrics:")

add_subsection("Platform Metrics (Facebook + Instagram)")
add_bullet("Impressions (how many people saw the post)")
add_bullet("Reach (unique viewers)")
add_bullet("Engagement rate (likes + comments + shares / reach)")
add_bullet("Click-through rate (if link included)")
add_bullet("Follower growth (week over week)")
add_bullet("Best performing post of the week")
add_bullet("Worst performing post of the week")
add_bullet("Best time of day for engagement")
add_bullet("Top hashtags driving discovery")

add_subsection("Google Analytics (Website Traffic)")
add_bullet("Total sessions from social media referrals")
add_bullet("Pages per session from social traffic")
add_bullet("Bounce rate from social traffic")
add_bullet("Top landing pages from social")
add_bullet("Conversion tracking (if applicable — contact forms, phone calls)")
add_bullet("Compare social traffic vs. organic search vs. direct")

add_subsection("Advanced Metrics")
add_bullet("Share rate (how many people shared/reposted)")
add_bullet("Save rate (Instagram saves — indicates high-value content)")
add_bullet("Video completion rate (what % watched to the end)")
add_bullet("Story tap-through rate (Instagram stories)")
add_bullet("Comment sentiment (positive/negative/neutral)")
add_bullet("Competitor benchmarking (track 3-5 competitor accounts)")

add_subsection("Monthly Report")
add_body("Rob delivers a monthly Social Media Performance Report including:")
add_bullet("Total posts published by platform and business")
add_bullet("Top 3 performing posts with analysis of why they worked")
add_bullet("Bottom 3 performing posts with analysis of what to improve")
add_bullet("Follower growth trajectory")
add_bullet("Engagement trend (up/down/flat)")
add_bullet("Content type performance (video vs. photo vs. carousel vs. text)")
add_bullet("Recommendations for next month's content strategy")
add_bullet("Google Analytics social traffic summary")

add_subsection("Tools Rob Will Use")
add_bullet("Meta Business Suite (Facebook + Instagram analytics)")
add_bullet("Google Analytics 4 (website traffic)")
add_bullet("Spotify for Business / Later / Buffer (scheduling, if approved)")
add_bullet("Canva or similar (graphic design for posts)")
add_bullet("FFmpeg (video editing)")
add_bullet("Platform native insights (Instagram Insights, Facebook Page Insights)")

# ============================================================
# SECTION 7: BRAND VOICE
# ============================================================

add_section_header("7", "BRAND VOICE GUIDELINES")

# TLC
add_subsection("Tuckerton Lumber (TLC)")
add_bullet("Blue-collar humor, real people, no corporate BS", bold_prefix="Voice: ")
add_bullet("Mike Rowe meets Larry David at a lumber yard", bold_prefix="Think: ")
add_body("Topics: Raccoon stories, customer shenanigans, product tips that are actually useful, \"things you didn't know you needed,\" behind-the-scenes yard chaos")
add_body("Hashtags: #TuckertonLumber #LBIBuilder #JerseyShoreContractor #LumberYardLife")

# Surfbox
add_subsection("Surfbox Portable Storage")
add_bullet("Helpful, fun, seasonal urgency", bold_prefix="Voice: ")
add_bullet('"You\'ve got too much stuff and we\'ve got the box"', bold_prefix="Think: ")
add_body("Topics: Beach season prep, moving humor, storage hacks, declutter motivation, unit reveals")
add_body("Hashtags: #SurfboxStorage #LBIStorage #BeachSeasonReady #PortableStorage")

# Keli RE
add_subsection("Keli Lynch Real Estate")
add_bullet("Warm, knowledgeable, local expert", bold_prefix="Voice: ")
add_bullet("Your friend who happens to be the best realtor on LBI", bold_prefix="Think: ")
add_body('Topics: New listings, market updates, neighborhood spotlights, first-time buyer tips, "what this house looked like before Keli got her hands on it"')
add_body("Hashtags: #LBIRealEstate #JerseyShoreHomes #ShipBottomNJ #BeachHouseLife")

# Keli Staging
add_subsection("Keli Lynch Staging & Design")
add_bullet("Design-forward, before/after dramatic reveals", bold_prefix="Voice: ")
add_bullet("HGTV energy without the fake drama", bold_prefix="Think: ")
add_body('Topics: Staging transformations, design tips, color trends, "staging secrets that sell homes faster"')
add_body("Hashtags: #HomeStaging #StagingToSell #InteriorDesign #BeforeAndAfter")

# ============================================================
# SECTION 8: CONTENT IDEAS BANK
# ============================================================

add_section_header("8", "CONTENT IDEAS BANK (Rotating)")

add_subsection("TLC Content Ideas")
add_bullet('"Things contractors say" (series)')
add_bullet("Employee of the month spotlight")
add_bullet('"What\'s this tool?" quiz posts')
add_bullet("Seasonal project ideas (deck season, fence season, etc.)")
add_bullet("Benjamin Moore color of the month")
add_bullet("Customer project showcases")
add_bullet('"Lumber yard confessions" (funny series)')
add_bullet("Price comparison: big box vs. TLC (value proposition)")
add_bullet('"Ask the expert" Q&A posts')
add_bullet("Behind the forklift (day in the life)")

add_subsection("Surfbox Content Ideas")
add_bullet('"What fits in a Surfbox" challenge')
add_bullet("Seasonal storage tips countdown")
add_bullet("Customer unboxing/loading videos")
add_bullet('"Declutter your life" motivational posts')
add_bullet("Beach house renovation storage solutions")
add_bullet("Moving day fails (humor)")
add_bullet("Unit of the week showcase")

add_subsection("Keli RE / Staging Content Ideas")
add_bullet("Just listed / just sold celebrations")
add_bullet('"Guess the listing price" interactive posts')
add_bullet("Room transformation reels (before/after)")
add_bullet("Local restaurant/business spotlights (community building)")
add_bullet('"What $X gets you on LBI" comparison posts')
add_bullet("Staging secrets series")
add_bullet("Open house recaps")
add_bullet("Market minute (quick weekly stats)")

# ============================================================
# SECTION 9: POSTING BEST PRACTICES
# ============================================================

add_section_header("9", "POSTING BEST PRACTICES")

practices = [
    "First 3 seconds of any video must HOOK the viewer (text overlay, question, shocking visual)",
    "Captions should be front-loaded — put the hook in the first line",
    "Use 5-10 relevant hashtags (not 30 spam hashtags)",
    "Post at peak times: 9-11 AM and 6-8 PM local time",
    "Respond to every comment within 24 hours",
    "Cross-post between Facebook and Instagram (but customize format)",
    "Video outperforms photo. Photo outperforms text. Always.",
    "User-generated content (customer posts/reviews) builds trust",
    "Never post the same content twice — always remix, always fresh",
    "When in doubt, make it funny",
]

for practice in practices:
    add_bullet(practice)

# ============================================================
# FOOTER
# ============================================================

doc.add_paragraph()
doc.add_paragraph()
add_gold_line()

footer_p = doc.add_paragraph()
footer_p.alignment = WD_ALIGN_PARAGRAPH.CENTER
run = footer_p.add_run("Rob Lobster Media Operations")
run.font.name = 'Calibri'
run.font.size = Pt(12)
run.font.color.rgb = NAVY
run.bold = True

footer_p2 = doc.add_paragraph()
footer_p2.alignment = WD_ALIGN_PARAGRAPH.CENTER
run = footer_p2.add_run("Managed by Rob Lobster 🦞 for the Lynch Family Businesses")
run.font.name = 'Calibri'
run.font.size = Pt(11)
run.font.color.rgb = MEDIUM_GRAY

footer_p3 = doc.add_paragraph()
footer_p3.alignment = WD_ALIGN_PARAGRAPH.CENTER
run = footer_p3.add_run("Version 1.0 — March 31, 2026")
run.font.name = 'Calibri'
run.font.size = Pt(10)
run.font.color.rgb = GOLD

# ============================================================
# SAVE
# ============================================================

output_path = "/Users/joemac/.openclaw/workspace/projects/social-media/social-media-sop.docx"
doc.save(output_path)
print(f"✅ SOP saved to: {output_path}")
print(f"   File size: {os.path.getsize(output_path):,} bytes")
