/* Mr.Chip PDF - Main Stylesheet */
:root {
    --bg-primary: #030712;
    --bg-secondary: #0f172a;
    --bg-card: #1e293b;
    --bg-card-hover: #263548;
    --bg-input: #0f172a;
    --border-color: #334155;
    --border-hover: #475569;
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --accent: #6366f1;
    --accent-hover: #4f46e5;
    --accent-light: rgba(99, 102, 241, 0.1);
    --success: #22c55e;
    --error: #ef4444;
    --radius: 12px;
    --radius-lg: 16px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

.container { max-width: 1200px; margin: 0 auto; padding: 0 1.5rem; }

/* Navbar */
.navbar {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(12px);
}

.navbar-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 64px;
}

.navbar-brand {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
}
.brand-pdftools { font-size: 1.15rem; font-weight: 800; color: #22c55e; }
.brand-sep { font-size: 1.15rem; color: var(--text-muted); }
.brand-coopanest { font-size: 0.85rem; font-weight: 700; color: #22c55e; letter-spacing: 0.5px; }

/* Navbar Menu */
.navbar-menu {
    display: flex;
    align-items: center;
    gap: 0.125rem;
}

.nav-link {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.8125rem;
    font-weight: 500;
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
    transition: all 0.15s ease;
    white-space: nowrap;
}

.nav-link:hover {
    color: var(--text-primary);
    background: var(--accent-light);
}

/* Dropdown / Popup Menu */
.dropdown {
    position: relative;
}

.dropdown-trigger {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 0.8125rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
    font-family: inherit;
}

.dropdown-trigger:hover {
    color: var(--text-primary);
    background: var(--accent-light);
}

.dropdown-arrow {
    transition: transform 0.2s ease;
}

.dropdown:hover .dropdown-arrow {
    transform: rotate(180deg);
}

.dropdown-menu {
    position: absolute;
    top: calc(100% + 4px);
    left: 50%;
    transform: translateX(-50%) translateY(-8px);
    min-width: 280px;
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    z-index: 200;
    transition: all 0.2s ease;
}

.dropdown:hover .dropdown-menu,
.dropdown-menu.open {
    max-height: 70vh;
    overflow-y: auto;
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
    padding: 0.5rem;
}

.dropdown-item {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
    padding: 0.625rem 0.75rem;
    border-radius: 6px;
    text-decoration: none;
    transition: background 0.15s ease;
}

.dropdown-item:hover {
    background: var(--accent-light);
}

.dropdown-item-name {
    color: var(--text-primary);
    font-size: 0.8125rem;
    font-weight: 600;
}

.dropdown-item-desc {
    color: var(--text-muted);
    font-size: 0.7rem;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Mobile */
.mobile-toggle {
    display: none;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.5rem;
}

.mobile-only {
    display: none;
}

@media (max-width: 900px) {
    .mobile-toggle { display: block; }
    .navbar-menu {
        display: none;
        position: absolute;
        top: 64px;
        left: 0;
        right: 0;
        flex-direction: column;
        background: var(--bg-secondary);
        border-bottom: 1px solid var(--border-color);
        padding: 0.5rem 1rem;
        max-height: 80vh;
        overflow-y: auto;
        gap: 0;
    }
    .navbar-menu.open { display: flex; }
    .dropdown { width: 100%; }
    .dropdown-trigger { width: 100%; justify-content: space-between; padding: 0.75rem; }
    .dropdown-menu {
        position: static;
        transform: none;
        max-height: 0;
        opacity: 0;
        visibility: hidden;
        box-shadow: none;
        border: none;
        padding: 0;
        min-width: auto;
    }
    .dropdown-menu.open {
        max-height: 9999px;
        opacity: 1;
        visibility: visible;
        padding: 0 0 0.5rem 0.5rem;
        transform: none;
    }
    .nav-link { display: block; padding: 0.75rem; width: 100%; }
    .mobile-only { display: block; }
}

/* Main Content */
.main-content {
    min-height: calc(100vh - 140px);
    padding: 2rem 0;
}

/* Hero Section */
.hero {
    text-align: center;
    padding: 3rem 0 2rem;
}

.hero-inner {
    max-width: 640px;
}

.hero-title {
    font-size: 2.5rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--accent), #a78bfa);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.75rem;
}

.hero-subtitle {
    font-size: 1.125rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.hero-description {
    font-size: 0.875rem;
    color: var(--text-muted);
}

/* Category Navigation */
.category-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 2.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.category-nav-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    background: var(--bg-card);
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.8125rem;
    font-weight: 500;
    transition: all 0.15s ease;
    border: 1px solid transparent;
}

.category-nav-item:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
    border-color: var(--border-hover);
}

.category-nav-icon {
    width: 16px;
    height: 16px;
    color: var(--accent);
}

.category-nav-icon svg {
    width: 16px;
    height: 16px;
}

/* Category Group */
.category-group {
    margin-bottom: 2.5rem;
}

.category-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.category-header-left {
    flex: 1;
}

.category-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.category-desc {
    font-size: 0.8125rem;
    color: var(--text-muted);
}

.category-count {
    font-size: 0.75rem;
    color: var(--text-muted);
    background: var(--bg-card);
    padding: 0.25rem 0.75rem;
    border-radius: 999px;
    white-space: nowrap;
}

/* Tool Grid */
.tool-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1rem;
}

.tool-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 1.25rem;
    text-decoration: none;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
}

.tool-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--accent);
    opacity: 0;
    transition: opacity 0.2s ease;
}

.tool-card:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-hover);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

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

.tool-card-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: var(--accent-light);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent);
    margin-bottom: 0.25rem;
}

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

.tool-card-title {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--text-primary);
}

.tool-card-desc {
    font-size: 0.8rem;
    color: var(--text-muted);
    line-height: 1.4;
    flex: 1;
}

.tool-card-action {
    font-size: 0.75rem;
    color: var(--accent);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.25rem;
    margin-top: auto;
    padding-top: 0.5rem;
}

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

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.875rem;
    margin-bottom: 1.5rem;
    transition: color 0.15s ease;
}

.back-link:hover {
    color: var(--accent);
}

.tool-header {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 2rem;
}

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

.tool-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.tool-subtitle {
    font-size: 0.875rem;
    color: var(--text-muted);
}

/* Card */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
}

.card-header {
    margin-bottom: 1.5rem;
}

.card-title {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.card-desc {
    font-size: 0.8125rem;
    color: var(--text-muted);
}

/* Tool Form */
.tool-form {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

/* Upload Zone */
.upload-zone {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 200px;
    border: 2px dashed var(--border-color);
    border-radius: var(--radius);
    background: var(--bg-input);
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 2rem;
}

.upload-zone:hover {
    border-color: var(--accent);
    background: var(--accent-light);
}

.upload-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    text-align: center;
}

.upload-icon {
    width: 48px;
    height: 48px;
    color: var(--text-muted);
}

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

.upload-highlight {
    color: var(--accent);
    font-weight: 600;
}

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

.upload-privacy {
    font-size: 0.75rem;
    color: var(--text-muted);
    opacity: 0.7;
}

.upload-input {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}

/* Form Elements */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}

.form-label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.form-input {
    padding: 0.75rem 1rem;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: var(--bg-input);
    color: var(--text-primary);
    font-size: 0.875rem;
    transition: border-color 0.15s ease;
    outline: none;
}

.form-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-light);
}

.form-input::placeholder {
    color: var(--text-muted);
}

.form-range {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: var(--border-color);
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}

.form-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--accent);
    cursor: pointer;
    border: 2px solid var(--bg-primary);
}

.form-hint {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 600;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: all 0.15s ease;
}

.btn-primary {
    background: var(--accent);
    color: white;
}

.btn-primary:hover {
    background: var(--accent-hover);
}

.btn-success {
    background: var(--success);
    color: white;
}

.btn-success:hover {
    background: #16a34a;
}

.btn-lg {
    padding: 0.875rem 1.5rem;
    font-size: 1rem;
}

/* Alerts */
.alert {
    padding: 0.875rem 1rem;
    border-radius: 8px;
    font-size: 0.875rem;
}

.alert-error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #fca5a5;
}

.alert-success {
    background: rgba(34, 197, 94, 0.1);
    border: 1px solid rgba(34, 197, 94, 0.3);
    color: #86efac;
}

/* Info Box */
.info-box {
    display: flex;
    gap: 0.75rem;
    padding: 1rem;
    margin-top: 1.5rem;
    background: var(--bg-input);
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.info-icon {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    color: var(--accent);
}

.info-title {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
}

.info-text {
    font-size: 0.8125rem;
    color: var(--text-muted);
    line-height: 1.5;
}

/* Footer */
.footer {
    border-top: 1px solid var(--border-color);
    padding: 2rem 0;
    text-align: center;
}

.footer-text {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
}

.footer-subtext {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Radio Card */
.radio-card {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1rem;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: var(--bg-input);
    cursor: pointer;
    transition: all 0.15s ease;
    font-size: 0.8125rem;
    color: var(--text-secondary);
}

.radio-card:hover {
    border-color: var(--accent);
}

.radio-card input[type="radio"] {
    accent-color: var(--accent);
}

.radio-card:has(input:checked) {
    border-color: var(--accent);
    background: var(--accent-light);
    color: var(--text-primary);
}

/* Crop Grid */
.crop-grid {
    display: grid;
    grid-template-columns: 1fr 100px 1fr;
    gap: 0.75rem;
    align-items: start;
}

.crop-preview {
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Permission Options */
.perm-option {
    display: flex; align-items: center; gap: 0.5rem;
    padding: 0.5rem; background: var(--bg-input);
    border-radius: 8px; border: 1px solid var(--border-color);
}
.perm-option input[type="checkbox"] { accent-color: var(--accent); width: 18px; height: 18px; }
.perm-option span { color: var(--text-secondary); font-size: 0.875rem; }

/* Processing Overlay */
.processing-overlay {
    position: fixed; inset: 0; z-index: 9999;
    background: rgba(3, 7, 18, 0.85);
    display: flex; align-items: center; justify-content: center;
    backdrop-filter: blur(4px);
}

.processing-modal {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 2.5rem 3rem;
    display: flex; flex-direction: column; align-items: center; gap: 1rem;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.5);
    max-width: 360px; text-align: center;
}

.processing-spinner {
    width: 48px; height: 48px;
    border: 4px solid var(--border-color);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.processing-text {
    font-size: 1.125rem; font-weight: 700;
    color: var(--text-primary); margin: 0;
}

.processing-hint {
    font-size: 0.8125rem; color: var(--text-muted); margin: 0;
    line-height: 1.4;
}

/* Helpers */
.text-center { text-align: center; }
.py-12 { padding-top: 3rem; padding-bottom: 3rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-6 { margin-bottom: 1.5rem; }

/* Responsive */
@media (max-width: 768px) {
    .hero-title { font-size: 1.75rem; }
    .tool-grid { grid-template-columns: 1fr; }
    .category-nav { gap: 0.375rem; }
    .category-nav-item { font-size: 0.75rem; padding: 0.375rem 0.75rem; }
}
