@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Outfit:wght@400;500;600;700;800&display=swap');

:root {
    --bg-color: #07090e;
    --bg-glow: radial-gradient(circle at 50% 0%, #1e1b4b 0%, #07090e 70%);
    --card-bg: rgba(17, 24, 39, 0.75);
    --card-border: rgba(255, 255, 255, 0.08);
    --card-border-glow: rgba(6, 182, 212, 0.15);
    
    --accent-primary: #06b6d4; /* Cyan */
    --accent-secondary: #8b5cf6; /* Violet */
    --accent-gradient: linear-gradient(135deg, #06b6d4 0%, #8b5cf6 100%);
    --accent-gradient-hover: linear-gradient(135deg, #0891b2 0%, #7c3aed 100%);
    
    --text-color: #f8fafc;
    --text-muted: #94a3b8;
    --border-color: #1e293b;
    --success-color: #10b981;
    --warning-color: #f59e0b;
}

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

body {
    font-family: 'Inter', sans-serif;
    background: var(--bg-color);
    background-image: var(--bg-glow);
    background-attachment: fixed;
    color: var(--text-color);
    min-height: 100vh;
    line-height: 1.5;
}

h1, h2, h3, h4, h5, h6 {
    font-family: 'Outfit', sans-serif;
    letter-spacing: -0.02em;
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 8px;
}
::-webkit-scrollbar-track {
    background: #090d16;
}
::-webkit-scrollbar-thumb {
    background: #1e293b;
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: #334155;
}

/* Navbar */
.navbar {
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    background: rgba(9, 13, 22, 0.8);
    border-bottom: 1px solid var(--card-border);
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 1.5rem;
}

.logo {
    font-family: 'Outfit', sans-serif;
    font-size: 1.6rem;
    font-weight: 800;
    text-decoration: none;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.nav-links {
    display: flex;
    gap: 0.75rem;
    overflow-x: auto;
    white-space: nowrap;
    max-width: 100%;
    padding-bottom: 4px;
    -webkit-overflow-scrolling: touch;
}
.nav-links::-webkit-scrollbar {
    height: 5px;
}
.nav-links::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 4px;
}

.nav-btn {
    background: rgba(30, 41, 59, 0.4);
    border: 1px solid var(--card-border);
    color: var(--text-muted);
    padding: 0.6rem 1.2rem;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.nav-btn:hover {
    color: var(--text-color);
    border-color: rgba(255, 255, 255, 0.2);
    transform: translateY(-1px);
}

.nav-btn.active {
    background: var(--accent-gradient);
    color: #ffffff;
    border-color: transparent;
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.3);
}

/* Ad slots */
.ad-slot-horizontal {
    max-width: 970px;
    margin: 1.5rem auto;
    background: rgba(15, 23, 42, 0.5);
    border: 1px dashed var(--border-color);
    border-radius: 8px;
    padding: 10px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 90px;
    position: relative;
    overflow: hidden;
}

.ad-slot-horizontal::before {
    content: 'SPONSORED ADVERTISEMENT';
    font-size: 0.65rem;
    color: var(--text-muted);
    letter-spacing: 0.1em;
    margin-bottom: 4px;
}

.ad-placeholder-text {
    font-size: 0.8rem;
    color: #475569;
}

/* Main Workspace */
.main-container {
    max-width: 1200px;
    margin: 1.5rem auto 3rem auto;
    padding: 0 1.5rem;
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
}

@media (min-width: 1024px) {
    .main-container {
        grid-template-columns: 3fr 1fr; /* layout for side widget */
    }
}

.tool-section {
    display: none;
    animation: fadeIn 0.4s ease-out;
}

.tool-section.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.header-title {
    margin-bottom: 2rem;
    text-align: center;
}

.header-title h1 {
    font-size: 2.2rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
    background: linear-gradient(to right, #ffffff, var(--text-muted));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.header-title p {
    color: var(--text-muted);
    font-size: 1.05rem;
}

/* Dropzone styling */
.dropzone-area {
    background: var(--card-bg);
    border: 2px dashed rgba(6, 182, 212, 0.3);
    border-radius: 16px;
    padding: 4rem 2rem;
    text-align: center;
    cursor: pointer;
    backdrop-filter: blur(8px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

.dropzone-area:hover, .dropzone-area.dragover {
    border-color: var(--accent-primary);
    background: rgba(17, 24, 39, 0.9);
    box-shadow: 0 0 20px rgba(6, 182, 212, 0.15);
    transform: translateY(-2px);
}

.upload-icon {
    font-size: 3.5rem;
    margin-bottom: 1.25rem;
    filter: drop-shadow(0 4px 12px rgba(6, 182, 212, 0.4));
    display: inline-block;
    animation: bounce 2s infinite;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
}

.browse-btn {
    color: var(--accent-primary);
    text-decoration: underline;
    font-weight: 700;
    transition: color 0.2s;
}

.browse-btn:hover {
    color: var(--accent-secondary);
}

/* Main Workspace Grid */
.preview-container {
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    gap: 2rem;
    margin-top: 1.5rem;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    backdrop-filter: blur(12px);
    padding: 2rem;
    border-radius: 16px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.3);
}

@media (max-width: 768px) {
    .nav-container {
        flex-direction: column;
        gap: 1rem;
        padding: 0;
    }
    .logo {
        align-self: center;
    }
    .nav-links {
        width: 100%;
        padding: 0 1.5rem 0.5rem 1.5rem;
        justify-content: flex-start;
    }
    .preview-container {
        grid-template-columns: 1fr;
    }
}

.preview-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: rgba(9, 13, 22, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 1.5rem;
    position: relative;
}

.preview-box h3 {
    margin-bottom: 1rem;
    color: #e2e8f0;
    font-size: 1.1rem;
    align-self: flex-start;
    border-left: 3px solid var(--accent-primary);
    padding-left: 8px;
}

/* Image styling & Wrapper */
.image-wrapper {
    position: relative;
    max-width: 100%;
    overflow: hidden;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 4px 20px rgba(0,0,0,0.4);
}

.preview-box img {
    max-width: 100%;
    max-height: 400px;
    display: block;
}

/* Interactive Cropper Overlay */
.crop-overlay-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.crop-box {
    position: absolute;
    border: 2px dashed var(--accent-primary);
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.6); /* Creates dim mask outside crop area */
    pointer-events: auto;
    cursor: move;
}

.crop-handle {
    position: absolute;
    width: 12px;
    height: 12px;
    background: #ffffff;
    border: 2px solid var(--accent-primary);
    border-radius: 50%;
    box-shadow: 0 0 6px rgba(0,0,0,0.5);
}

.handle-nw { top: -6px; left: -6px; cursor: nwse-resize; }
.handle-ne { top: -6px; right: -6px; cursor: nesw-resize; }
.handle-se { bottom: -6px; right: -6px; cursor: nwse-resize; }
.handle-sw { bottom: -6px; left: -6px; cursor: nwse-resize; }

.image-meta-info {
    margin-top: 1rem;
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 500;
}

/* Controls Column */
.controls-box {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
}

.controls-box h3 {
    margin-bottom: 1.5rem;
    color: #e2e8f0;
    font-size: 1.2rem;
    border-left: 3px solid var(--accent-secondary);
    padding-left: 8px;
}

.control-group {
    margin-bottom: 1.5rem;
}

.control-group label {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
    color: #e2e8f0;
    font-size: 0.9rem;
    font-weight: 600;
}

.control-group label span {
    color: var(--accent-primary);
}

/* Sizing and forms */
select, input[type="number"], input[type="text"] {
    width: 100%;
    padding: 0.75rem 1rem;
    background: #0f172a;
    border: 1px solid var(--border-color);
    color: white;
    border-radius: 8px;
    font-size: 0.95rem;
    transition: all 0.25s ease;
}

select:focus, input[type="number"]:focus, input[type="text"]:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 10px rgba(6, 182, 212, 0.25);
}

.dim-inputs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

/* Range input styled */
input[type="range"] {
    -webkit-appearance: none;
    width: 100%;
    height: 6px;
    background: #1e293b;
    border-radius: 3px;
    outline: none;
    margin-top: 0.5rem;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--accent-primary);
    cursor: pointer;
    box-shadow: 0 0 10px rgba(6, 182, 212, 0.4);
    transition: background 0.2s;
}

input[type="range"]::-webkit-slider-thumb:hover {
    background: var(--accent-secondary);
}

/* Buttons */
.primary-btn {
    width: 100%;
    padding: 0.9rem;
    background: var(--accent-gradient);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(139, 92, 246, 0.3);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
}

.primary-btn:hover {
    background: var(--accent-gradient-hover);
    box-shadow: 0 6px 20px rgba(139, 92, 246, 0.4);
    transform: translateY(-1px);
}

.download-btn {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 0.9rem;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1.05rem;
    font-weight: 700;
    cursor: pointer;
    text-decoration: none;
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
    transition: all 0.3s ease;
}

.download-btn:hover {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.4);
    transform: translateY(-1px);
}

.download-box {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.download-box p {
    margin-bottom: 0.75rem;
    font-size: 0.9rem;
    font-weight: 600;
    text-align: center;
}

.success-badge {
    color: var(--success-color);
}

/* Background Color Picker for Passport Grid */
.color-picker-group {
    display: flex;
    gap: 0.75rem;
    margin-top: 0.5rem;
}

.color-option {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.2s;
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}

.color-option.selected {
    border-color: #ffffff;
    transform: scale(1.1);
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.6);
}

.color-white { background-color: #ffffff; border: 1px solid #cbd5e1; }
.color-blue-light { background-color: #06b6d4; }
.color-blue-dark { background-color: #1d4ed8; }

/* Sidebar/Right Column Widgets */
.sidebar-container {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.sidebar-widget {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    backdrop-filter: blur(12px);
    border-radius: 16px;
    padding: 1.5rem;
    box-shadow: 0 10px 25px rgba(0,0,0,0.15);
}

.sidebar-widget h3 {
    font-size: 1.15rem;
    margin-bottom: 1rem;
    color: #e2e8f0;
    font-weight: 700;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 8px;
}

.feature-list {
    list-style: none;
}

.feature-list li {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.feature-list li::before {
    content: '✓';
    color: var(--accent-primary);
    font-weight: bold;
}

.ad-slot-vertical {
    min-height: 250px;
    background: rgba(15, 23, 42, 0.5);
    border: 1px dashed var(--border-color);
    border-radius: 12px;
    padding: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.ad-slot-vertical::before {
    content: 'ADVERTISEMENT';
    font-size: 0.6rem;
    color: var(--text-muted);
    letter-spacing: 0.1em;
    margin-bottom: 8px;
}

/* Info & SEO Accordion Section at Bottom */
.seo-section {
    max-width: 1200px;
    margin: 3rem auto;
    padding: 0 1.5rem;
    border-top: 1px solid var(--border-color);
    padding-top: 3rem;
}

.seo-title {
    text-align: center;
    margin-bottom: 2.5rem;
}

.seo-title h2 {
    font-size: 1.8rem;
    font-weight: 800;
    color: #e2e8f0;
}

.seo-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2.5rem;
}

@media (min-width: 768px) {
    .seo-grid {
        grid-template-columns: 1fr 1fr;
    }
}

.seo-card h3 {
    font-size: 1.3rem;
    margin-bottom: 1rem;
    color: var(--accent-primary);
}

.seo-card p, .seo-card ul {
    color: var(--text-muted);
    font-size: 0.95rem;
    line-height: 1.6;
}

.seo-card ul {
    margin-left: 1.25rem;
    margin-top: 0.5rem;
}

.faq-accordion {
    margin-top: 2rem;
}

.faq-item {
    background: rgba(15, 23, 42, 0.4);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-bottom: 0.75rem;
    overflow: hidden;
}

.faq-question {
    padding: 1.2rem;
    width: 100%;
    text-align: left;
    background: transparent;
    border: none;
    color: #ffffff;
    font-family: 'Outfit', sans-serif;
    font-size: 1.05rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background 0.2s;
}

.faq-question:hover {
    background: rgba(255, 255, 255, 0.02);
}

.faq-question::after {
    content: '+';
    font-size: 1.3rem;
    color: var(--accent-primary);
    transition: transform 0.2s;
}

.faq-item.active .faq-question::after {
    content: '−';
    transform: rotate(180deg);
}

.faq-answer {
    padding: 0 1.2rem;
    max-height: 0;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0, 1, 0, 1); /* Creates a smooth slide toggle in CSS */
    color: var(--text-muted);
    font-size: 0.92rem;
    line-height: 1.6;
}

.faq-item.active .faq-answer {
    padding: 0 1.2rem 1.2rem 1.2rem;
    max-height: 200px; /* arbitrary height to slide open */
    transition: all 0.3s cubic-bezier(1, 0, 1, 0);
}

/* Footer styling */
footer {
    text-align: center;
    padding: 2.5rem 0;
    border-top: 1px solid var(--border-color);
    color: var(--text-muted);
    font-size: 0.85rem;
}

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

footer a:hover {
    text-decoration: underline;
}

/* --- EXTENDED TOOLS STYLES --- */

/* Switch group */
.switch-group {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 0.5rem;
}

.checkbox-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-size: 0.9rem;
    color: #e2e8f0;
    gap: 8px;
    user-select: none;
}

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

/* Bulk File List */
.file-list {
    width: 100%;
    margin-top: 1.5rem;
    background: rgba(9, 13, 22, 0.5);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    overflow: hidden;
}

.file-row {
    display: grid;
    grid-template-columns: 2.5fr 1fr 1fr 1.2fr;
    padding: 0.8rem 1.2rem;
    border-bottom: 1px solid var(--border-color);
    align-items: center;
    font-size: 0.88rem;
}

@media (max-width: 600px) {
    .file-row {
        grid-template-columns: 1.5fr 1fr 1fr 1.2fr;
        padding: 0.6rem 0.8rem;
        font-size: 0.8rem;
    }
}

.file-row:last-child {
    border-bottom: none;
}

.file-row-header {
    font-weight: 700;
    background: rgba(30, 41, 59, 0.4);
    color: #e2e8f0;
    border-bottom: 2px solid var(--border-color);
}

.file-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    padding-right: 10px;
    color: #f1f5f9;
}

.file-size-info {
    color: var(--text-muted);
}

.file-status {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 0.72rem;
    font-weight: 700;
    text-align: center;
    width: max-content;
}

.status-pending { background: rgba(71, 85, 105, 0.3); color: #cbd5e1; border: 1px solid rgba(71, 85, 105, 0.6); }
.status-compressing { background: rgba(30, 58, 138, 0.3); color: #bfdbfe; border: 1px solid rgba(30, 58, 138, 0.6); }
.status-success { background: rgba(6, 95, 70, 0.3); color: #a7f3d0; border: 1px solid rgba(6, 95, 70, 0.6); }
.status-error { background: rgba(153, 27, 27, 0.3); color: #fca5a5; border: 1px solid rgba(153, 27, 27, 0.6); }

.bulk-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-top: 1.5rem;
}

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

.secondary-btn {
    width: 100%;
    padding: 0.9rem;
    background: rgba(30, 41, 59, 0.6);
    color: var(--text-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
}

.secondary-btn:hover {
    background: rgba(30, 41, 59, 0.9);
    border-color: rgba(255, 255, 255, 0.15);
}

/* PDF Pages Grid */
.pdf-pages-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 1.5rem;
    width: 100%;
    margin-top: 1.5rem;
    max-height: 500px;
    overflow-y: auto;
    padding: 0.5rem;
    border: 1px solid rgba(255, 255, 255, 0.05);
    background: rgba(9, 13, 22, 0.4);
    border-radius: 12px;
}

.pdf-page-card {
    background: rgba(17, 24, 39, 0.85);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    transition: all 0.25s ease;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.pdf-page-card:hover {
    transform: translateY(-2px);
    border-color: var(--accent-primary);
    box-shadow: 0 6px 18px rgba(6, 182, 212, 0.15);
}

.pdf-page-card canvas {
    max-width: 100%;
    height: auto;
    border-radius: 6px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.4);
    background: white;
}

.pdf-page-num {
    font-size: 0.82rem;
    font-weight: 700;
    margin: 10px 0 8px 0;
    color: #cbd5e1;
}

.pdf-page-card .download-btn-sm {
    width: 100%;
    padding: 0.45rem;
    font-size: 0.78rem;
    background: var(--accent-primary);
    color: var(--bg-color);
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 700;
    text-align: center;
    text-decoration: none;
    transition: all 0.2s ease;
    display: inline-block;
}

.pdf-page-card .download-btn-sm:hover {
    background: var(--accent-secondary);
    color: white;
}

/* Inline Ad Placements next to download actions */
.ad-slot-inline {
    background: rgba(30, 41, 59, 0.25);
    border: 1px dashed rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    padding: 0.75rem;
    margin-top: 1rem;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    color: var(--text-muted);
    min-height: 90px;
    box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.2);
}

.ad-slot-inline .ad-placeholder-text {
    font-family: 'Inter', sans-serif;
    color: var(--text-muted);
    letter-spacing: 0.05em;
    font-weight: 500;
}