:root {
    --brand-teal: #00f7ff;
    --brand-purple: #ae00ff;
    --processing-accent: #39ffb6;
    --processing-accent-dim: #1bd89b;
}

body {
    background: linear-gradient(135deg, #050505 0%, #1a1a1a 50%, #050505 100%);
    background-size: 400% 400%;
    animation: gradientMove 20s ease infinite;
    color: #f0f0f0;
    font-family: 'Orbitron', sans-serif;
    margin: 0;
    padding: 0;
}

@keyframes gradientMove {
    0% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }

    100% {
        background-position: 0% 50%;
    }
}

header {
    padding: 1rem;
    background: linear-gradient(90deg, var(--brand-teal), var(--brand-purple));
    color: black;
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
}

.site-icon {
    width: 44px;
    height: 44px;
    display: inline-block;
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
    transition: transform 200ms ease, box-shadow 200ms ease, filter 200ms ease;
}

/* Queued: gentle float + soft glow to indicate waiting */
.site-icon.queued {
    animation: iconFloat 2s ease-in-out infinite;
    box-shadow: 0 6px 18px rgba(0, 247, 255, 0.12), 0 2px 8px rgba(0, 0, 0, 0.35);
    filter: drop-shadow(0 0 6px rgba(0, 247, 255, 0.18));
}

/* Processing: quicker, subtle rotation + stronger glow to indicate activity */
.site-icon.processing {
    animation: iconTilt 0.9s ease-in-out infinite;
    box-shadow: 0 8px 24px rgba(174, 0, 255, 0.18), 0 2px 8px rgba(0, 0, 0, 0.35);
    filter: drop-shadow(0 0 8px rgba(174, 0, 255, 0.18));
}

/* Remove animation when finished or idle */
.site-icon.idle {
    animation: none;
    filter: none;
}

/* Keyframes for floating effect */
@keyframes iconFloat {
    0% {
        transform: translateY(0) rotate(0deg);
    }

    50% {
        transform: translateY(-6px) rotate(-2deg);
    }

    100% {
        transform: translateY(0) rotate(0deg);
    }
}

/* Keyframes for subtle tilt during processing */
@keyframes iconTilt {
    0% {
        transform: rotate(-4deg) translateY(0);
    }

    50% {
        transform: rotate(6deg) translateY(-3px);
    }

    100% {
        transform: rotate(-4deg) translateY(0);
    }
}

h1,
h2 {
    margin: 0.5rem 0;
}

#input-section {
    display: flex;
    justify-content: center;
    margin: 2rem;
}

#url-input {
    width: 60%;
    padding: 0.5rem;
    border: none;
    border-radius: 4px;
}

#submit-btn,
#cancel-btn,
#print-btn {
    margin-left: 1rem;
    padding: 0.5rem 1rem;
    background: var(--brand-teal);
    color: black;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
}

#submit-btn:hover,
#cancel-btn:hover,
#print-btn:hover {
    background: var(--brand-purple);
    color: white;
}

.hidden {
    display: none;
}

#status-section {
    text-align: center;
}

.status-queued {
    color: yellow;
}

.status-processing {
    color: var(--processing-accent);
}

.status-done {
    color: var(--brand-teal);
}

.status-failed {
    color: red;
}

.status-canceled {
    color: gray;
}

#result-container {
    background-color: #111;
    font-family: Arial, sans-serif;
    /* Easier to read for actual review */
    padding: 1rem;
    border-radius: 8px;
    margin: 1rem auto;
    line-height: 1.5;
    white-space: pre-wrap;
    /* Preserve single \n newlines in markdown */
    max-width: 800px;
    /* Fixed width for readability */
    width: 100%;
    box-sizing: border-box;
}

/* Center the "Analysis Result" heading */
#result-section h2 {
    text-align: center;
}

/* Better global link visibility */
a {
    color: var(--brand-teal);
    text-decoration: underline;
}

a:hover {
    color: var(--brand-purple);
}

/* Better link visibility in markdown */
#result-container a {
    color: var(--brand-teal);
    text-decoration: underline;
}

#result-container a:hover {
    color: var(--brand-purple);
}

#result-container li::before {
    content: "";
}

#result-container li {
    list-style-type: disc;
}

#result-container li {
    padding-left: 0.25rem;
}

#result-container li strong:before {
    display: inline-block;
    background-color: rgba(174, 0, 255, 0.1);
    border: 1px solid #ae00ff;
    border-radius: 4px;
    padding: 2px 6px;
    margin-right: 4px;
    font-weight: bold;
    color: #ae00ff;
}

footer {
    text-align: center;
    padding: 1rem;
    font-size: 0.8rem;
    color: gray;
}

/* Donate button in footer */
#donate-btn {
    margin-left: 0.75rem;
    padding: 0.35rem 0.7rem;
    background: linear-gradient(90deg, #ff6fa3, #ae00ff);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 700;
    font-size: 0.9rem;
    vertical-align: middle;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    transition: 150ms ease;
}

#donate-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(174, 0, 255, 0.18);
    color: white;
    filter: brightness(1.05);
}

/* Modal (popup) styles - matches the site's neon theme but kept subtle */
.modal {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1200;
    background: rgba(2, 2, 6, 0.6);
    backdrop-filter: blur(4px) saturate(1.05);
    padding: 1rem;
    box-sizing: border-box;

    /* Allow vertical scrolling when content exceeds viewport (mobile) */
    overflow-y: auto;
    overscroll-behavior: contain;
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: linear-gradient(180deg, #0b0b0f, #141417);
    border: 1px solid rgba(174, 0, 255, 0.14);
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.6), 0 0 36px rgba(0, 247, 255, 0.05);
    padding: 1rem 1.25rem;
    border-radius: 10px;
    max-width: 900px;
    width: 100%;
    color: #f3f3f3;
    position: relative;

    /* Constrain height to viewport and enable internal scrolling */
    max-height: calc(100vh - 2rem);      /* Fallback */
    max-height: calc(100dvh - 2rem);     /* Modern mobile browsers */
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;    /* Smooth momentum scroll on iOS */
}

/* Close button */
.modal-close {
    position: absolute;
    right: 10px;
    top: 8px;
    background: transparent;
    border: none;
    color: #cfcfcf;
    font-size: 1.4rem;
    cursor: pointer;
    padding: 0.25rem 0.4rem;
    line-height: 1;
    border-radius: 6px;
}

.modal-close:hover {
    color: white;
    background: rgba(255, 255, 255, 0.03);
}

/* Table inside modal */
.donate-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 0.5rem;
}

.donate-table th,
.donate-table td {
    padding: 0.6rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    text-align: left;
    vertical-align: top;
    font-family: monospace;
    color: #e7e7e7;
}

.donate-table th {
    color: #00f7ff;
    font-weight: 700;
    font-size: 0.95rem;
}

.donate-table img {
    display: block;
    margin-bottom: 0.4rem;
    border-radius: 6px;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.6);
}

/* Make code blocks selectable and visually distinct */
.modal code {
    display: inline-block;
    background: rgba(255, 255, 255, 0.03);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-family: monospace;
    font-size: 0.9rem;
    color: #dcdcdc;
    word-break: break-all;
}

/* Responsive adjustments */
@media (max-width: 640px) {
    .modal-content {
        padding: 0.85rem;
    }

    .donate-table img {
        width: 140px;
        height: auto;
    }

    #url-input {
        width: 100%;
    }
}

/* Animated pulsing glow for status updates */
@keyframes pulseGlow {
    0% {
        text-shadow: 0 0 5px currentColor;
    }

    50% {
        text-shadow: 0 0 20px currentColor;
    }

    100% {
        text-shadow: 0 0 5px currentColor;
    }
}

#status-text {
    animation: pulseGlow 1.5s infinite;
}

/* Print-friendly styles */
@media print {

    /* Hide non-needed UI in print */
    header,
    #input-section,
    #status-section,
    #result-actions,
    #cancel-btn {
        display: none !important;
    }

    /* Make body a print-friendly container */
    body {
        background: white !important;
        color: black !important;
    }

    /* Turn main+footer into a vertical flex container */
    body {
        display: flex !important;
        flex-direction: column !important;
    }

    /* Place footer before result section in print */
    footer {
        order: -1 !important;
        /* Move to the top */
        display: block !important;
        text-align: center !important;
        padding: 1rem 0 !important;
        margin-bottom: 2rem !important;
        background: white !important;
        color: black !important;
    }

    /* Result section */
    #result-section {
        order: 0 !important;
        width: 100% !important;
        padding: 0 !important;
        margin: 0 !important;
        background: white !important;
        color: black !important;
        position: static !important;
    }

    /* Result container adjustments */
    #result-container {
        background: transparent !important;
        color: black !important;
        box-shadow: none !important;
        max-width: 100% !important;
        font-family: serif !important;
        line-height: 1.4 !important;
    }

    /* Printable links */
    a {
        color: black !important;
        text-decoration: underline !important;
    }
}

/* Hero section: center content horizontally and vertically for better presentation */
#hero {
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 2rem 1rem;
}

.hero-inner {
    max-width: 900px;
    margin: 0 auto;
    padding: 0 1rem;
}

/* Small screens: tighten hero spacing */
@media (max-width: 640px) {
    #hero {
        padding: 1rem 0.5rem;
    }

    .hero-inner {
        max-width: 100%;
    }
}
