/* ========================================
   LocalPapa Tools - Shared Styles
   For independent tool landing pages
   ======================================== */

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

html { font-size: 16px; scroll-behavior: smooth; }

body {
    font-family: 'Inter', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
    display: flex;
    flex-direction: column;
}

a { color: #667eea; text-decoration: none; }
a:hover { text-decoration: underline; }

img, video, iframe, canvas, svg { max-width: 100%; height: auto; }

/* ======== Top Navigation Bar ======== */
.tool-navbar {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    padding: 12px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 100;
}

.navbar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: #667eea;
    font-weight: 700;
    font-size: 1.25rem;
}

.navbar-brand img {
    width: 32px;
    height: 32px;
    border-radius: 6px;
}

.navbar-brand:hover { text-decoration: none; opacity: 0.85; }

.navbar-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.nav-btn {
    background: rgba(102, 126, 234, 0.1);
    border: none;
    border-radius: 8px;
    padding: 8px 16px;
    cursor: pointer;
    color: #667eea;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.2s;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.nav-btn:hover {
    background: rgba(102, 126, 234, 0.2);
    text-decoration: none;
    transform: translateY(-1px);
}

/* ======== Breadcrumb ======== */
.breadcrumb {
    padding: 12px 24px;
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.8);
    max-width: 900px;
    margin: 0 auto;
    width: 100%;
}

.breadcrumb a {
    color: rgba(255, 255, 255, 0.9);
    text-decoration: none;
}

.breadcrumb a:hover { text-decoration: underline; }

.breadcrumb span { margin: 0 6px; opacity: 0.6; }

/* ======== Main Tool Container ======== */
.tool-page {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0 16px 40px;
}

.tool-header {
    text-align: center;
    color: white;
    padding: 30px 20px 20px;
    max-width: 700px;
}

.tool-header h1 {
    font-size: 2rem;
    margin-bottom: 8px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

.tool-header .subtitle {
    font-size: 1.1rem;
    opacity: 0.9;
}

.tool-body {
    background: white;
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    width: 100%;
    max-width: 800px;
}

/* ======== Privacy Badge ======== */
.privacy-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(72, 187, 120, 0.15);
    color: #276749;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    margin-top: 12px;
}

.privacy-badge i { color: #48bb78; }

/* ======== Upload / Drop Zone ======== */
.upload-area {
    border: 3px dashed #cbd5e0;
    border-radius: 20px;
    padding: 40px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: #f8f9fa;
}

.upload-area:hover, .upload-area.dragover {
    border-color: #667eea;
    background: #eef2ff;
    transform: scale(1.01);
}

.upload-area .upload-icon {
    font-size: 3.5rem;
    margin-bottom: 12px;
    display: block;
}

.upload-area h3 {
    font-size: 1.15rem;
    color: #4a5568;
    margin-bottom: 8px;
}

.upload-area p { color: #718096; font-size: 0.9rem; }

/* ======== Action Buttons ======== */
.action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    color: white;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.action-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.action-btn:disabled {
    background: #a0aec0;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.action-btn.danger { background: #e53e3e; }
.action-btn.success { background: #48bb78; }

.text-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.9rem;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.2s;
}

.text-btn.danger { color: #e53e3e; }
.text-btn.danger:hover { background: #fff5f5; }

/* ======== Item List (for merge/img list) ======== */
.item-list {
    list-style: none;
    max-height: 300px;
    overflow-y: auto;
}

.item-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    border-bottom: 1px solid #f0f0f0;
    transition: background 0.2s;
}

.item-row:hover { background: #f7fafc; }

.file-name {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    color: #2d3748;
}

/* ======== Process Status ======== */
.process-info {
    margin-top: 20px;
    display: none;
    text-align: center;
    padding: 20px;
    background: #f0fff4;
    border-radius: 12px;
    border: 1px solid #c6f6d5;
}

.process-info.error {
    background: #fff5f5;
    border-color: #fed7d7;
}

.process-info .status-icon {
    font-size: 2rem;
    margin-bottom: 10px;
    color: #48bb78;
}

.process-info.error .status-icon { color: #e53e3e; }

.process-info .status-msg {
    font-weight: 600;
    color: #2f855a;
}

.process-info.error .status-msg { color: #c53030; }

.download-link {
    display: none;
    margin-top: 10px;
    padding: 10px 20px;
    background: #48bb78;
    color: white;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.2s;
}

.download-link:hover { background: #38a169; text-decoration: none; }

/* ======== Form Controls ======== */
.form-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 12px;
    flex-wrap: wrap;
    justify-content: center;
}

.form-row label { font-weight: 500; color: #4a5568; margin: 0; }

.form-input {
    padding: 8px 12px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 0.95rem;
    transition: border-color 0.2s;
}

.form-input:focus {
    outline: none;
    border-color: #667eea;
}

/* ======== PDF Page Grid ======== */
.page-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(55px, 1fr));
    gap: 10px;
    max-height: 400px;
    overflow-y: auto;
    padding: 5px;
}

.pdf-page-item {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 55px;
    background: #f7fafc;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    cursor: pointer;
    font-weight: bold;
    color: #4a5568;
    transition: all 0.2s;
    user-select: none;
}

.pdf-page-item:hover {
    border-color: #cbd5e0;
    transform: translateY(-2px);
}

.pdf-page-item.deleted {
    background: #fff5f5;
    border-color: #fc8181;
    color: #e53e3e;
    text-decoration: line-through;
    opacity: 0.8;
}

/* ======== Editor Panel ======== */
.editor-panel {
    display: none;
    margin-top: 20px;
    background: #f7fafc;
    border-radius: 12px;
    padding: 20px;
    border: 1px solid #e2e8f0;
}

.editor-panel h3 {
    font-size: 1.1rem;
    margin-bottom: 10px;
    color: #2d3748;
}

.editor-panel p { color: #718096; margin-bottom: 15px; }

/* ======== Code / Textarea ======== */
.code-editor {
    width: 100%;
    min-height: 200px;
    font-family: 'Fira Code', 'Consolas', monospace;
    font-size: 0.9rem;
    padding: 16px;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    resize: vertical;
    background: #fafafa;
    color: #2d3748;
    line-height: 1.5;
}

.code-editor:focus {
    outline: none;
    border-color: #667eea;
}

/* ======== How-To Steps ======== */
.how-to {
    margin-top: 30px;
    padding-top: 24px;
    border-top: 1px solid #e2e8f0;
}

.how-to h2 {
    font-size: 1.3rem;
    color: #2d3748;
    margin-bottom: 16px;
}

.steps {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

.step {
    flex: 1;
    min-width: 180px;
    text-align: center;
    padding: 16px;
    background: #f7fafc;
    border-radius: 12px;
}

.step-number {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    margin-bottom: 8px;
}

.step h3 { font-size: 0.95rem; color: #2d3748; margin-bottom: 4px; }
.step p { font-size: 0.85rem; color: #718096; }

/* ======== FAQ Section ======== */
.faq-section {
    margin-top: 30px;
    padding-top: 24px;
    border-top: 1px solid #e2e8f0;
}

.faq-section h2 {
    font-size: 1.3rem;
    color: #2d3748;
    margin-bottom: 16px;
}

.faq-item {
    margin-bottom: 12px;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    overflow: hidden;
}

.faq-q {
    padding: 14px 16px;
    font-weight: 600;
    color: #2d3748;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f7fafc;
    transition: background 0.2s;
}

.faq-q:hover { background: #eef2ff; }

.faq-q::after {
    content: '+';
    font-size: 1.2rem;
    color: #667eea;
    transition: transform 0.2s;
}

.faq-item.open .faq-q::after {
    content: '−';
}

.faq-a {
    padding: 0 16px;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease, padding 0.3s ease;
    color: #4a5568;
    line-height: 1.6;
    font-size: 0.95rem;
}

.faq-item.open .faq-a {
    padding: 14px 16px;
    max-height: 500px;
}

/* ======== Related Tools Grid ======== */
.related-tools {
    margin-top: 30px;
    padding-top: 24px;
    border-top: 1px solid #e2e8f0;
}

.related-tools h2 {
    font-size: 1.3rem;
    color: #2d3748;
    margin-bottom: 16px;
}

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

.related-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 16px 10px;
    background: #f7fafc;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    text-decoration: none;
    color: #2d3748;
    transition: all 0.2s;
    text-align: center;
}

.related-card:hover {
    border-color: #667eea;
    transform: translateY(-3px);
    box-shadow: 0 6px 16px rgba(102, 126, 234, 0.15);
    text-decoration: none;
}

.related-card i { font-size: 1.8rem; color: #667eea; }
.related-card span { font-size: 0.85rem; font-weight: 500; }

/* ======== Footer ======== */
.tool-footer {
    background: rgba(0, 0, 0, 0.15);
    padding: 30px 24px;
    text-align: center;
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.85rem;
}

.footer-links {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 16px;
    margin-bottom: 12px;
}

.footer-links a {
    color: rgba(255, 255, 255, 0.85);
    text-decoration: none;
    font-size: 0.85rem;
}

.footer-links a:hover { color: white; text-decoration: underline; }

.footer-copy { opacity: 0.6; }

/* ======== Dark Theme ======== */
body.dark {
    background: #1a1a2e;
}

body.dark .tool-navbar {
    background: rgba(30, 30, 50, 0.95);
}

body.dark .navbar-brand { color: #a0b4f0; }

body.dark .nav-btn {
    background: rgba(160, 180, 240, 0.1);
    color: #a0b4f0;
}

body.dark .tool-body {
    background: #2d2d44;
    color: #e2e8f0;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

body.dark .upload-area {
    background: #252540;
    border-color: #4a4a6a;
}

body.dark .upload-area:hover,
body.dark .upload-area.dragover {
    border-color: #667eea;
    background: #2a2a4a;
}

body.dark .upload-area h3 { color: #e2e8f0; }
body.dark .upload-area p { color: #a0aec0; }

body.dark .editor-panel {
    background: #252540;
    border-color: #4a4a6a;
}

body.dark .editor-panel h3 { color: #e2e8f0; }
body.dark .editor-panel p { color: #a0aec0; }

body.dark .pdf-page-item {
    background: #252540;
    border-color: #4a4a6a;
    color: #e2e8f0;
}

body.dark .pdf-page-item.deleted {
    background: #3d2020;
    border-color: #e53e3e;
}

body.dark .code-editor {
    background: #1e1e32;
    border-color: #4a4a6a;
    color: #e2e8f0;
}

body.dark .form-input {
    background: #252540;
    border-color: #4a4a6a;
    color: #e2e8f0;
}

body.dark .how-to h2,
body.dark .faq-section h2,
body.dark .related-tools h2 { color: #e2e8f0; }

body.dark .step { background: #252540; }
body.dark .step h3 { color: #e2e8f0; }
body.dark .step p { color: #a0aec0; }

body.dark .faq-item { border-color: #4a4a6a; }
body.dark .faq-q { background: #252540; color: #e2e8f0; }
body.dark .faq-q:hover { background: #2a2a4a; }
body.dark .faq-a { color: #a0aec0; }

body.dark .related-card {
    background: #252540;
    border-color: #4a4a6a;
    color: #e2e8f0;
}

body.dark .related-card:hover {
    border-color: #667eea;
}

body.dark .process-info {
    background: #1e3a2e;
    border-color: #276749;
}

body.dark .process-info.error {
    background: #3d2020;
    border-color: #c53030;
}

body.dark .item-row { border-bottom-color: #4a4a6a; }
body.dark .item-row:hover { background: #2a2a4a; }
body.dark .file-name { color: #e2e8f0; }

body.dark .privacy-badge {
    background: rgba(72, 187, 120, 0.1);
    color: #68d391;
}

body.dark .tool-footer {
    background: rgba(0, 0, 0, 0.3);
}

/* ======== Responsive ======== */
@media (max-width: 600px) {
    .tool-header h1 { font-size: 1.5rem; }
    .tool-body { padding: 16px; border-radius: 14px; }
    .steps { flex-direction: column; }
    .related-grid { grid-template-columns: repeat(2, 1fr); }
    .navbar-brand span { display: none; }
}

@media (min-width: 800px) {
    .tool-header h1 { font-size: 2.5rem; }
    .tool-body { padding: 40px; }
}
