/* ===== Tool Navigation ===== */
.tool-nav {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 12px 0;
    position: sticky;
    top: 60px;
    z-index: 40;
    backdrop-filter: blur(12px);
    background: rgba(255, 255, 255, 0.85);
}

.tool-nav .container {
    display: flex;
    align-items: center;
    gap: 20px;
}

.tool-nav-back {
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: var(--transition);
}

.tool-nav-back:hover {
    color: var(--primary);
}

.tool-nav-title {
    font-weight: 600;
    color: var(--text);
    font-size: 0.9rem;
}

/* ===== Main Wrapper ===== */
.calculator-wrapper {
    padding: 24px 0 60px;
}

.calc-header {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 28px;
}

.calc-icon {
    width: 56px;
    height: 56px;
    background: var(--primary-light);
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border: 1px solid var(--border);
    color: var(--primary);
}

.calc-icon svg {
    width: 28px;
    height: 28px;
}

.calc-header h1 {
    font-size: 1.6rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.calc-header p {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.calc-grid {
    display: grid;
    grid-template-columns: 340px 1fr;
    gap: 32px;
    align-items: start;
}

@media (max-width: 1024px) {
    .calc-grid {
        grid-template-columns: 1fr;
    }
}

/* ===== Left Column ===== */
.calc-form {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow);
    position: sticky;
    top: 140px;
}

@media (max-width: 1024px) {
    .calc-form {
        position: static;
    }
}

/* ===== Upload Area ===== */
.upload-area {
    border: 2px dashed var(--border);
    border-radius: 12px;
    padding: 32px 20px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    margin-bottom: 18px;
}

.upload-area:hover {
    border-color: var(--primary);
    background: var(--primary-light);
}

.upload-area.dragover {
    border-color: var(--primary);
    background: var(--primary-light);
    transform: scale(1.02);
}

.upload-area .upload-icon {
    display: block;
    margin-bottom: 12px;
    color: var(--text-muted);
}

.upload-area .upload-icon svg {
    width: 48px;
    height: 48px;
}

.upload-area h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 4px;
}

.upload-area p {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin: 6px 0;
}

.upload-btn {
    padding: 10px 28px;
    border: none;
    border-radius: 8px;
    background: var(--primary);
    color: white;
    font-family: inherit;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.3);
}

.upload-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(37, 99, 235, 0.4);
}

.upload-hint {
    font-size: 0.75rem !important;
    color: var(--text-muted) !important;
    margin-top: 6px !important;
}

/* ===== Settings ===== */
.settings-group {
    background: var(--bg);
    border-radius: 10px;
    padding: 14px 16px;
    margin-bottom: 16px;
    border: 1px solid var(--border);
}

.settings-group h4 {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 12px;
}

.settings-row {
    margin-bottom: 12px;
}

.settings-row:last-child {
    margin-bottom: 0;
}

.settings-row label {
    display: block;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

/* ===== Factor Buttons ===== */
.factor-buttons {
    display: flex;
    gap: 10px;
}

.factor-btn {
    flex: 1;
    padding: 8px 16px;
    border: 1.5px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    font-family: inherit;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
}

.factor-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.factor-btn.active {
    border-color: var(--primary);
    background: var(--primary);
    color: white;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.3);
}

.factor-btn.active:hover {
    box-shadow: 0 4px 16px rgba(37, 99, 235, 0.4);
}

/* ===== File Count ===== */
.file-count {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-weight: 500;
}

/* ===== Action Buttons ===== */
.action-buttons {
    display: flex;
    gap: 10px;
}

.calc-btn {
    flex: 1;
    padding: 12px;
    font-size: 0.95rem;
    font-weight: 700;
    font-family: inherit;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: 0 4px 16px rgba(37, 99, 235, 0.25);
}

.calc-btn svg {
    width: 18px;
    height: 18px;
    stroke: currentColor;
    stroke-width: 2;
    fill: none;
    flex-shrink: 0;
}

.calc-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 28px rgba(37, 99, 235, 0.35);
}

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

/* ===== Progress ===== */
.progress-container {
    margin-top: 14px;
    text-align: center;
}

.progress-bar {
    width: 100%;
    height: 6px;
    background: var(--border);
    border-radius: 3px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(to right, var(--primary), #7c3aed);
    border-radius: 3px;
    transition: width 0.3s ease;
}

.progress-text {
    display: block;
    margin-top: 6px;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* ===== File List ===== */
.file-list-container {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
}

.file-list-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
    gap: 8px;
}

.file-list-title {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text);
}

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

.file-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 14px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--surface);
    font-family: inherit;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
}

.file-action-btn svg {
    width: 14px;
    height: 14px;
    stroke: currentColor;
    stroke-width: 2;
    fill: none;
    flex-shrink: 0;
}

.file-action-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.file-action-btn.danger:hover {
    border-color: #ef4444;
    color: #ef4444;
    background: #fef2f2;
}

.file-list {
    max-height: 420px;
    overflow-y: auto;
    padding: 8px;
}

.file-list::-webkit-scrollbar {
    width: 4px;
}

.file-list::-webkit-scrollbar-track {
    background: transparent;
}

.file-list::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

/* ===== File Item ===== */
.file-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 10px;
    border-radius: 8px;
    transition: var(--transition);
    border-bottom: 1px solid var(--border);
}

.file-item:last-child {
    border-bottom: none;
}

.file-item:hover {
    background: var(--bg);
}

.file-thumb {
    width: 44px;
    height: 44px;
    border-radius: 6px;
    overflow: hidden;
    flex-shrink: 0;
    border: 1px solid var(--border);
    background: var(--bg);
}

.file-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.file-info {
    flex: 1;
    min-width: 0;
}

.file-name {
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-details {
    font-size: 0.7rem;
    color: var(--text-muted);
}

.file-status {
    font-size: 0.7rem;
    font-weight: 600;
    margin-top: 1px;
}

.file-status.ready {
    color: var(--text-muted);
}

.file-status.processing {
    color: #f59e0b;
    animation: pulse 1s ease-in-out infinite;
}

.file-status.done {
    color: #10b981;
}

.file-status.error {
    color: #ef4444;
}

.file-actions {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}

.file-btn {
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 6px;
    background: transparent;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    padding: 0;
}

.file-btn svg {
    width: 18px;
    height: 18px;
    stroke: currentColor;
    stroke-width: 2;
    fill: none;
    transition: var(--transition);
}

.file-btn:hover {
    background: var(--bg);
}

.file-btn.download:hover {
    color: var(--primary);
    background: var(--primary-light);
}

.file-btn.remove:hover {
    color: #ef4444;
    background: #fef2f2;
}

/* ===== Empty State ===== */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
}

.empty-state .empty-icon {
    margin-bottom: 12px;
    color: var(--border);
}

.empty-state .empty-icon svg {
    width: 48px;
    height: 48px;
}

.empty-state p {
    font-size: 0.95rem;
    margin: 0;
    color: var(--text-secondary);
}

.empty-state span {
    font-size: 0.8rem;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* ===== SEO Content ===== */
.seo-content {
    margin-top: 50px;
    padding-top: 40px;
    border-top: 1px solid var(--border);
}

.seo-inner {
    max-width: 760px;
}

.seo-content h2 {
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: 12px;
    color: var(--text);
    letter-spacing: -0.02em;
}

.seo-content h3 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-top: 24px;
    margin-bottom: 10px;
    color: var(--text);
}

.seo-content h4 {
    font-size: 1rem;
    font-weight: 600;
    margin-top: 18px;
    margin-bottom: 8px;
    color: var(--text);
}

.seo-content p {
    font-size: 0.95rem;
    color: var(--text-secondary);
    line-height: 1.8;
    margin-bottom: 14px;
}

.seo-content ul {
    list-style: none;
    padding: 0;
    margin-bottom: 16px;
}

.seo-content ul li {
    font-size: 0.92rem;
    color: var(--text-secondary);
    line-height: 1.7;
    padding: 4px 0 4px 24px;
    position: relative;
}

.seo-content ul li::before {
    content: '—';
    position: absolute;
    left: 0;
    color: var(--primary);
    font-weight: 600;
}

.seo-content strong {
    color: var(--text);
}

/* ===== Highlight Box ===== */
.highlight-box {
    background: var(--primary-light);
    border-left: 4px solid var(--primary);
    border-radius: 8px;
    padding: 16px 20px;
    margin: 16px 0;
}

.highlight-box p {
    margin-bottom: 0;
    font-weight: 500;
    color: var(--text);
}

/* ===== Screenshot Figure ===== */
.screenshot-figure {
    margin: 20px 0 30px;
}

.screenshot-figure img {
    width: 100%;
    max-width: 760px;
    height: auto;
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.06);
    display: block;
}

.screenshot-figure figcaption {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-align: center;
    margin-top: 8px;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .calc-header {
        flex-direction: column;
        text-align: center;
    }

    .calc-header h1 {
        font-size: 1.4rem;
    }
}

@media (max-width: 640px) {
    .calculator-wrapper {
        padding: 16px 0 40px;
    }

    .calc-form {
        padding: 16px;
    }

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

    .file-list-header {
        flex-direction: column;
        align-items: stretch;
        gap: 6px;
    }

    .file-list-actions {
        justify-content: flex-start;
        flex-wrap: wrap;
    }

    .file-item {
        flex-wrap: wrap;
        gap: 8px;
    }

    .file-actions {
        margin-left: auto;
    }

    .seo-content {
        margin-top: 30px;
        padding-top: 24px;
    }

    .seo-content h2 {
        font-size: 1.2rem;
    }

    .seo-content h3 {
        font-size: 1rem;
    }

    .seo-content p,
    .seo-content ul li {
        font-size: 0.88rem;
    }
}

@media (max-width: 480px) {
    .calc-icon {
        width: 44px;
        height: 44px;
    }

    .calc-icon svg {
        width: 22px;
        height: 22px;
    }

    .factor-btn {
        font-size: 0.8rem;
        padding: 6px 12px;
    }

    .file-thumb {
        width: 36px;
        height: 36px;
    }

    .file-btn {
        width: 28px;
        height: 28px;
    }
}