/* Root variables for design system tokens */
:root {
    --bg-dark: #070913;
    --card-bg: rgba(255, 255, 255, 0.03);
    --border-color: rgba(255, 255, 255, 0.08);
    --border-hover: rgba(255, 255, 255, 0.16);
    
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --primary-glow: rgba(99, 102, 241, 0.3);
    --primary-gradient: linear-gradient(135deg, #6366f1, #8b5cf6);
    
    --success: #10b981;
    --success-gradient: linear-gradient(135deg, #10b981, #059669);
    --success-glow: rgba(16, 185, 129, 0.25);
    
    --error: #ef4444;
    --error-gradient: linear-gradient(135deg, #ef4444, #dc2626);
    
    --warning: #f59e0b;
    --warning-bg: rgba(245, 158, 11, 0.07);
    --warning-border: rgba(245, 158, 11, 0.2);
    
    --text-primary: #f9fafb;
    --text-secondary: #9ca3af;
    --text-muted: #6b7280;
    
    --font-heading: 'Outfit', sans-serif;
    --font-body: 'Inter', sans-serif;
    
    --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Reset and basic setup */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-primary);
    font-family: var(--font-body);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow-x: hidden;
    position: relative;
    padding: 2rem 1rem;
}

/* Background effects */
.bg-gradient {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at 50% -20%, #1c1c3a 0%, var(--bg-dark) 70%);
    z-index: -2;
}

.bg-glow {
    position: absolute;
    top: 20%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 600px;
    height: 300px;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.08) 0%, rgba(99, 102, 241, 0) 70%);
    z-index: -1;
    pointer-events: none;
    filter: blur(40px);
}

/* Container */
.app-container {
    width: 100%;
    max-width: 580px;
    display: flex;
    flex-direction: column;
    gap: 2rem;
    animation: fadeIn 0.6s ease-out;
}

/* Header */
.app-header {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
}

.logo {
    width: 54px;
    height: 54px;
    background: var(--primary-gradient);
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    box-shadow: 0 8px 24px var(--primary-glow);
    position: relative;
    margin-bottom: 0.5rem;
}

.logo svg {
    width: 26px;
    height: 26px;
}

.logo .glow-dot {
    position: absolute;
    top: -2px;
    right: -2px;
    width: 10px;
    height: 10px;
    background: #a78bfa;
    border: 2px solid var(--bg-dark);
    border-radius: 50%;
    box-shadow: 0 0 8px #a78bfa;
}

.app-header h1 {
    font-family: var(--font-heading);
    font-size: 2.25rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    background: linear-gradient(to right, #ffffff, #d8b4fe);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.app-header .subtitle {
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.5;
    max-width: 460px;
    margin: 0 auto;
}

/* Glassmorphic Card */
.card.glassmorphic {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 24px;
    padding: 2.25rem;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.05);
    position: relative;
    overflow: hidden;
}

/* Hide/Show States */
.active-state {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.inactive-state {
    display: none;
    flex-direction: column;
    align-items: center;
    text-align: center;
    animation: slideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.inactive-state.active {
    display: flex;
}

/* Drop Zone */
.drop-zone {
    border: 2px dashed var(--border-color);
    border-radius: 16px;
    padding: 2.5rem 1.5rem;
    text-align: center;
    position: relative;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.01);
    transition: var(--transition-smooth);
    overflow: hidden;
}

.drop-zone:hover, .drop-zone.dragover {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.03);
}

.drop-zone input[type="file"] {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    z-index: 2;
}

.drop-zone-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    transition: var(--transition-smooth);
}

.icon-wrapper {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    transition: var(--transition-smooth);
}

.drop-zone:hover .icon-wrapper, .drop-zone.dragover .icon-wrapper {
    color: var(--primary);
    background: rgba(99, 102, 241, 0.1);
    border-color: rgba(99, 102, 241, 0.2);
    transform: translateY(-2px);
}

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

.primary-text {
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-primary);
}

.primary-text span {
    color: #818cf8;
    text-decoration: underline;
}

.secondary-text {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* File Info Box */
.file-info {
    display: none;
    align-items: center;
    gap: 0.75rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-hover);
    padding: 0.75rem 1rem;
    border-radius: 12px;
    width: 100%;
    max-width: 420px;
    margin: 0 auto;
    position: relative;
    z-index: 3;
    animation: scaleIn 0.3s ease-out;
}

.file-info.active {
    display: flex;
}

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

.file-name {
    font-size: 0.9rem;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-align: left;
    flex-grow: 1;
}

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

.btn-clear {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4px;
    border-radius: 6px;
    transition: var(--transition-smooth);
}

.btn-clear:hover {
    color: var(--error);
    background: rgba(239, 68, 68, 0.1);
}

.btn-clear svg {
    width: 16px;
    height: 16px;
}

/* Drop-zone hiding state when file is chosen */
.drop-zone.has-file .drop-zone-content {
    display: none;
}

/* Settings Panels */
.settings-container {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.setting-group {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.setting-title {
    font-family: var(--font-heading);
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: 0.02em;
}

.dpi-selector {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
}

.dpi-option input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.dpi-option .option-card {
    border: 1px solid var(--border-color);
    background: rgba(255, 255, 255, 0.01);
    border-radius: 12px;
    padding: 0.75rem 0.5rem;
    text-align: center;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    transition: var(--transition-smooth);
}

.dpi-option:hover .option-card {
    border-color: var(--border-hover);
    background: rgba(255, 255, 255, 0.03);
}

.dpi-option input[type="radio"]:checked + .option-card {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.05);
    box-shadow: 0 0 12px rgba(99, 102, 241, 0.15);
}

.dpi-val {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
}

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

.dpi-option input[type="radio"]:checked + .option-card .dpi-val {
    color: #a5b4fc;
}

/* Slider Custom Styling */
.slider-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.slider-value {
    font-size: 0.9rem;
    font-weight: 700;
    color: #a5b4fc;
    background: rgba(99, 102, 241, 0.1);
    padding: 2px 8px;
    border-radius: 6px;
    border: 1px solid rgba(99, 102, 241, 0.15);
}

.range-slider {
    -webkit-appearance: none;
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.08);
    outline: none;
}

.range-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #818cf8;
    border: 3px solid var(--bg-dark);
    cursor: pointer;
    box-shadow: 0 0 10px var(--primary-glow);
    transition: transform 0.1s ease;
}

.range-slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

.range-slider::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #818cf8;
    border: 3px solid var(--bg-dark);
    cursor: pointer;
    box-shadow: 0 0 10px var(--primary-glow);
    transition: transform 0.1s ease;
}

.range-slider::-moz-range-thumb:hover {
    transform: scale(1.2);
}

.slider-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* General Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-family: var(--font-body);
    font-size: 0.95rem;
    font-weight: 600;
    padding: 0.9rem 1.5rem;
    border-radius: 12px;
    border: none;
    cursor: pointer;
    transition: var(--transition-smooth);
    width: 100%;
    position: relative;
    overflow: hidden;
}

.btn svg {
    width: 18px;
    height: 18px;
}

.btn-primary {
    background: var(--primary-gradient);
    color: white;
    box-shadow: 0 4px 16px var(--primary-glow);
}

.btn-primary:hover:not(:disabled) {
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.45);
    transform: translateY(-1px);
}

.btn-primary:disabled {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-muted);
    border: 1px solid var(--border-color);
    box-shadow: none;
    cursor: not-allowed;
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--border-hover);
    color: var(--text-primary);
}

.btn-success {
    background: var(--success-gradient);
    color: white;
    box-shadow: 0 4px 16px var(--success-glow);
    text-decoration: none;
}

.btn-success:hover {
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.4);
    transform: translateY(-1px);
}

/* Spinner and Processing View */
.spinner-container {
    margin-bottom: 1.5rem;
}

.spinner {
    width: 50px;
    height: 50px;
    position: relative;
}

.double-bounce1, .double-bounce2 {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background-color: var(--primary);
    opacity: 0.6;
    position: absolute;
    top: 0;
    left: 0;
    animation: bounce 2.0s infinite ease-in-out;
}

.double-bounce2 {
    animation-delay: -1.0s;
    background-color: #8b5cf6;
}

@keyframes bounce {
    0%, 100% { transform: scale(0.0); }
    50% { transform: scale(1.0); }
}

.processing-subtitle, .success-subtitle, .error-subtitle {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-top: 0.5rem;
    margin-bottom: 2rem;
}

/* Status Dev Terminal */
.status-terminal {
    width: 100%;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
    text-align: left;
}

.terminal-header {
    background: rgba(255, 255, 255, 0.02);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    padding: 0.5rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    justify-content: space-between;
}

.terminal-dots {
    display: flex;
    gap: 4px;
}

.terminal-dots span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
}

.terminal-dots span:nth-child(1) { background: #ef4444; }
.terminal-dots span:nth-child(2) { background: #fbbf24; }
.terminal-dots span:nth-child(3) { background: #10b981; }

.terminal-title {
    font-family: monospace;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.terminal-body {
    padding: 1rem;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.85rem;
    color: #34d399;
    min-height: 70px;
    max-height: 150px;
    overflow-y: auto;
    word-break: break-all;
}

/* Success View Icon & Download Card */
.success-icon-wrapper {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.25);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--success);
    margin-bottom: 1.5rem;
    position: relative;
}

.success-ring {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 2px solid var(--success);
    opacity: 0.5;
    animation: pingEffect 1.5s ease-out infinite;
}

.download-card {
    width: 100%;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.download-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-align: left;
}

.download-info svg {
    width: 28px;
    height: 28px;
    color: var(--success);
    flex-shrink: 0;
}

.download-meta {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.download-name {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
}

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

.warning-banner {
    display: flex;
    gap: 0.75rem;
    background: var(--warning-bg);
    border: 1px solid var(--warning-border);
    padding: 1rem;
    border-radius: 12px;
    margin-bottom: 1.75rem;
    text-align: left;
}

.warning-banner svg {
    width: 20px;
    height: 20px;
    color: var(--warning);
    flex-shrink: 0;
}

.warning-banner p {
    font-size: 0.8rem;
    line-height: 1.4;
    color: #fbd38d;
}

/* Error State Elements */
.error-icon-wrapper {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.25);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--error);
    margin-bottom: 1.5rem;
}

.error-icon-wrapper svg {
    width: 32px;
    height: 32px;
}

/* Footer styling */
.app-footer {
    text-align: center;
}

.app-footer p {
    font-size: 0.8rem;
    color: var(--text-muted);
}

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

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

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

@keyframes pingEffect {
    0% { transform: scale(1); opacity: 0.6; }
    100% { transform: scale(1.3); opacity: 0; }
}

/* Media Queries */
@media(max-width: 480px) {
    body {
        padding: 1rem 0.5rem;
    }
    
    .card.glassmorphic {
        padding: 1.5rem 1rem;
        border-radius: 20px;
    }
    
    .dpi-selector {
        grid-template-columns: 1fr;
    }
    
    .app-header h1 {
        font-size: 1.75rem;
    }
}
