@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #3b82f6;
    --primary-dark: #2563eb;
    --primary-darker: #1d4ed8;
    --success: #16a34a;
    --success-dark: #15803d;
    --error: #dc2626;
    --warning: #f97316;
    --info: #0891b2;
    
    --bg-main: #f8fafc;
    --bg-card: #ffffff;
    
    --border: #e2e8f0;
    
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
}

html, body {
    height: 100%;
    overflow: hidden;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-main);
    color: var(--text-primary);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

.app-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    min-height: 100dvh;
    padding: 1.5rem;
    overflow: hidden;
}

.app-content {
    width: 100%;
    max-width: 750px;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.app-header {
    text-align: center;
}

.logo {
    width: 64px;
    height: 64px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-darker) 100%);
    border-radius: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    color: white;
    box-shadow: 0 8px 20px rgba(59, 130, 246, 0.25);
    margin-bottom: 1rem;
}

.title {
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--text-primary);
    line-height: 1.2;
    margin-bottom: 0.5rem;
}

.subtitle {
    font-size: 1.0625rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

.app-main {
    flex: 1;
}

.extract-form {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 1.75rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1rem;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.input-label {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-primary);
}

.input-field, .select-field {
    width: 100%;
    padding: 0.6875rem 0.875rem;
    background: var(--bg-main);
    border: 2px solid var(--border);
    border-radius: 10px;
    color: var(--text-primary);
    font-size: 0.875rem;
    font-family: inherit;
    transition: all 0.2s ease;
}

.input-field:focus, .select-field:focus {
    outline: none;
    border-color: var(--primary);
    background: white;
}

.input-field::placeholder {
    color: var(--text-muted);
}

.input-field:disabled, .select-field:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.select-field {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 0.75rem center;
    background-repeat: no-repeat;
    background-size: 1.25em 1.25em;
    padding-right: 2.5rem;
}

.turnstile-container {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0.875rem;
    background: var(--bg-main);
    border-radius: 10px;
    margin-bottom: 1rem;
    min-height: 70px;
}

.cf-turnstile {
    display: flex;
    justify-content: center;
    align-items: center;
}

.submit-btn {
    width: 100%;
    padding: 0.8125rem 1.125rem;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-darker) 100%);
    border: none;
    border-radius: 10px;
    color: white;
    font-size: 0.9375rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.2);
}

.submit-btn:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(59, 130, 246, 0.3);
}

.submit-btn:active:not(:disabled) {
    transform: translateY(0);
}

.submit-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

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

.status-message {
    padding: 0.875rem 1rem;
    border-radius: 10px;
    text-align: center;
    font-weight: 500;
    font-size: 0.875rem;
    animation: fadeIn 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.status-message.success {
    background: #f0fdf4;
    border: 1px solid #86efac;
    color: #15803d;
}

.status-message.error {
    background: #fef2f2;
    border: 1px solid #fca5a5;
    color: #b91c1c;
}

.status-message.info {
    background: #ecfeff;
    border: 1px solid #67e8f9;
    color: #0e7490;
}

.status-message.warning {
    background: #fffbeb;
    border: 1px solid #fcd34d;
    color: #b45309;
}

.download-section {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 1.75rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.download-header {
    text-align: center;
    margin-bottom: 1.5rem;
}

.success-icon {
    font-size: 3.5rem;
    color: var(--success);
    margin-bottom: 0.875rem;
}

.success-title {
    font-size: 1.375rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    line-height: 1.2;
}

.success-subtitle {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.download-details {
    background: var(--bg-main);
    border-radius: 10px;
    padding: 1rem;
    margin-bottom: 1.25rem;
}

.detail-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    gap: 1rem;
}

.detail-item:not(:last-child) {
    border-bottom: 1px solid var(--border);
}

.detail-label {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-secondary);
    flex-shrink: 0;
}

.detail-value {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-primary);
    text-align: right;
    word-break: break-all;
}

.download-actions {
    display: flex;
    gap: 0.875rem;
}

.download-btn {
    flex: 1;
    padding: 0.8125rem 1.125rem;
    background: linear-gradient(135deg, var(--success) 0%, var(--success-dark) 100%);
    border: none;
    border-radius: 10px;
    color: white;
    font-size: 0.875rem;
    font-weight: 600;
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: all 0.2s ease;
    box-shadow: 0 4px 12px rgba(22, 163, 74, 0.2);
}

.download-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(22, 163, 74, 0.3);
}

.new-extraction-btn {
    padding: 0.8125rem 1.125rem;
    background: var(--bg-main);
    border: 2px solid var(--border);
    border-radius: 10px;
    color: var(--text-primary);
    font-size: 0.875rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: all 0.2s ease;
}

.new-extraction-btn:hover {
    background: white;
    border-color: var(--primary);
    color: var(--primary);
    transform: translateY(-1px);
}

.app-footer {
    text-align: center;
}

.footer-info {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-bottom: 0.625rem;
}

.footer-info i {
    color: var(--warning);
    font-size: 0.8125rem;
}

.footer-links {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.625rem;
    font-size: 0.75rem;
    color: var(--text-secondary);
    flex-wrap: wrap;
}

.footer-links a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
}

.footer-links a:hover {
    text-decoration: underline;
}

.separator {
    color: var(--text-muted);
}

.hidden {
    display: none !important;
}

@media (max-width: 768px) {
    .app-container {
        padding: 1.25rem 1rem;
    }

    .app-content {
        gap: 1.25rem;
    }

    .logo {
        width: 56px;
        height: 56px;
        font-size: 24px;
        margin-bottom: 0.875rem;
    }

    .title {
        font-size: 1.5rem;
    }

    .subtitle {
        font-size: 0.9375rem;
    }

    .extract-form, .download-section {
        padding: 1.5rem;
    }

    .form-grid {
        grid-template-columns: 1fr;
        gap: 0.875rem;
    }

    .success-icon {
        font-size: 3rem;
        margin-bottom: 0.75rem;
    }

    .success-title {
        font-size: 1.25rem;
    }

    .success-subtitle {
        font-size: 0.8125rem;
    }

    .download-actions {
        flex-direction: column;
        gap: 0.75rem;
    }

    .footer-links {
        flex-direction: column;
        gap: 0.375rem;
    }

    .separator {
        display: none;
    }
}

@media (max-width: 480px) {
    .app-container {
        padding: 1rem 0.875rem;
    }

    .app-content {
        gap: 1rem;
    }

    .logo {
        width: 50px;
        height: 50px;
        font-size: 22px;
        margin-bottom: 0.75rem;
    }

    .title {
        font-size: 1.25rem;
    }

    .subtitle {
        font-size: 0.8125rem;
    }

    .extract-form, .download-section {
        padding: 1.25rem;
    }

    .input-label {
        font-size: 0.75rem;
    }

    .input-field, .select-field {
        padding: 0.625rem 0.75rem;
        font-size: 0.8125rem;
    }

    .turnstile-container {
        padding: 0.75rem;
        min-height: 65px;
    }

    .submit-btn {
        padding: 0.75rem 1rem;
        font-size: 0.875rem;
    }

    .download-header {
        margin-bottom: 1.25rem;
    }

    .success-icon {
        font-size: 2.5rem;
        margin-bottom: 0.625rem;
    }

    .success-title {
        font-size: 1.125rem;
    }

    .download-details {
        padding: 0.875rem;
        margin-bottom: 1rem;
    }

    .detail-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.25rem;
        padding: 0.375rem 0;
    }

    .detail-value {
        text-align: left;
    }

    .download-btn, .new-extraction-btn {
        padding: 0.75rem 1rem;
        font-size: 0.8125rem;
    }

    .footer-info, .footer-links {
        font-size: 0.6875rem;
    }
}

@media (max-width: 380px) {
    .app-container {
        padding: 0.875rem 0.75rem;
    }

    .logo {
        width: 46px;
        height: 46px;
        font-size: 20px;
    }

    .title {
        font-size: 1.125rem;
    }

    .subtitle {
        font-size: 0.75rem;
    }

    .extract-form, .download-section {
        padding: 1rem;
    }

    .success-icon {
        font-size: 2.25rem;
    }

    .success-title {
        font-size: 1rem;
    }
}

@media (max-height: 700px) {
    .app-container {
        padding: 1rem;
    }

    .app-content {
        gap: 1rem;
    }

    .logo {
        width: 50px;
        height: 50px;
        font-size: 22px;
        margin-bottom: 0.625rem;
    }

    .title {
        font-size: 1.375rem;
        margin-bottom: 0.375rem;
    }

    .subtitle {
        font-size: 0.875rem;
    }

    .extract-form, .download-section {
        padding: 1.25rem;
    }

    .form-grid {
        gap: 0.75rem;
        margin-bottom: 0.75rem;
    }

    .turnstile-container {
        padding: 0.625rem;
        margin-bottom: 0.75rem;
        min-height: 65px;
    }

    .submit-btn {
        padding: 0.6875rem 1rem;
    }

    .download-header {
        margin-bottom: 1rem;
    }

    .success-icon {
        font-size: 2.5rem;
        margin-bottom: 0.625rem;
    }

    .success-title {
        font-size: 1.125rem;
        margin-bottom: 0.375rem;
    }

    .download-details {
        padding: 0.875rem;
        margin-bottom: 1rem;
    }

    .footer-info {
        margin-bottom: 0.5rem;
    }
}

@media (max-height: 600px) {
    .app-container {
        padding: 0.75rem 1rem;
    }

    .app-content {
        gap: 0.75rem;
    }

    .logo {
        width: 44px;
        height: 44px;
        font-size: 20px;
        margin-bottom: 0.5rem;
    }

    .title {
        font-size: 1.125rem;
        margin-bottom: 0.25rem;
    }

    .subtitle {
        font-size: 0.75rem;
    }

    .extract-form, .download-section {
        padding: 1rem;
    }

    .success-icon {
        font-size: 2rem;
        margin-bottom: 0.5rem;
    }

    .success-title {
        font-size: 1rem;
    }

    .footer-info {
        margin-bottom: 0.375rem;
        font-size: 0.6875rem;
    }

    .footer-links {
        font-size: 0.6875rem;
    }
}