/* ===== tool-wrapper (base) ===== */
.tool-wrapper.unlock-wrapper {
    max-width: 1200px;
    margin: 0 auto;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    color: #2d3748;
}

/* ===== Upload Area (shared pattern) ===== */
.upload-area {
    border: 2px dashed #cbd5e0;
    border-radius: 0.9rem;
    padding: 2.4rem 1.5rem;
    text-align: center;
    cursor: pointer;
    background: #fafbfc;
    transition: border-color 0.15s, background 0.15s;
    margin-bottom: 1.5rem;
}
.upload-area:hover, .upload-area.dragover { border-color: #3182ce; background: #ebf8ff; }
.upload-icon { font-size: 2.6rem; color: #cbd5e0; margin-bottom: 0.6rem; }
.upload-text { font-weight: 600; font-size: 1.05rem; margin-bottom: 0.3rem; }
.upload-hint { color: #718096; font-size: 0.85rem; margin-bottom: 1rem; }
.upload-btn {
    background: #3182ce; color: #fff; border: none; padding: 0.55rem 1.4rem;
    border-radius: 2rem; font-weight: 600; cursor: pointer; display: inline-flex;
    align-items: center; gap: 0.4rem;
}
.upload-btn:hover { background: #2b6cb0; }

/* ===== Password prompt ===== */
.password-area {
    display: flex; justify-content: center; padding: 1.4rem 1rem 2rem;
    margin-bottom: 1.5rem;
}
.password-card {
    width: 100%; max-width: 420px; background: #fff; border: 1px solid #e2e8f0;
    border-radius: 0.9rem; box-shadow: 0 4px 18px rgba(0,0,0,0.06);
    padding: 2rem 1.6rem; text-align: center;
}
.password-icon {
    width: 3.2rem; height: 3.2rem; border-radius: 50%; background: #ebf8ff; color: #3182ce;
    font-size: 1.3rem; display: flex; align-items: center; justify-content: center;
    margin: 0 auto 0.9rem;
}
.password-title { font-weight: 700; font-size: 1.08rem; margin-bottom: 0.4rem; }
.password-hint { color: #718096; font-size: 0.85rem; line-height: 1.5; margin-bottom: 1.2rem; }
.password-input-wrap { position: relative; margin-bottom: 0.8rem; }
.password-input-wrap input[type="password"],
.password-input-wrap input[type="text"] {
    width: 100%; box-sizing: border-box; padding: 0.65rem 2.6rem 0.65rem 0.9rem;
    border: 1px solid #cbd5e0; border-radius: 0.5rem; font-size: 0.95rem; color: #2d3748;
}
.password-input-wrap input:focus { outline: none; border-color: #3182ce; box-shadow: 0 0 0 3px rgba(49,130,206,0.15); }
.password-toggle-visibility {
    position: absolute; top: 50%; right: 0.6rem; transform: translateY(-50%);
    background: none; border: none; color: #a0aec0; cursor: pointer; padding: 0.3rem;
}
.password-toggle-visibility:hover { color: #4a5568; }
.password-error {
    display: flex; align-items: center; gap: 0.4rem; color: #c53030; background: #fff5f5;
    border: 1px solid #feb2b2; border-radius: 0.5rem; padding: 0.5rem 0.7rem;
    font-size: 0.82rem; margin-bottom: 0.8rem; text-align: start;
}
.password-actions { display: flex; align-items: center; justify-content: center; gap: 0.6rem; }
.password-actions .btn-flat {
    background: transparent; border: 1px solid #e2e8f0; color: #4a5568;
    padding: 0.55rem 1.2rem; border-radius: 2rem; font-weight: 600; cursor: pointer;
}
.password-actions .btn-flat:hover { background: #f7fafc; }
.password-actions .upload-btn { padding: 0.55rem 1.6rem; }

/* ===== Progress / processing state ===== */
.progress-area {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 0.6rem; padding: 3rem 1.5rem; background: #fafbfc; border: 1px solid #e2e8f0;
    border-radius: 0.9rem; margin-bottom: 1.5rem;
}
.progress-spinner { font-size: 1.8rem; color: #3182ce; }
.progress-text { font-weight: 600; color: #4a5568; }
.progress-bar-track {
    width: 100%; max-width: 360px; height: 8px; border-radius: 999px;
    background: #e2e8f0; overflow: hidden; margin-top: 0.4rem;
}
.progress-bar-fill {
    height: 100%; width: 0%; background: linear-gradient(90deg,#3182ce,#38bdf8);
    border-radius: 999px; transition: width 0.2s ease;
}

/* ===================================================== */
/* Unlock App shell                                       */
/* ===================================================== */
.unlock-app {
    border: 1px solid #d7dde5;
    border-radius: 0.6rem;
    overflow: hidden;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    margin-bottom: 1.5rem;
}

/* ===== Top Toolbar ===== */
.app-toolbar {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    flex-wrap: wrap;
    background: #f7f8fa;
    border-bottom: 1px solid #e2e8f0;
    padding: 0.5rem 0.7rem;
}
.toolbar-group { display: flex; align-items: center; gap: 0.25rem; }
.toolbar-sep { width: 1px; height: 1.5rem; background: #e2e8f0; margin: 0 0.35rem; flex: 0 0 auto; }
.toolbar-sep-push { margin-left: auto; }

.icon-btn {
    width: 2.1rem; height: 2.1rem; border-radius: 0.4rem;
    border: 1px solid transparent; background: transparent; color: #4a5568;
    cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
    transition: background 0.15s, border-color 0.15s; flex: 0 0 auto; font-size: 0.95rem;
}
.icon-btn:hover { background: #edf2f7; border-color: #e2e8f0; }
.icon-btn:disabled { opacity: 0.4; cursor: not-allowed; background: transparent; }
.icon-btn.btn-danger-icon:hover { background: #fff5f5; color: #c53030; border-color: #feb2b2; }
.icon-btn-primary { background: #3182ce; color: #fff; border-color: #3182ce; }
.icon-btn-primary:hover { background: #2b6cb0; color: #fff; }
.icon-btn-wide { width: auto; padding: 0 0.9rem; gap: 0.45rem; }
.icon-btn-label { font-size: 0.85rem; font-weight: 600; }

/* ===== Success note ===== */
.unlock-success-note {
    display: flex; align-items: center; gap: 0.5rem;
    background: #f0fff4; color: #276749; border-bottom: 1px solid #c6f6d5;
    padding: 0.6rem 0.9rem; font-size: 0.88rem; font-weight: 600;
}
.unlock-success-note i { color: #38a169; font-size: 1rem; }

/* ===== Page thumbnails (read-only preview) ===== */
.pages-viewport {
    background: #eef1f5;
    min-height: 260px;
    max-height: 70vh;
    overflow: auto;
    padding: 1.2rem;
}
.pages-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 1rem;
}
.page-thumb-card {
    background: #fff;
    border-radius: 0.5rem;
    box-shadow: 0 1px 4px rgba(0,0,0,0.12);
    overflow: hidden;
    position: relative;
}
.page-thumb-preview {
    background: #fff;
    display: flex; align-items: center; justify-content: center;
    overflow: hidden;
}
.page-thumb-preview img { width: 100%; height: 100%; object-fit: contain; display: block; }
.page-thumb-index {
    position: absolute; bottom: 0.35rem; right: 0.35rem;
    background: rgba(0,0,0,0.6); color: #fff; font-size: 0.68rem; font-weight: 700;
    border-radius: 999px; padding: 0.05rem 0.5rem;
}

/* ===== Status text (shared) ===== */
.compression-stats {
    background: #f7fafc; padding: 0.5rem 1rem; border-radius: 0.5rem;
    margin-bottom: 1rem; font-size: 0.95rem; color: #4a5568;
}

/* ===== Hidden ===== */
.hidden { display: none !important; }

/* ===== RTL ===== */
[dir="rtl"] .password-toggle-visibility { right: auto; left: 0.6rem; }
[dir="rtl"] .password-input-wrap input { padding: 0.65rem 0.9rem 0.65rem 2.6rem; }
[dir="rtl"] .page-thumb-index { right: auto; left: 0.35rem; }
[dir="rtl"] .toolbar-sep-push { margin-left: 0; margin-right: auto; }

/* ===== Responsive ===== */
@media (max-width: 860px) {
    .app-toolbar { justify-content: center; }
    .toolbar-sep-push { margin-left: 0; }
    [dir="rtl"] .toolbar-sep-push { margin-right: 0; }
    .pages-viewport { padding: 0.8rem; min-height: 200px; }
    .pages-grid { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); }
    .password-card { padding: 1.6rem 1.2rem; }
}