/* ============================================
   DocScanner - Online Document Scanning Tool
   Blue Theme | Responsive Design
   ============================================ */

/* --- CSS Variables --- */
:root {
    --primary: #2563EB;
    --primary-dark: #1D4ED8;
    --primary-light: #3B82F6;
    --primary-50: #EFF6FF;
    --primary-100: #DBEAFE;
    --primary-200: #BFDBFE;
    --primary-600: #2563EB;
    --primary-700: #1D4ED8;

    --danger: #EF4444;
    --danger-light: #FEE2E2;
    --success: #16A34A;
    --success-light: #DCFCE7;

    --text: #1E293B;
    --text-secondary: #64748B;
    --text-light: #94A3B8;

    --bg: #FFFFFF;
    --bg-secondary: #F8FAFC;
    --bg-tertiary: #F1F5F9;

    --border: #E2E8F0;
    --border-light: #F1F5F9;

    --radius: 12px;
    --radius-sm: 8px;
    --radius-lg: 16px;

    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -2px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -4px rgba(0,0,0,0.1);

    --transition: 0.2s ease;

    --max-width: 960px;
}

/* --- Reset & Base --- */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
    color: var(--text);
    background: var(--bg);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

img {
    max-width: 100%;
    height: auto;
}

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

/* --- Container --- */
.container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 20px;
}

/* --- Buttons --- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 20px;
    border: 1.5px solid transparent;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
    font-family: inherit;
    line-height: 1.4;
}

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

.btn-primary {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

.btn-primary:hover:not(:disabled) {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
}

.btn-outline {
    background: transparent;
    color: var(--primary);
    border-color: var(--primary-200);
}

.btn-outline:hover:not(:disabled) {
    background: var(--primary-50);
    border-color: var(--primary);
}

.btn-outline-danger {
    background: transparent;
    color: var(--danger);
    border-color: #FECACA;
}

.btn-outline-danger:hover:not(:disabled) {
    background: var(--danger-light);
    border-color: var(--danger);
}

.btn-large {
    padding: 14px 32px;
    font-size: 16px;
    border-radius: var(--radius);
    gap: 8px;
}

/* --- Navbar --- */
.navbar {
    display: flex;
    align-items: center;
    padding: 16px 0;
}

.logo {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-size: 20px;
    font-weight: 700;
    color: var(--text);
}

.logo span {
    background: linear-gradient(135deg, var(--primary), #7C3AED);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* --- Hero --- */
.hero {
    background: linear-gradient(135deg, var(--primary-50) 0%, #EEF2FF 50%, #E0E7FF 100%);
    padding-bottom: 48px;
}

.hero-content {
    text-align: center;
    padding: 40px 0 20px;
}

.hero-content h1 {
    font-size: clamp(28px, 5vw, 42px);
    font-weight: 800;
    color: var(--text);
    margin-bottom: 12px;
    letter-spacing: -0.5px;
}

.hero-subtitle {
    font-size: clamp(16px, 2.5vw, 20px);
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.hero-desc {
    font-size: 14px;
    color: var(--text-light);
}

.hero-desc strong {
    color: var(--primary);
    font-weight: 600;
}

/* --- Steps --- */
.steps {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 0 16px;
    gap: 0;
    flex-wrap: wrap;
}

.step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    position: relative;
}

.step-number {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--bg-tertiary);
    color: var(--text-light);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 15px;
    transition: all var(--transition);
}

.step.active .step-number {
    background: var(--primary);
    color: #fff;
}

.step.completed .step-number {
    background: var(--success);
    color: #fff;
}

.step-label {
    font-size: 12px;
    color: var(--text-light);
    white-space: nowrap;
    transition: color var(--transition);
}

.step.active .step-label {
    color: var(--primary);
    font-weight: 600;
}

.step.completed .step-label {
    color: var(--success);
}

.step-line {
    width: 40px;
    height: 2px;
    background: var(--border);
    margin: 0 4px;
    margin-bottom: 20px;
    transition: background var(--transition);
}

.step-line.completed {
    background: var(--success);
}

/* --- Upload Section --- */
.upload-section {
    margin-bottom: 24px;
}

.upload-area {
    border: 2px dashed var(--primary-200);
    border-radius: var(--radius-lg);
    padding: 48px 24px;
    text-align: center;
    cursor: pointer;
    transition: all var(--transition);
    background: var(--primary-50);
}

.upload-area:hover,
.upload-area.drag-over {
    border-color: var(--primary);
    background: var(--primary-100);
}

.upload-placeholder {
    pointer-events: none;
}

.upload-icon {
    margin-bottom: 16px;
    opacity: 0.8;
}

.upload-text {
    font-size: 16px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 6px;
}

.upload-hint {
    font-size: 13px;
    color: var(--text-light);
}

/* --- Preview Section --- */
.preview-section {
    margin-bottom: 24px;
}

.preview-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    flex-wrap: wrap;
    gap: 12px;
}

.preview-header h2 {
    font-size: 18px;
    font-weight: 700;
}

.preview-header h2 span {
    color: var(--primary);
}

.preview-actions {
    display: flex;
    gap: 8px;
}

.preview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
}

.preview-item {
    position: relative;
    border-radius: var(--radius-sm);
    overflow: hidden;
    border: 2px solid var(--border);
    background: var(--bg-secondary);
    aspect-ratio: 3 / 4;
    transition: border-color var(--transition);
}

.preview-item:hover {
    border-color: var(--primary-200);
}

.preview-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.preview-item-overlay {
    position: absolute;
    top: 4px;
    right: 4px;
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: opacity var(--transition);
}

.preview-item:hover .preview-item-overlay {
    opacity: 1;
}

.preview-item-btn {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: none;
    background: rgba(0,0,0,0.6);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: background var(--transition);
}

.preview-item-btn:hover {
    background: rgba(0,0,0,0.8);
}

.preview-item-btn.delete:hover {
    background: var(--danger);
}

.preview-item-index {
    position: absolute;
    top: 4px;
    left: 4px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: rgba(0,0,0,0.6);
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* --- Action Section --- */
.action-section {
    text-align: center;
    margin-bottom: 24px;
}

.action-hint {
    margin-top: 10px;
    font-size: 13px;
    color: var(--text-light);
}

/* --- Progress Section --- */
.progress-section {
    margin-bottom: 24px;
}

.progress-card {
    background: var(--primary-50);
    border: 1.5px solid var(--primary-100);
    border-radius: var(--radius);
    padding: 24px;
    text-align: center;
}

.progress-status {
    font-size: 16px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 16px;
}

.progress-bar-wrapper {
    width: 100%;
    height: 8px;
    background: var(--bg-tertiary);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 8px;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--primary-light));
    border-radius: 4px;
    width: 0%;
    transition: width 0.3s ease;
}

.progress-text {
    font-size: 13px;
    color: var(--text-secondary);
}

/* --- Result Section --- */
.result-section {
    margin-bottom: 24px;
}

.result-card {
    background: var(--success-light);
    border: 1.5px solid #BBF7D0;
    border-radius: var(--radius);
    padding: 40px 24px;
    text-align: center;
}

.result-icon {
    margin-bottom: 16px;
}

.result-card h2 {
    font-size: 22px;
    font-weight: 700;
    color: var(--success);
    margin-bottom: 8px;
}

.result-info {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 24px;
}

.result-info span {
    font-weight: 700;
    color: var(--text);
}

/* --- Section Titles --- */
.section-title {
    font-size: clamp(24px, 3vw, 30px);
    font-weight: 800;
    text-align: center;
    margin-bottom: 8px;
    color: var(--text);
}

.section-desc {
    text-align: center;
    color: var(--text-secondary);
    font-size: 15px;
    margin-bottom: 40px;
}

/* --- Features Section --- */
.features-section {
    padding: 64px 0;
    background: var(--bg-secondary);
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.feature-card {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 28px 24px;
    transition: all var(--transition);
}

.feature-card:hover {
    border-color: var(--primary-200);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.feature-icon {
    margin-bottom: 16px;
}

.feature-card h3 {
    font-size: 17px;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--text);
}

.feature-card p {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.7;
}

/* --- How Section --- */
.how-section {
    padding: 64px 0;
}

.how-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 20px;
}

.how-card {
    text-align: center;
    padding: 28px 20px;
}

.how-number {
    font-size: 40px;
    font-weight: 800;
    color: var(--primary-100);
    margin-bottom: 12px;
    line-height: 1;
}

.how-card h3 {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--text);
}

.how-card p {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.7;
}

/* --- FAQ Section --- */
.faq-section {
    padding: 64px 0;
    background: var(--bg-secondary);
}

.faq-list {
    max-width: 760px;
    margin: 0 auto;
}

.faq-item {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    margin-bottom: 10px;
    overflow: hidden;
}

.faq-item[open] {
    border-color: var(--primary-200);
}

.faq-question {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
    cursor: pointer;
    list-style: none;
    user-select: none;
}

.faq-question::-webkit-details-marker {
    display: none;
}

.faq-question::marker {
    display: none;
}

.faq-arrow {
    flex-shrink: 0;
    transition: transform var(--transition);
    color: var(--text-light);
}

.faq-item[open] .faq-arrow {
    transform: rotate(180deg);
    color: var(--primary);
}

.faq-answer {
    padding: 0 20px 16px;
}

.faq-answer p {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.7;
}

/* --- Help Section --- */
.help-section {
    padding: 64px 0;
}

.help-content {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(400px, 1fr));
    gap: 24px;
}

.help-block {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
}

.help-block h3 {
    font-size: 17px;
    font-weight: 700;
    margin-bottom: 14px;
    color: var(--text);
}

.help-block ol,
.help-block ul {
    padding-left: 20px;
}

.help-block li {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 8px;
    line-height: 1.7;
}

.help-block li strong {
    color: var(--text);
}

/* --- Footer --- */
.footer {
    background: #0F172A;
    color: #CBD5E1;
    padding: 48px 0 24px;
}

.footer-content {
    display: flex;
    justify-content: space-between;
    gap: 40px;
    margin-bottom: 32px;
    flex-wrap: wrap;
}

.footer-brand {
    max-width: 280px;
}

.footer-logo {
    font-size: 20px;
    font-weight: 700;
    color: #fff;
    margin-bottom: 8px;
    display: block;
}

.footer-brand p {
    font-size: 13px;
    color: #94A3B8;
    line-height: 1.6;
}

.footer-links {
    display: flex;
    gap: 48px;
}

.footer-col h4 {
    font-size: 14px;
    font-weight: 600;
    color: #fff;
    margin-bottom: 12px;
}

.footer-col a {
    display: block;
    font-size: 13px;
    color: #94A3B8;
    margin-bottom: 8px;
    transition: color var(--transition);
}

.footer-col a:hover {
    color: #fff;
}

.footer-bottom {
    border-top: 1px solid #1E293B;
    padding-top: 20px;
    text-align: center;
}

.footer-bottom p {
    font-size: 13px;
    color: #64748B;
}

/* --- Toast / Notification --- */
.toast {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--text);
    color: #fff;
    padding: 12px 24px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    z-index: 1000;
    box-shadow: var(--shadow-lg);
    animation: toastIn 0.3s ease, toastOut 0.3s ease 2.7s forwards;
    pointer-events: none;
}

.toast.error {
    background: var(--danger);
}

.toast.success {
    background: var(--success);
}

@keyframes toastIn {
    from { opacity: 0; transform: translateX(-50%) translateY(-10px); }
    to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

@keyframes toastOut {
    from { opacity: 1; }
    to { opacity: 0; }
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .hero {
        padding-bottom: 32px;
    }

    .hero-content {
        padding: 24px 0 12px;
    }

    .steps {
        padding: 16px 0 8px;
    }

    .step-line {
        width: 24px;
    }

    .upload-area {
        padding: 32px 16px;
    }

    .upload-text {
        font-size: 15px;
    }

    .preview-grid {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
        gap: 8px;
    }

    .preview-header h2 {
        font-size: 16px;
    }

    .btn {
        padding: 8px 14px;
        font-size: 13px;
    }

    .btn-large {
        padding: 12px 24px;
        font-size: 15px;
    }

    .features-grid {
        grid-template-columns: 1fr;
    }

    .how-grid {
        grid-template-columns: 1fr 1fr;
        gap: 12px;
    }

    .help-content {
        grid-template-columns: 1fr;
    }

    .footer-content {
        flex-direction: column;
        gap: 24px;
    }

    .footer-links {
        gap: 32px;
    }

    .section-title {
        font-size: 22px;
    }

    .section-desc {
        font-size: 14px;
        margin-bottom: 28px;
    }

    .features-section,
    .how-section,
    .faq-section,
    .help-section {
        padding: 40px 0;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 16px;
    }

    .step-line {
        width: 16px;
        margin: 0 2px;
        margin-bottom: 20px;
    }

    .step-label {
        font-size: 11px;
    }

    .step-number {
        width: 30px;
        height: 30px;
        font-size: 13px;
    }

    .how-grid {
        grid-template-columns: 1fr;
    }

    .preview-grid {
        grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
    }

    .preview-actions {
        width: 100%;
    }

    .preview-actions .btn {
        flex: 1;
        justify-content: center;
    }
}
