@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500;600&family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

:root {
    --bg-page: #f1f5f9;
    --card-bg: #ffffff;
    
    --primary: #0f172a;
    --primary-hover: #1e293b;
    --accent: #2563eb;
    --accent-light: #eff6ff;
    
    --border: #e2e8f0;
    --border-hover: #cbd5e1;
    
    --text-main: #0f172a;
    --text-muted: #64748b;
    --text-subtle: #94a3b8;

    --success: #16a34a;
    --success-bg: #f0fdf4;
    --success-border: #bbf7d0;

    --error: #dc2626;
    --error-bg: #fef2f2;
    --warning: #d97706;
    --warning-bg: #fffbeb;

    --shadow-card: 0 20px 25px -5px rgba(15, 23, 42, 0.08), 0 8px 10px -6px rgba(15, 23, 42, 0.04);
}

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

body {
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: var(--bg-page);
    color: var(--text-main);
    line-height: 1.5;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem 0.875rem;
    -webkit-font-smoothing: antialiased;
}

.app-wrapper {
    width: 100%;
    max-width: 640px;
    margin: 0 auto;
}

/* Main Unified Card */
.main-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 2rem;
    box-shadow: var(--shadow-card);
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* Header */
.app-header {
    text-align: center;
}

.logo {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    background: var(--bg-page);
    border: 1px solid var(--border);
    border-radius: 14px;
    margin-bottom: 0.875rem;
}

.logo img {
    width: 32px;
    height: 32px;
    object-fit: contain;
}

.title {
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -0.025em;
    color: var(--text-main);
    margin-bottom: 0.25rem;
}

.subtitle {
    font-size: 0.84375rem;
    color: var(--text-muted);
    line-height: 1.45;
}

.opensource-link {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    margin-top: 0.5rem;
    font-size: 0.78125rem;
    color: var(--accent);
    text-decoration: none;
    font-weight: 600;
}

.opensource-link:hover {
    text-decoration: underline;
}

/* Form Controls */
.extract-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.form-grid {
    display: flex;
    flex-direction: column;
    gap: 0.875rem;
}

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

.input-label {
    font-size: 0.71875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}

.input-field, .select-field {
    width: 100%;
    padding: 0.75rem 0.875rem;
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text-main);
    font-size: 0.875rem;
    font-family: inherit;
    transition: all 0.18s ease;
}

.input-field {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.8125rem;
}

.input-field:focus, .select-field:focus {
    outline: none;
    background: #ffffff;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-light);
}

.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 24 24' stroke='%2364748b' stroke-width='2'%3e%3cpath stroke-linecap='round' stroke-linejoin='round' d='M19 9l-7 7-7-7'/%3e%3c/svg%3e");
    background-position: right 0.75rem center;
    background-repeat: no-repeat;
    background-size: 1em;
    padding-right: 2.25rem;
    font-weight: 500;
}

.submit-btn {
    width: 100%;
    padding: 0.8125rem;
    background: var(--primary);
    border: none;
    border-radius: 10px;
    color: #ffffff;
    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.18s ease;
}

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

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

/* Status Messages */
.status-message {
    padding: 0.75rem 0.875rem;
    border-radius: 10px;
    font-size: 0.8125rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.status-message.success { background: var(--success-bg); border: 1px solid var(--success-border); color: var(--success); }
.status-message.error { background: var(--error-bg); border: 1px solid #fecaca; color: var(--error); }
.status-message.info { background: var(--accent-light); border: 1px solid #bfdbfe; color: var(--accent); }
.status-message.warning { background: var(--warning-bg); border: 1px solid #fde68a; color: var(--warning); }

/* Download Section */
.download-section {
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 1.25rem;
}

.download-header { text-align: center; margin-bottom: 1rem; }
.success-icon { font-size: 2.25rem; color: var(--success); margin-bottom: 0.25rem; }
.success-title { font-size: 1.0625rem; font-weight: 700; }
.success-subtitle { font-size: 0.78125rem; color: var(--text-muted); }

.download-details {
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.5rem 0.75rem;
    margin-bottom: 1rem;
}

.detail-item {
    display: flex;
    justify-content: space-between;
    padding: 0.375rem 0;
}
.detail-item:not(:last-child) { border-bottom: 1px solid var(--border); }
.detail-label { font-size: 0.78125rem; color: var(--text-muted); }
.detail-value { font-size: 0.78125rem; font-weight: 600; font-family: 'JetBrains Mono', monospace; }

.download-actions { display: flex; gap: 0.5rem; }
.download-btn {
    flex: 1; padding: 0.6875rem; background: var(--success); border-radius: 8px;
    color: white; font-size: 0.8125rem; font-weight: 600; text-decoration: none;
    display: flex; align-items: center; justify-content: center; gap: 0.375rem;
}
.new-extraction-btn {
    padding: 0.6875rem 0.875rem; background: #ffffff; border: 1px solid var(--border);
    border-radius: 8px; color: var(--text-main); font-size: 0.8125rem; font-weight: 600; cursor: pointer;
}

/* Terminal Component */
.terminal-widget {
    background: #0f172a;
    border-radius: 12px;
    padding: 1rem;
    color: #f8fafc;
    text-align: left;
}

.terminal-note-top {
    margin-bottom: 0.75rem;
    font-size: 0.75rem;
    color: #94a3b8;
    line-height: 1.4;
}

.terminal-body {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.8125rem;
    line-height: 1.6;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    text-align: left;
}

.terminal-row {
    display: flex;
    align-items: center;
}

.terminal-prompt { 
    color: #64748b; 
    margin-right: 0.5rem; 
    user-select: none; 
    flex-shrink: 0;
}

.command-text {
    color: #38bdf8;
}

.cursor { 
    color: #38bdf8; 
    margin-left: 2px;
    animation: blink 1s step-end infinite; 
}
@keyframes blink { 50% { opacity: 0; } }

/* Footer Section */
.card-footer {
    display: flex;
    align-items: center;
    justify-content: center;
    padding-top: 0.5rem;
    border-top: 1px solid var(--border);
    font-size: 0.78125rem;
}

.developer-tag a {
    color: var(--accent);
    font-weight: 600;
    text-decoration: none;
}
.developer-tag a:hover { text-decoration: underline; }

.hidden { display: none !important; }

/* Responsive Adjustments */
@media (max-width: 480px) {
    .main-card {
        padding: 1.25rem;
        border-radius: 16px;
    }
}
