/* ===== 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;
}

/* ===== Calculator ===== */
.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: 380px 1fr;
    gap: 32px;
    align-items: start;
}

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

/* ===== Upload Area ===== */
.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 {
    border: 2px dashed var(--border);
    border-radius: 12px;
    padding: 36px 20px;
    text-align: center;
    transition: var(--transition);
    cursor: pointer;
    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-icon {
    display: block;
    margin-bottom: 12px;
    color: var(--text-muted);
}

.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;
}

.settings-row input[type="range"] {
    width: 100%;
    height: 4px;
    -webkit-appearance: none;
    appearance: none;
    background: var(--border);
    border-radius: 2px;
    outline: none;
    transition: var(--transition);
}

.settings-row input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--primary);
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.3);
}

.settings-row input[type="range"]::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--primary);
    cursor: pointer;
    border: none;
}

.quality-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.65rem;
    color: var(--text-muted);
    margin-top: 4px;
}

.resize-inputs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 8px;
}

.resize-inputs div label {
    font-size: 0.7rem;
    font-weight: 500;
    color: var(--text-muted);
    margin-bottom: 2px;
}

.resize-inputs input[type="number"] {
    width: 100%;
    padding: 6px 10px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 0.85rem;
    font-family: inherit;
    background: var(--surface);
    color: var(--text);
    transition: var(--transition);
}

.resize-inputs input[type="number"]:focus {
    border-color: var(--primary);
    outline: none;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.08);
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: var(--primary);
    flex-shrink: 0;
}

.resize-settings {
    padding-left: 24px;
    margin-top: 6px;
}

/* ===== Buttons ===== */
.calc-btn {
    width: 100%;
    padding: 12px;
    font-size: 0.95rem;
    font-weight: 700;
    font-family: inherit;
    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: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;
}

/* ===== Statistics ===== */
.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 18px;
    box-shadow: var(--shadow);
}

.stat-card.highlight {
    background: var(--primary);
    border-color: var(--primary);
}

.stat-card.highlight .stat-label {
    color: rgba(255, 255, 255, 0.8);
}

.stat-card.highlight .stat-value {
    color: white;
}

.stat-label {
    display: block;
    font-size: 0.65rem;
    font-weight: 500;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-value {
    display: block;
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.02em;
}

/* ===== Image List ===== */
.image-list {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px;
    box-shadow: var(--shadow);
    max-height: 380px;
    overflow-y: auto;
}

.empty-state {
    text-align: center;
    padding: 30px 20px;
    color: var(--text-muted);
}

.empty-icon svg {
    width: 48px;
    height: 48px;
    margin-bottom: 12px;
    color: var(--text-muted);
}

.empty-state p {
    font-size: 0.9rem;
}

.image-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    transition: var(--transition);
}

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

.image-item:hover {
    background: var(--bg);
    border-radius: 8px;
}

.image-item .preview {
    width: 52px;
    height: 52px;
    border-radius: 8px;
    object-fit: cover;
    border: 1px solid var(--border);
    flex-shrink: 0;
}

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

.image-item .info .name {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.image-item .info .size {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.image-item .info .status {
    font-size: 0.75rem;
    font-weight: 600;
    margin-top: 2px;
}

.image-item .info .status.success {
    color: #10b981;
}

.image-item .info .status.error {
    color: #ef4444;
}

.image-item .info .status.processing {
    color: #f59e0b;
}

.image-item .actions {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

.image-item .actions button {
    padding: 4px 10px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg);
    font-size: 0.75rem;
    cursor: pointer;
    transition: var(--transition);
    font-family: inherit;
    color: var(--text-secondary);
}

.image-item .actions .download-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-light);
}

.image-item .actions .remove-btn:hover {
    border-color: #ef4444;
    color: #ef4444;
    background: #fef2f2;
}

/* ===== Result Actions ===== */
.result-actions {
    display: flex;
    gap: 10px;
}

.result-action-btn {
    padding: 10px 20px;
    border: 1.5px solid var(--border);
    border-radius: 8px;
    background: var(--bg);
    font-family: inherit;
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
    flex: 1;
    text-align: center;
}

.result-action-btn:hover {
    border-color: var(--text-secondary);
    color: var(--text);
}

.result-action-btn.primary {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

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

/* ===== 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 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);
}

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

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

    .stats-grid {
        grid-template-columns: 1fr 1fr;
    }
    
    .resize-inputs {
        grid-template-columns: 1fr;
    }
    
    .result-actions {
        flex-direction: column;
    }
}

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

    .calc-form {
        padding: 16px;
    }
    
    .upload-area {
        padding: 24px 16px;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .image-item {
        flex-wrap: wrap;
    }
    
    .image-item .actions {
        width: 100%;
        justify-content: flex-end;
    }
    
    .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) {
    .stat-value {
        font-size: 1rem;
    }
    
    .upload-icon svg {
        width: 36px;
        height: 36px;
    }
}