/* Base Reset and Variables */
:root {
    --bg-dark: #0a0b10;
    --surface-dark: rgba(17, 20, 30, 0.7);
    --surface-dark-solid: #11141e;
    --border-color: rgba(255, 255, 255, 0.08);
    --border-color-hover: rgba(157, 78, 221, 0.4);
    
    /* Harmonious Neon/Modern Accents */
    --primary: #9d4edd;
    --primary-glow: rgba(157, 78, 221, 0.35);
    --primary-light: #c77dff;
    
    --secondary: #4361ee;
    --secondary-glow: rgba(67, 97, 238, 0.3);
    
    --success: #10b981;
    --success-glow: rgba(16, 185, 129, 0.25);
    
    --danger: #f43f5e;
    
    --text-main: #f3f4f6;
    --text-muted: #9ca3af;
    --text-disabled: #6b7280;
    
    --font-heading: 'Outfit', sans-serif;
    --font-body: 'Plus Jakarta Sans', sans-serif;
    
    --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --border-radius: 16px;
    --shadow-premium: 0 10px 30px -10px rgba(0, 0, 0, 0.7);
}

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

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    font-family: var(--font-body);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    position: relative;
}

/* Background Glow Effects */
.glass-bg-glow {
    position: absolute;
    top: -10%;
    left: 20%;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, var(--primary-glow) 0%, rgba(10, 11, 16, 0) 70%);
    z-index: -1;
    filter: blur(80px);
    pointer-events: none;
    animation: pulseGlow 10s ease-in-out infinite alternate;
}

@keyframes pulseGlow {
    0% {
        transform: translate(0, 0) scale(1);
        opacity: 0.8;
    }
    100% {
        transform: translate(5%, 10%) scale(1.1);
        opacity: 0.5;
    }
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: var(--bg-dark);
}
::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
}

/* App Layout Container */
.app-container {
    max-width: 1400px;
    width: 100%;
    margin: 0 auto;
    padding: 2.5rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
    flex-grow: 1;
}

/* Header styling */
.app-header {
    text-align: center;
    margin-bottom: 0.5rem;
}
.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    font-family: var(--font-heading);
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--text-main);
    letter-spacing: -0.5px;
}
.pdf-logo-icon {
    color: var(--primary);
    filter: drop-shadow(0 0 10px var(--primary-glow));
}
.logo h1 span {
    background: linear-gradient(135deg, var(--primary-light), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}
.subtitle {
    margin-top: 0.5rem;
    color: var(--text-muted);
    font-size: 1.1rem;
    font-weight: 400;
}

/* Main Grid Layout */
.main-content {
    display: grid;
    grid-template-columns: 420px 1fr;
    gap: 2rem;
    align-items: start;
    flex-grow: 1;
}

@media (max-width: 1024px) {
    .main-content {
        grid-template-columns: 1fr;
    }
}

/* Common Card/Panel Glass Styling */
.control-panel, .output-panel {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.config-card, .file-info-card, .status-card, .output-actions-card {
    background: var(--surface-dark);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 1.75rem;
    box-shadow: var(--shadow-premium);
    transition: var(--transition-smooth);
}

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

/* Drop Zone Styles */
.drop-zone {
    border: 2px dashed var(--border-color);
    border-radius: var(--border-radius);
    padding: 2.5rem 1.5rem;
    text-align: center;
    background: rgba(17, 20, 30, 0.4);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    cursor: pointer;
    position: relative;
    transition: var(--transition-smooth);
    overflow: hidden;
}
.drop-zone:hover, .drop-zone.dragover {
    border-color: var(--primary);
    background: rgba(157, 78, 221, 0.05);
    box-shadow: 0 0 25px rgba(157, 78, 221, 0.15);
}
.file-input {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}
.icon-circle {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.25rem;
    transition: var(--transition-smooth);
    color: var(--text-muted);
}
.drop-zone:hover .icon-circle {
    background: var(--primary);
    color: white;
    transform: translateY(-3px);
    box-shadow: 0 5px 15px var(--primary-glow);
    border-color: transparent;
}
.upload-icon {
    font-size: 1.5rem;
}
.drop-zone h3 {
    font-family: var(--font-heading);
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}
.drop-zone p {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 0.75rem;
}
.file-limits {
    display: inline-block;
    font-size: 0.75rem;
    color: var(--text-disabled);
    background: rgba(255, 255, 255, 0.05);
    padding: 0.25rem 0.6rem;
    border-radius: 20px;
}

/* File Info Card */
.file-info-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    position: relative;
}
.file-icon {
    font-size: 2rem;
    color: var(--primary);
}
.file-details {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    min-width: 0; /* allows text truncation */
}
.file-name {
    font-weight: 600;
    font-size: 0.95rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.file-size {
    font-size: 0.8rem;
    color: var(--text-muted);
}
.remove-btn {
    background: rgba(255, 255, 255, 0.05);
    border: none;
    color: var(--text-muted);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition-smooth);
}
.remove-btn:hover {
    background: var(--danger);
    color: white;
}

/* Config Card Styles */
.config-card h2 {
    font-family: var(--font-heading);
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.config-icon {
    color: var(--primary-light);
}
.form-group {
    margin-bottom: 1.5rem;
}
.label-with-value {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}
label {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-main);
}
.badge {
    font-size: 0.75rem;
    font-weight: 600;
    background: var(--primary-glow);
    color: var(--primary-light);
    border: 1px solid rgba(157, 78, 221, 0.3);
    padding: 0.2rem 0.5rem;
    border-radius: 6px;
}
.help-text {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.5rem;
}

/* Custom Scale Selector (Radio Buttons styled as pills) */
.scale-selector {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.5rem;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    padding: 0.3rem;
    border-radius: 10px;
}
.scale-option {
    cursor: pointer;
}
.scale-option input {
    display: none;
}
.scale-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 0.25rem;
    border-radius: 8px;
    font-family: var(--font-heading);
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-muted);
    transition: var(--transition-smooth);
    text-align: center;
}
.scale-btn small {
    font-size: 0.65rem;
    font-weight: 400;
    color: var(--text-disabled);
    margin-top: 2px;
}
.scale-option input:checked + .scale-btn {
    background: var(--primary);
    color: white;
    box-shadow: 0 4px 10px var(--primary-glow);
}
.scale-option input:checked + .scale-btn small {
    color: rgba(255, 255, 255, 0.8);
}

/* Custom Select Dropdown */
.custom-select-wrapper {
    position: relative;
    width: 100%;
}
.custom-select {
    width: 100%;
    padding: 0.75rem 1rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    color: var(--text-main);
    font-family: inherit;
    font-size: 0.9rem;
    appearance: none;
    cursor: pointer;
    transition: var(--transition-smooth);
}
.custom-select option {
    background-color: var(--surface-dark-solid);
    color: var(--text-main);
}
.custom-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 10px var(--primary-glow);
}
.select-arrow {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    color: var(--text-muted);
    font-size: 0.8rem;
    transition: var(--transition-smooth);
}
.custom-select:focus + .select-arrow {
    color: var(--primary-light);
    transform: translateY(-50%) rotate(180deg);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.8rem 1.5rem;
    font-family: var(--font-heading);
    font-size: 0.95rem;
    font-weight: 600;
    border-radius: 10px;
    border: none;
    cursor: pointer;
    transition: var(--transition-smooth);
    text-decoration: none;
}
.btn-block {
    display: flex;
    width: 100%;
}
.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    box-shadow: 0 4px 15px var(--primary-glow);
}
.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(157, 78, 221, 0.5);
}
.btn-primary:active:not(:disabled) {
    transform: translateY(0);
}
.btn-primary:disabled {
    background: var(--border-color);
    color: var(--text-disabled);
    cursor: not-allowed;
    box-shadow: none;
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    color: var(--text-main);
}
.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
}

.btn-success {
    background: linear-gradient(135deg, #059669, #10b981);
    color: white;
    box-shadow: 0 4px 15px var(--success-glow);
}
.btn-success:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.4);
}

/* Status Card / Progress Styles */
.status-card {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    background: rgba(22, 26, 37, 0.8);
    border-color: var(--primary-glow);
}
.status-header {
    display: flex;
    justify-content: space-between;
    font-weight: 600;
    font-size: 0.95rem;
}
.status-title {
    color: var(--primary-light);
}
.progress-bar-container {
    width: 100%;
    height: 8px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
    overflow: hidden;
}
.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    border-radius: 4px;
    transition: width 0.15s ease-out;
    box-shadow: 0 0 10px var(--primary-glow);
}
.status-sub {
    font-size: 0.8rem;
    color: var(--text-muted);
    display: flex;
    justify-content: space-between;
}

/* Output Actions Card */
.output-actions-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
    background: rgba(16, 185, 129, 0.03);
    border-color: rgba(16, 185, 129, 0.2);
}
.actions-info h3 {
    font-family: var(--font-heading);
    font-size: 1.1rem;
    color: var(--success);
    margin-bottom: 2px;
}
.actions-info p {
    font-size: 0.85rem;
    color: var(--text-muted);
}
.actions-buttons {
    display: flex;
    gap: 0.75rem;
}

/* Empty State Styling */
.empty-state-view {
    flex-grow: 1;
    min-height: 350px;
    background: rgba(17, 20, 30, 0.3);
    border: 1px dashed var(--border-color);
    border-radius: var(--border-radius);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    text-align: center;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
}
.empty-icon-wrapper {
    font-size: 3.5rem;
    color: var(--text-disabled);
    margin-bottom: 1.5rem;
    animation: float 4s ease-in-out infinite;
}
@keyframes float {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}
.empty-state-view h3 {
    font-family: var(--font-heading);
    font-size: 1.3rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}
.empty-state-view p {
    color: var(--text-muted);
    font-size: 0.95rem;
    max-width: 320px;
}

/* Gallery Grid Styles */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1.5rem;
    margin-top: 0.5rem;
}

.gallery-item {
    background: var(--surface-dark);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-premium);
    transition: var(--transition-smooth);
    animation: scaleIn 0.3s ease-out;
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.gallery-item:hover {
    transform: translateY(-5px);
    border-color: var(--border-color-hover);
    box-shadow: 0 10px 20px -5px rgba(157, 78, 221, 0.2);
}

.preview-wrapper {
    position: relative;
    aspect-ratio: 1 / 1.414; /* Standard PDF page ratio */
    background: #181c28;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}
.preview-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: var(--transition-smooth);
}
.gallery-item:hover .preview-img {
    transform: scale(1.03);
}

/* Overlay menu on hover */
.preview-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(10, 11, 16, 0.7);
    backdrop-filter: blur(4px);
    opacity: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    transition: var(--transition-smooth);
}
.preview-wrapper:hover .preview-overlay {
    opacity: 1;
}

.overlay-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.1rem;
    transition: var(--transition-smooth);
}
.btn-zoom {
    background: white;
    color: var(--bg-dark);
}
.btn-zoom:hover {
    transform: scale(1.1);
    background: var(--primary-light);
    color: white;
}
.btn-download {
    background: var(--primary);
    color: white;
}
.btn-download:hover {
    transform: scale(1.1);
    background: var(--primary-light);
    box-shadow: 0 0 15px var(--primary-glow);
}

.item-footer {
    padding: 0.9rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(10, 11, 16, 0.4);
    border-top: 1px solid var(--border-color);
}
.page-label {
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 0.85rem;
}
.file-size-tag {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Preview Modal Styles */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(5, 5, 8, 0.95);
    backdrop-filter: blur(10px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.25s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-close {
    position: absolute;
    top: 1.5rem;
    right: 2rem;
    font-size: 2.5rem;
    color: var(--text-muted);
    cursor: pointer;
    transition: var(--transition-smooth);
}
.modal-close:hover {
    color: white;
    transform: rotate(90deg);
}

.modal-content-wrapper {
    max-width: 90%;
    max-height: 85%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.25rem;
    animation: scaleUp 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes scaleUp {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.modal-content-img {
    max-width: 100%;
    max-height: 70vh;
    border-radius: 8px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8);
    object-fit: contain;
    border: 1px solid var(--border-color);
}
.modal-caption {
    font-family: var(--font-heading);
    font-size: 1.1rem;
    font-weight: 500;
}
.modal-download {
    box-shadow: 0 4px 15px var(--success-glow);
}
