/* ============================================
   PDF Toolkit - Dark Sci-Fi Theme
   ============================================ */

:root {
    --bg-primary:    #0a0e17;
    --bg-secondary:  #111827;
    --bg-card:       rgba(17, 24, 39, 0.8);
    --bg-glass:      rgba(255, 255, 255, 0.03);
    --bg-input:      rgba(255, 255, 255, 0.05);

    --text-primary:   #e2e8f0;
    --text-secondary: #94a3b8;
    --text-muted:     #64748b;

    --accent-cyan:    #00d4ff;
    --accent-blue:    #3b82f6;
    --accent-glow:    rgba(0, 212, 255, 0.15);

    --border-subtle:  rgba(255, 255, 255, 0.08);
    --border-accent:  rgba(0, 212, 255, 0.3);

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;

    --shadow-glow:  0 0 20px rgba(0, 212, 255, 0.1);
    --shadow-card:  0 4px 24px rgba(0, 0, 0, 0.3);

    --container-max: 1200px;
    --grid-gap: 24px;
    --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;

    --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

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

body {
    font-family: var(--font);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
}

/* Animated grid background */
.bg-grid {
    position: fixed;
    inset: 0;
    z-index: 0;
    background-image:
        linear-gradient(rgba(0, 212, 255, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 212, 255, 0.03) 1px, transparent 1px);
    background-size: 60px 60px;
    pointer-events: none;
}

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

/* ---- Navbar ---- */
.navbar {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(10, 14, 23, 0.85);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-subtle);
}

.navbar-inner {
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 0 24px;
    height: 64px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.nav-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-primary);
    font-weight: 700;
    font-size: 1.2rem;
    transition: var(--transition);
}
.nav-logo:hover { color: var(--accent-cyan); }

.logo-icon {
    display: flex;
    align-items: center;
    color: var(--accent-cyan);
    filter: drop-shadow(0 0 8px rgba(0, 212, 255, 0.4));
}

.logo-text { letter-spacing: -0.5px; }
.logo-highlight { color: var(--accent-cyan); }

.nav-breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
}
.breadcrumb-sep { color: var(--text-muted); }

/* ---- Container ---- */
.container {
    position: relative;
    z-index: 1;
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 40px 24px;
}

/* ---- Hero Section ---- */
.hero {
    text-align: center;
    padding: 60px 0 48px;
}

.hero h1 {
    font-size: 3rem;
    font-weight: 700;
    letter-spacing: -1px;
    background: linear-gradient(135deg, #fff 0%, var(--accent-cyan) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 12px;
}

.hero-subtitle {
    font-size: 1.15rem;
    color: var(--text-secondary);
    font-weight: 300;
}

/* ---- Tools Grid ---- */
.tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: var(--grid-gap);
    padding-bottom: 60px;
}

.tool-card {
    --card-accent: var(--accent-cyan);
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 36px 24px 28px;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    color: var(--text-primary);
    transition: all var(--transition);
    cursor: pointer;
    overflow: hidden;
}

.tool-card::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: var(--radius-lg);
    padding: 1px;
    background: linear-gradient(135deg, transparent 40%, var(--card-accent));
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    opacity: 0;
    transition: opacity var(--transition);
}

.tool-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.4), 0 0 30px color-mix(in srgb, var(--card-accent), transparent 85%);
    border-color: color-mix(in srgb, var(--card-accent), transparent 60%);
}

.tool-card:hover::before { opacity: 1; }

.tool-card-icon {
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    background: color-mix(in srgb, var(--card-accent), transparent 88%);
    color: var(--card-accent);
    margin-bottom: 16px;
    transition: var(--transition);
}

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

.tool-card:hover .tool-card-icon {
    background: color-mix(in srgb, var(--card-accent), transparent 78%);
    box-shadow: 0 0 20px color-mix(in srgb, var(--card-accent), transparent 70%);
}

.tool-card-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 8px;
}

.tool-card-desc {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* ---- Tool Page Layout ---- */
.tool-page {
    max-width: 720px;
    margin: 0 auto;
}

.tool-header {
    text-align: center;
    margin-bottom: 36px;
}

.tool-header h2 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 8px;
}

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

/* ---- Upload Zone ---- */
.upload-zone {
    position: relative;
    border: 2px dashed var(--border-accent);
    border-radius: var(--radius-lg);
    padding: 48px 24px;
    text-align: center;
    cursor: pointer;
    transition: all var(--transition);
    background: var(--bg-glass);
    margin-bottom: 24px;
}

.upload-zone:hover,
.upload-zone.drag-over {
    border-color: var(--accent-cyan);
    background: rgba(0, 212, 255, 0.05);
    box-shadow: 0 0 30px rgba(0, 212, 255, 0.1) inset;
}

.upload-zone.has-files {
    padding: 24px;
    border-style: solid;
    border-color: rgba(0, 212, 255, 0.2);
}

.upload-zone-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.upload-icon {
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(0, 212, 255, 0.1);
    color: var(--accent-cyan);
    margin-bottom: 8px;
}

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

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

.upload-hint {
    font-size: 0.8rem !important;
    color: var(--text-muted) !important;
}

/* File List */
.file-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
}

.file-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--bg-input);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-subtle);
    transition: var(--transition);
}

.file-item:hover { border-color: rgba(255, 255, 255, 0.15); }

.file-item.dragging {
    opacity: 0.5;
    border-color: var(--accent-cyan);
}

.file-item-icon {
    color: var(--accent-cyan);
    flex-shrink: 0;
}

.file-item-name {
    flex: 1;
    font-size: 0.9rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-item-size {
    color: var(--text-muted);
    font-size: 0.8rem;
    flex-shrink: 0;
}

.file-item-handle {
    cursor: grab;
    color: var(--text-muted);
    padding: 4px;
}
.file-item-handle:active { cursor: grabbing; }

.file-item-remove {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: var(--transition);
    display: flex;
}
.file-item-remove:hover { color: #ef4444; background: rgba(239, 68, 68, 0.1); }

.file-list-add {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px;
    border: 1px dashed var(--border-subtle);
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-size: 0.85rem;
    cursor: pointer;
    transition: var(--transition);
}
.file-list-add:hover {
    border-color: var(--accent-cyan);
    color: var(--accent-cyan);
}

.page-info {
    text-align: center;
    padding: 12px;
    color: var(--accent-cyan);
    font-size: 0.9rem;
    background: rgba(0, 212, 255, 0.05);
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
}

/* ---- Options Panel ---- */
.options-panel {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 28px;
    margin-bottom: 24px;
}

.options-panel h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 20px;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.options-panel h3::before {
    content: '';
    width: 3px;
    height: 16px;
    background: var(--accent-cyan);
    border-radius: 2px;
}

.option-group {
    margin-bottom: 20px;
}
.option-group:last-child { margin-bottom: 0; }

.option-label {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.option-row {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
}

/* Inputs */
input[type="text"],
input[type="number"],
input[type="password"],
textarea,
select {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: var(--font);
    font-size: 0.9rem;
    transition: var(--transition);
    outline: none;
}

input:focus, textarea:focus, select:focus {
    border-color: var(--accent-cyan);
    box-shadow: 0 0 0 3px rgba(0, 212, 255, 0.1);
}

input[type="color"] {
    width: 44px;
    height: 38px;
    padding: 2px;
    background: var(--bg-input);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    cursor: pointer;
}

select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%2394a3b8' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

textarea {
    resize: vertical;
    min-height: 80px;
}

/* Range slider */
input[type="range"] {
    -webkit-appearance: none;
    width: 100%;
    height: 6px;
    background: var(--bg-input);
    border-radius: 3px;
    outline: none;
    border: none;
    padding: 0;
}
input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--accent-cyan);
    cursor: pointer;
    box-shadow: 0 0 8px rgba(0, 212, 255, 0.4);
}

.range-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.range-value {
    min-width: 40px;
    text-align: right;
    font-size: 0.85rem;
    color: var(--accent-cyan);
    font-weight: 600;
}

/* Radio & Checkbox groups */
.radio-group,
.checkbox-group {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.radio-btn,
.check-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: var(--bg-input);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.85rem;
    color: var(--text-secondary);
    transition: var(--transition);
}

.radio-btn:hover, .check-btn:hover {
    border-color: rgba(255, 255, 255, 0.15);
}

.radio-btn input, .check-btn input { display: none; }

.radio-btn.active,
.check-btn.active {
    border-color: var(--accent-cyan);
    color: var(--accent-cyan);
    background: rgba(0, 212, 255, 0.08);
}

/* Position selector (6-grid) */
.position-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    width: 180px;
    padding: 12px;
    background: var(--bg-input);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
}

.position-btn {
    width: 100%;
    aspect-ratio: 2 / 1;
    border: 1px solid var(--border-subtle);
    border-radius: 4px;
    background: transparent;
    cursor: pointer;
    transition: var(--transition);
    color: var(--text-muted);
    font-size: 0.65rem;
}

.position-btn:hover { border-color: var(--accent-cyan); color: var(--text-secondary); }

.position-btn.active {
    background: rgba(0, 212, 255, 0.15);
    border-color: var(--accent-cyan);
    color: var(--accent-cyan);
}

/* Toggle tabs */
.tab-group {
    display: flex;
    background: var(--bg-input);
    border-radius: var(--radius-sm);
    padding: 3px;
    gap: 3px;
}

.tab-btn {
    flex: 1;
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: var(--text-muted);
    font-family: var(--font);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

.tab-btn:hover { color: var(--text-secondary); }

.tab-btn.active {
    background: rgba(0, 212, 255, 0.12);
    color: var(--accent-cyan);
}

.tab-content { display: none; }
.tab-content.active { display: block; }

/* Permissions grid */
.permissions-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

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

/* ---- Buttons ---- */
.action-bar {
    margin-bottom: 24px;
}

.btn-process {
    width: 100%;
    padding: 16px 32px;
    background: linear-gradient(135deg, var(--accent-cyan), var(--accent-blue));
    border: none;
    border-radius: var(--radius-md);
    color: #fff;
    font-family: var(--font);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-process:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 212, 255, 0.3);
}

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

/* Spinner */
.btn-loader {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ---- Result Panel ---- */
.result-panel {
    background: var(--bg-card);
    border: 1px solid rgba(16, 185, 129, 0.3);
    border-radius: var(--radius-lg);
    padding: 32px;
    text-align: center;
}

.result-success {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.result-icon {
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(16, 185, 129, 0.15);
    color: #10b981;
}

.result-success p {
    font-size: 1.05rem;
    font-weight: 500;
}

.btn-download {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 14px 32px;
    background: linear-gradient(135deg, #10b981, #059669);
    border: none;
    border-radius: var(--radius-md);
    color: #fff;
    font-family: var(--font);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    text-decoration: none;
}

.btn-download:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(16, 185, 129, 0.3);
    color: #fff;
}

/* Multi-download (split) */
.download-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
}

.btn-download-sm {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 20px;
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.3);
    border-radius: var(--radius-sm);
    color: #10b981;
    font-size: 0.9rem;
    font-weight: 500;
    text-decoration: none;
    transition: var(--transition);
}
.btn-download-sm:hover {
    background: rgba(16, 185, 129, 0.2);
    color: #10b981;
}

/* ---- Split Ranges ---- */
.range-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.range-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.range-item input[type="number"] {
    width: 80px;
}

.range-item span {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.btn-sm {
    padding: 6px 12px;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    background: var(--bg-input);
    color: var(--text-secondary);
    font-family: var(--font);
    font-size: 0.8rem;
    cursor: pointer;
    transition: var(--transition);
}
.btn-sm:hover {
    border-color: var(--accent-cyan);
    color: var(--accent-cyan);
}

.btn-sm.danger:hover {
    border-color: #ef4444;
    color: #ef4444;
}

/* ---- Image Upload (secondary) ---- */
.image-upload-zone {
    position: relative;
    border: 1px dashed var(--border-accent);
    border-radius: var(--radius-sm);
    padding: 20px;
    text-align: center;
    cursor: pointer;
    transition: all var(--transition);
    background: var(--bg-glass);
}

.image-upload-zone:hover {
    border-color: var(--accent-cyan);
    background: rgba(0, 212, 255, 0.03);
}

.image-upload-zone p {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.image-preview {
    max-width: 200px;
    max-height: 100px;
    object-fit: contain;
    border-radius: 4px;
}

/* Password toggle */
.password-wrapper {
    position: relative;
}

.password-wrapper input { padding-right: 44px; }

.password-toggle {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    display: flex;
}
.password-toggle:hover { color: var(--text-secondary); }

/* Header/Footer 3-column */
.hf-row {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 8px;
}

.hf-row input::placeholder {
    font-size: 0.8rem;
}

/* ---- Footer ---- */
.site-footer {
    position: relative;
    z-index: 1;
    text-align: center;
    padding: 24px;
    color: var(--text-muted);
    font-size: 0.8rem;
    border-top: 1px solid var(--border-subtle);
}

/* ---- Error/Alert ---- */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    margin-bottom: 16px;
}
.alert-error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #fca5a5;
}

/* ---- Responsive ---- */
@media (max-width: 640px) {
    .hero h1 { font-size: 2rem; }
    .hero { padding: 40px 0 32px; }
    .tools-grid { grid-template-columns: 1fr; gap: 16px; }
    .container { padding: 24px 16px; }
    .options-panel { padding: 20px 16px; }
    .tool-header h2 { font-size: 1.5rem; }
    .hf-row { grid-template-columns: 1fr; }
    .permissions-grid { grid-template-columns: 1fr; }
    .option-row { flex-direction: column; align-items: stretch; }
}
