/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #0f172a;
    --primary-hover: #1e293b;
    --secondary-color: #64748b;
    --success-color: #059669;
    --error-color: #dc2626;
    --bg-color: #f8fafc;
    --surface-color: #ffffff;
    --text-color: #1e293b;
    --text-muted: #64748b;
    --border-color: #e2e8f0;
    --accent-color: #0ea5e9;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --radius: 8px;
    --max-width: 900px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(180deg, #f8fafc 0%, #e2e8f0 100%);
    color: var(--text-color);
    line-height: 1.6;
    min-height: 100vh;
    padding: 2rem 1rem;
}

.container {
    max-width: var(--max-width);
    margin: 0 auto;
}

/* Header */
header {
    text-align: center;
    margin-bottom: 2rem;
    color: var(--text-color);
}

header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: var(--primary-color);
}

.subtitle {
    font-size: 1.125rem;
    color: var(--text-muted);
}

.intro-text {
    max-width: 600px;
    margin: 1rem auto 0;
    font-size: 0.95rem;
    color: var(--text-muted);
    line-height: 1.7;
}

/* Main sections */
main {
    background: var(--surface-color);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    padding: 2rem;
}

section {
    margin-bottom: 2rem;
}

section:last-child {
    margin-bottom: 0;
}

/* Form elements */
.form-group {
    margin-bottom: 1.5rem;
}

label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-color);
}

.label-hint {
    display: block;
    font-weight: 400;
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

textarea {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid var(--border-color);
    border-radius: var(--radius);
    font-family: inherit;
    font-size: 1rem;
    resize: vertical;
    transition: border-color 0.2s;
}

textarea:focus {
    outline: none;
    border-color: var(--primary-color);
}

.char-counter {
    text-align: right;
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-top: 0.5rem;
}

/* Turnstile container */
.turnstile-container {
    display: flex;
    justify-content: center;
    margin: 1.5rem 0;
    min-height: 65px;
}

/* Buttons */
.submit-btn {
    width: 100%;
    padding: 1rem;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--radius);
    font-size: 1.125rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.1s;
    position: relative;
}

.submit-btn:hover:not(:disabled) {
    background: var(--primary-hover);
}

.submit-btn:active:not(:disabled) {
    transform: scale(0.98);
}

.submit-btn:disabled {
    background: var(--secondary-color);
    cursor: not-allowed;
    opacity: 0.6;
}

.submit-btn.loading .btn-text {
    display: none;
}

.submit-btn .btn-loading {
    display: none;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.submit-btn.loading .btn-loading {
    display: flex;
}

/* Spinner animation */
.spinner {
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Error message */
.error-message {
    margin-top: 1rem;
    padding: 1rem;
    background: #fef2f2;
    border-left: 4px solid var(--error-color);
    border-radius: var(--radius);
    color: #991b1b;
    display: none;
}

.error-message.show {
    display: block;
}

/* Output section */
.output-section {
    display: none;
    border-top: 2px solid var(--border-color);
    padding-top: 2rem;
}

.output-section.show {
    display: block;
}

.output-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.output-header h2 {
    font-size: 1.5rem;
    color: var(--text-color);
}

.copy-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    color: var(--text-color);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.copy-btn:hover {
    background: var(--border-color);
}

.copy-btn.copied {
    background: var(--success-color);
    color: white;
    border-color: var(--success-color);
}

.resume-output {
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 2rem;
    line-height: 1.8;
    font-size: 0.95rem;
}

/* Markdown styling */
.resume-output h1 {
    font-size: 2rem;
    margin-bottom: 1rem;
    color: var(--text-color);
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 0.5rem;
}

.resume-output h2 {
    font-size: 1.5rem;
    margin-top: 2rem;
    margin-bottom: 0.75rem;
    color: var(--text-color);
}

.resume-output h3 {
    font-size: 1.25rem;
    margin-top: 1.5rem;
    margin-bottom: 0.5rem;
    color: var(--text-color);
}

.resume-output p {
    margin-bottom: 0.75rem;
}

.resume-output ul, .resume-output ol {
    margin-left: 1.5rem;
    margin-bottom: 1rem;
}

.resume-output li {
    margin-bottom: 0.5rem;
}

.resume-output strong {
    color: var(--text-color);
    font-weight: 600;
}

.resume-output hr {
    border: none;
    border-top: 1px solid var(--border-color);
    margin: 1.5rem 0;
}

.resume-output a {
    color: var(--primary-color);
    text-decoration: none;
}

.resume-output a:hover {
    text-decoration: underline;
}

.resume-output code {
    background: var(--surface-color);
    padding: 0.2rem 0.4rem;
    border-radius: 3px;
    font-size: 0.9em;
    border: 1px solid var(--border-color);
}

/* Footer */
footer {
    text-align: center;
    margin-top: 2rem;
    color: var(--text-muted);
    font-size: 0.875rem;
}

/* Processing notice */
.processing-notice {
    text-align: center;
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 0.75rem;
}

/* Mobile responsive */
@media (max-width: 640px) {
    body {
        padding: 1rem 0.5rem;
    }

    header h1 {
        font-size: 2rem;
    }

    .subtitle {
        font-size: 1rem;
    }

    main {
        padding: 1.5rem;
    }

    .output-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .copy-btn {
        width: 100%;
        justify-content: center;
    }

    .resume-output {
        padding: 1.5rem;
        font-size: 0.875rem;
    }

    .resume-output h1 {
        font-size: 1.5rem;
    }

    .resume-output h2 {
        font-size: 1.25rem;
    }

    .resume-output h3 {
        font-size: 1.1rem;
    }
}
