/* =========================================
   ARCHITECT ZERO | DESIGN SYSTEM (COMPACT UI)
   ========================================= */
:root {
    /* Palette - Reference Exact Match */
    --bg-app: #f5f5f7;
    --bg-surface: #ffffff;
    --fg-primary: #111827;      /* Gray 900 */
    --fg-secondary: #6b7280;    /* Gray 500 */
    --fg-accent: #000000;       /* Black */
    
    /* Spacing tokens - TIGHTENED */
    --max-width: 800px;         /* Max width constrained */
    --radius-container: 1rem;   /* 16px (matches rounded-2xl roughly) */
    --radius-inner: 0.75rem;    /* 12px (matches rounded-xl) */
    
    /* Shadows - Soft & Diffuse */
    --shadow-card: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.02);
    --shadow-float: 0 10px 15px -3px rgba(0, 0, 0, 0.05), 0 4px 6px -2px rgba(0, 0, 0, 0.025);
}

/* =========================================
   RESET & BASE
   ========================================= */
* {
    box-sizing: border-box;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background-color: var(--bg-app);
    color: var(--fg-primary);
    margin: 0;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    line-height: 1.5;
    align-items: center;
}

main {
    width: 100%;
    max-width: var(--max-width);
    /* Reduced padding to remove "Giant" feeling at top */
    padding: 40px 20px; 
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 24px; /* Reduced gap between cards */
}

/* =========================================
   HEADER & SELECTOR (Compact)
   ========================================= */
header {
    text-align: center;
    margin-bottom: 8px; /* Tighter to the card */
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

/* Privacy Pill - Exact Replica */
.privacy-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #e5e5e7;
    padding: 4px 12px;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--fg-secondary);
    letter-spacing: 0.01em;
}

.privacy-pill svg {
    width: 12px;
    height: 12px;
    display: block;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Tool Selector Wrapper */
.tool-selector-wrapper {
    position: relative;
    z-index: 50;
    margin-top: 4px;
}

.tool-selector-wrapper select {
    display: none; 
}

.custom-select-trigger {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 1.875rem; /* ~30px (text-3xl) - Slightly smaller than before */
    font-weight: 800;
    color: var(--fg-primary);
    cursor: pointer;
    line-height: 1.2;
    letter-spacing: -0.02em;
    transition: opacity 0.2s;
}

.custom-select-trigger:hover {
    opacity: 0.7;
}

.selector-icon {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s;
}

.custom-select-wrapper.open .selector-icon {
    transform: rotate(180deg);
}

.custom-options {
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(8px);
    background: var(--bg-surface);
    border: 1px solid rgba(0,0,0,0.04);
    border-radius: 12px;
    box-shadow: var(--shadow-float);
    min-width: 260px;
    opacity: 0;
    visibility: hidden;
    padding: 6px;
    transition: all 0.15s ease-out;
    z-index: 100;
}

.custom-select-wrapper.open .custom-options {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

.custom-optgroup-label {
    padding: 8px 12px 4px;
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--fg-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.custom-option {
    padding: 8px 12px;
    font-size: 0.9rem;
    color: var(--fg-primary);
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    transition: background 0.1s;
}

.custom-option:hover {
    background-color: #f3f4f6;
}

/* =========================================
   GENERIC CARD CONTAINER
   ========================================= */
.card-style {
    background: var(--bg-surface);
    border-radius: var(--radius-container);
    box-shadow: var(--shadow-card);
    /* Reduced padding for compact look */
    padding: 32px; 
    border: 1px solid rgba(255, 255, 255, 0.0); 
}

/* =========================================
   DROP ZONE (Compact & Organized)
   ========================================= */
/* The outer white card wrapper for the dropzone */
#dropZone {
    background: var(--bg-surface);
    border-radius: var(--radius-container);
    box-shadow: var(--shadow-card);
    padding: 24px; /* Tighter padding around the dashed area */
    text-align: center;
    transition: transform 0.2s ease;
    cursor: pointer;
}

/* The inner dashed area */
.dz-inner-dashed {
    background-image: url("data:image/svg+xml,%3csvg width='100%25' height='100%25' xmlns='http://www.w3.org/2000/svg'%3e%3crect width='100%25' height='100%25' fill='none' rx='12' ry='12' stroke='%23D1D5DBFF' stroke-width='2' stroke-dasharray='6%2c 10' stroke-dashoffset='0' stroke-linecap='square'/%3e%3c/svg%3e");
    border-radius: var(--radius-inner);
    /* Reduced height to stop it looking "GIGANTE" */
    min-height: 220px; 
    padding: 32px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
}

#dropZone:hover .dz-inner-dashed {
    background-color: #f9fafb;
}

#dropZone.drag-over .dz-inner-dashed {
    background-color: #eff6ff;
    background-image: url("data:image/svg+xml,%3csvg width='100%25' height='100%25' xmlns='http://www.w3.org/2000/svg'%3e%3crect width='100%25' height='100%25' fill='none' rx='12' ry='12' stroke='%233B82F6' stroke-width='2' stroke-dasharray='6%2c 10' stroke-dashoffset='0' stroke-linecap='square'/%3e%3c/svg%3e");
}

.dz-icon {
    margin-bottom: 20px;
    color: #9ca3af; /* Gray-400 */
}

.dz-icon svg {
    width: 56px; /* Slightly smaller icon */
    height: 56px;
}

.dz-title {
    font-size: 1.125rem; /* text-lg */
    font-weight: 600;
    color: var(--fg-primary);
    margin-bottom: 4px;
}

.dz-sub {
    font-size: 0.875rem; /* text-sm */
    color: var(--fg-secondary);
    margin-bottom: 24px;
    max-width: 320px;
    line-height: 1.4;
}

.btn-trigger {
    background: var(--fg-accent);
    color: #ffffff;
    border: none;
    padding: 10px 32px; /* Tighter button padding */
    border-radius: 8px;
    font-weight: 500;
    font-size: 0.9rem;
    cursor: pointer;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    transition: all 0.2s;
}

.btn-trigger:hover {
    background: #1f2937;
    transform: translateY(-1px);
}

/* =========================================
   PANELS (Settings)
   ========================================= */
.panel-config {
    background: var(--bg-surface);
    border-radius: var(--radius-container);
    padding: 20px 24px;
    border: 1px solid rgba(0,0,0,0.03);
    box-shadow: var(--shadow-card);
    display: none;
    margin-bottom: 0;
    animation: slideUp 0.2s ease-out;
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; transform: translateY(0); }
}

.opt-group {
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: 0.9rem;
}

.opt-label {
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.opt-value {
    background: #f3f4f6;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: monospace;
    font-size: 0.8rem;
}

input[type=range] {
    -webkit-appearance: none;
    width: 100%;
    background: transparent;
    max-width: 160px;
}

input[type=range]::-webkit-slider-thumb {
    -webkit-appearance: none;
    height: 16px;
    width: 16px;
    border-radius: 50%;
    background: var(--fg-accent);
    cursor: pointer;
    margin-top: -6px;
}

input[type=range]::-webkit-slider-runnable-track {
    width: 100%;
    height: 4px;
    background: #e5e7eb;
    border-radius: 2px;
}

/* Resize Inputs */
.resize-grid {
    display: grid;
    grid-template-columns: 1fr 1fr auto;
    gap: 12px;
    align-items: end;
}

.input-group label {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--fg-secondary);
    margin-bottom: 4px;
}

.input-field {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 0.85rem;
}

.input-field:focus {
    outline: none;
    border-color: var(--fg-accent);
}

.checkbox-wrapper {
    display: flex;
    align-items: center;
    gap: 6px;
    padding-bottom: 8px;
    font-size: 0.85rem;
}

.helper-text {
    grid-column: 1 / -1;
    font-size: 0.75rem;
    color: var(--fg-secondary);
    margin-top: 4px;
}

/* =========================================
   PROGRESS & PROCESSING
   ========================================= */
.progress-container {
    background: var(--bg-surface);
    border-radius: var(--radius-container);
    padding: 24px;
    box-shadow: var(--shadow-card);
    display: none; 
    margin-bottom: 24px;
}

.progress-meta {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--fg-primary);
    margin-bottom: 8px;
}

.progress-track {
    height: 6px;
    background: #f3f4f6;
    border-radius: 99px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--fg-accent);
    width: 0%;
    transition: width 0.3s ease;
}

/* =========================================
   ACTIONS
   ========================================= */
.actions {
    display: none; /* JS toggles */
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 0;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: 6px;
    font-weight: 500;
    font-size: 0.85rem;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s;
    height: 38px;
    border: none;
}

.btn-outline {
    background: transparent;
    border: 1px solid #d1d5db;
    color: var(--fg-primary);
}

.btn-outline:hover {
    background: #f9fafb;
    border-color: #9ca3af;
}

.btn-success {
    background: var(--fg-accent);
    color: white;
}

.btn-success:hover {
    background: #1f2937;
}

.coffee-label { font-weight: 600; }

/* =========================================
   FILE LIST
   ========================================= */
.file-list {
    margin-top: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.file-item {
    background: var(--bg-surface);
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 12px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 1px 2px rgba(0,0,0,0.02);
}

.file-name {
    font-weight: 500;
    font-size: 0.85rem;
    max-width: 200px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.status-badge {
    font-size: 0.7rem;
    padding: 2px 8px;
    border-radius: 99px;
    font-weight: 700;
    text-transform: uppercase;
}

.status-done { background: #d1fae5; color: #065f46; }
.status-error { background: #fee2e2; color: #991b1b; }

.single-dl-link {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--fg-primary);
    text-decoration: none;
    border-bottom: 1px solid transparent;
}

.single-dl-link:hover { border-bottom-color: currentColor; }

.warning-box {
    background: #fffbeb;
    color: #b45309;
    padding: 12px;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 500;
    text-align: center;
    border: 1px solid #fcd34d;
    margin-top: 16px;
    display: none;
}

/* =========================================
   HOW IT WORKS (Organized Grid)
   ========================================= */
.how-it-works-title {
    text-align: center;
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 40px;
    color: var(--fg-primary);
}

.steps-grid {
    display: flex;
    flex-direction: column;
    gap: 32px;
}

@media (min-width: 768px) {
    .steps-grid {
        flex-direction: row;
        gap: 0;
        align-items: flex-start;
    }
}

.step-card {
    flex: 1;
    position: relative;
    padding: 0 16px;
    text-align: center;
}

/* Vertical Divider Lines */
@media (min-width: 768px) {
    .step-card:not(:last-child)::after {
        content: "";
        position: absolute;
        right: 0;
        top: 0;
        bottom: 0;
        width: 1px;
        background-color: #e5e7eb; /* Subtle gray line */
    }
}

.step-number {
    font-size: 3rem; /* 48px - Big but not giant */
    font-weight: 800;
    color: var(--fg-primary);
    line-height: 1;
    margin-bottom: 12px;
}

.step-title {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 8px;
    margin-top: 0;
    color: var(--fg-primary);
}

.step-desc {
    font-size: 0.85rem;
    color: var(--fg-secondary);
    line-height: 1.5;
    max-width: 220px;
    margin: 0 auto;
}

/* =========================================
   FAQ
   ========================================= */
.faq-title {
    text-align: center;
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 24px;
}

details {
    border-bottom: 1px solid #e5e7eb;
    padding: 16px 0;
}

details:last-of-type { border-bottom: none; }

details summary {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--fg-primary);
    cursor: pointer;
    list-style: none;
}

details summary::-webkit-details-marker { display: none; }

details summary::after {
    content: "";
    width: 18px;
    height: 18px;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke-width='2' stroke='%239CA3AF'%3e%3cpath stroke-linecap='round' stroke-linejoin='round' d='M19.5 8.25l-7.5 7.5-7.5-7.5' /%3e%3c/svg%3e");
    background-size: contain;
    background-repeat: no-repeat;
    transition: transform 0.2s;
}

details[open] summary::after { transform: rotate(180deg); }

.faq-content {
    margin-top: 12px;
    color: var(--fg-secondary);
    font-size: 0.85rem;
    line-height: 1.6;
}

/* =========================================
   FOOTER
   ========================================= */
footer {
    border-top: 1px solid #e5e7eb;
    padding: 32px 20px;
    text-align: center;
    margin-top: 32px;
}

.footer-nav {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 20px;
    margin-bottom: 16px;
}

.footer-link {
    font-size: 0.75rem;
    color: var(--fg-secondary);
    text-decoration: none;
    font-weight: 500;
}

.footer-link:hover { color: var(--fg-primary); text-decoration: underline; }
.footer-divider { display: none; }

.footer-copy {
    font-size: 0.7rem;
    color: #9ca3af;
}

/* =========================================
   MOBILE
   ========================================= */
@media (max-width: 640px) {
    main { padding: 30px 16px; }
    .card-style, #dropZone { padding: 20px; }
    .dz-inner-dashed { min-height: 200px; padding: 24px 16px; }
    
    .resize-grid { grid-template-columns: 1fr; }
    .actions { display: none; flex-direction: column; } /* JS will force flex, but direction col */
    .actions .btn { width: 100%; }
    
    .step-card { 
        padding-bottom: 32px; 
        border-bottom: 1px solid #e5e7eb; 
        margin-bottom: 32px;
    }
    .step-card:last-child { border: none; margin: 0; padding: 0; }
}