/* ========================================
   PDF Converter - Premium Dark Theme
   ======================================== */

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

:root {
    --bg-primary: #0f1117;
    --bg-secondary: #1a1d27;
    --bg-card: #1e2130;
    --bg-glass: rgba(30, 33, 48, 0.7);
    --border-glass: rgba(255, 255, 255, 0.08);
    --accent-primary: #6c63ff;
    --accent-secondary: #a78bfa;
    --accent-gradient: linear-gradient(135deg, #6c63ff 0%, #a78bfa 50%, #c084fc 100%);
    --accent-glow: rgba(108, 99, 255, 0.3);
    --text-primary: #f0f0f5;
    --text-secondary: #9ca3b4;
    --text-muted: #5e6478;
    --success: #34d399;
    --success-glow: rgba(52, 211, 153, 0.3);
    --warning: #fbbf24;
    --error: #f87171;
    --error-glow: rgba(248, 113, 113, 0.2);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.4);
    --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-normal: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ========== Base ========== */

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
}

/* Animated background */
body::before {
    content: '';
    position: fixed;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle at 20% 50%, rgba(108, 99, 255, 0.06) 0%, transparent 50%),
                radial-gradient(circle at 80% 20%, rgba(167, 139, 250, 0.04) 0%, transparent 50%),
                radial-gradient(circle at 50% 80%, rgba(192, 132, 252, 0.03) 0%, transparent 50%);
    animation: bgShift 20s ease-in-out infinite alternate;
    z-index: -1;
    pointer-events: none;
}

@keyframes bgShift {
    0% { transform: translate(0, 0) rotate(0deg); }
    100% { transform: translate(-5%, -5%) rotate(3deg); }
}

/* ========== Container ========== */

.app-container {
    max-width: 900px;
    margin: 0 auto;
    padding: 2rem 1.5rem 4rem;
}

/* ========== Header ========== */

.app-header {
    text-align: center;
    margin-bottom: 2.5rem;
    position: relative;
}

.app-header h1 {
    font-size: 2.2rem;
    font-weight: 700;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.02em;
    margin-bottom: 0.5rem;
}

.app-header .subtitle {
    font-size: 0.95rem;
    color: var(--text-secondary);
    font-weight: 400;
}

.header-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--bg-card);
    border: 1px solid var(--border-glass);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.75rem;
}

.header-badge .dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--success);
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; box-shadow: 0 0 0 0 var(--success-glow); }
    50% { opacity: 0.7; box-shadow: 0 0 0 6px transparent; }
}

/* ========== Drop Zone ========== */

.drop-zone-wrapper {
    margin-bottom: 1.5rem;
}

.drop-zone {
    position: relative;
    border: 2px dashed rgba(108, 99, 255, 0.3);
    border-radius: var(--radius-xl);
    padding: 3rem 2rem;
    text-align: center;
    cursor: pointer;
    transition: all var(--transition-normal);
    background: var(--bg-glass);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    overflow: hidden;
}

.drop-zone::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: var(--radius-xl);
    background: var(--accent-gradient);
    opacity: 0;
    transition: opacity var(--transition-normal);
    z-index: 0;
}

.drop-zone:hover {
    border-color: var(--accent-primary);
    transform: translateY(-2px);
    box-shadow: 0 8px 30px var(--accent-glow);
}

.drop-zone:hover::before {
    opacity: 0.05;
}

.drop-zone.dragover {
    border-color: var(--accent-secondary);
    background: rgba(108, 99, 255, 0.08);
    transform: translateY(-4px) scale(1.01);
    box-shadow: 0 12px 40px var(--accent-glow);
}

.drop-zone.dragover::before {
    opacity: 0.1;
}

.drop-zone > * {
    position: relative;
    z-index: 1;
}

.drop-zone-icon {
    font-size: 3.5rem;
    margin-bottom: 1.2rem;
    display: block;
    color: var(--accent-primary);
    filter: drop-shadow(0 4px 12px var(--accent-glow));
    transition: transform var(--transition-normal);
}

.drop-zone:hover .drop-zone-icon {
    transform: translateY(-4px) scale(1.1);
}

.drop-zone-text {
    font-size: 1.05rem;
    color: var(--text-primary);
    font-weight: 500;
    margin-bottom: 0.4rem;
}

.drop-zone-hint {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.drop-zone-hint label {
    color: var(--accent-secondary);
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 2px;
    transition: color var(--transition-fast);
}

.drop-zone-hint label:hover {
    color: var(--accent-primary);
}

#fileInput {
    display: none;
}

/* ========== File List ========== */

.file-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 1rem;
}

.file-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--bg-card);
    border: 1px solid var(--border-glass);
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    color: var(--text-secondary);
    animation: chipIn 0.3s ease-out;
}

.file-chip .file-icon {
    font-size: 0.9rem;
}

.file-chip .file-size {
    color: var(--text-muted);
    font-size: 0.7rem;
}

@keyframes chipIn {
    from { opacity: 0; transform: scale(0.9) translateY(4px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

/* ========== Process Button ========== */

.process-btn-wrapper {
    text-align: center;
    margin-bottom: 1.5rem;
}

.btn-process {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--accent-gradient);
    color: white;
    border: none;
    padding: 12px 32px;
    border-radius: var(--radius-md);
    font-size: 0.95rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all var(--transition-normal);
    box-shadow: 0 4px 20px var(--accent-glow);
    position: relative;
    overflow: hidden;
}

.btn-process::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.1) 0%, transparent 50%);
    opacity: 0;
    transition: opacity var(--transition-fast);
}

.btn-process:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px var(--accent-glow);
}

.btn-process:hover:not(:disabled)::after {
    opacity: 1;
}

.btn-process:active:not(:disabled) {
    transform: translateY(0);
}

.btn-process:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
}

/* ========== Progress Section ========== */

.progress-section {
    margin-bottom: 1.5rem;
    display: none;
}

.progress-section.visible {
    display: block;
    animation: fadeIn 0.4s ease-out;
}

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

.progress-card {
    background: var(--bg-glass);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-lg);
    padding: 1.25rem 1.5rem;
    box-shadow: var(--shadow-md);
}

.progress-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.progress-status {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.progress-percent {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--accent-secondary);
    font-variant-numeric: tabular-nums;
}

.progress-bar-track {
    height: 6px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 3px;
    overflow: hidden;
    position: relative;
}

.progress-bar-fill {
    height: 100%;
    width: 0%;
    background: var(--accent-gradient);
    border-radius: 3px;
    transition: width 0.4s ease-out;
    position: relative;
}

.progress-bar-fill::after {
    content: '';
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 40px;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3));
    animation: shimmer 1.5s ease-in-out infinite;
}

@keyframes shimmer {
    0%, 100% { opacity: 0; }
    50% { opacity: 1; }
}

.progress-detail {
    margin-top: 0.5rem;
    font-size: 0.78rem;
    color: var(--text-muted);
}

/* ========== Output Section ========== */

.output-section {
    margin-bottom: 1.5rem;
}

.output-card {
    background: var(--bg-glass);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-md);
}

.output-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1.25rem;
    border-bottom: 1px solid var(--border-glass);
    background: rgba(0, 0, 0, 0.15);
}

.output-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 6px;
}

.char-count {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
}

.btn-copy {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--bg-card);
    color: var(--text-secondary);
    border: 1px solid var(--border-glass);
    padding: 6px 16px;
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-copy:hover:not(:disabled) {
    background: var(--accent-primary);
    color: white;
    border-color: var(--accent-primary);
    box-shadow: 0 4px 12px var(--accent-glow);
    transform: translateY(-1px);
}

.btn-copy:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.btn-copy.copied {
    background: var(--success);
    color: white;
    border-color: var(--success);
    box-shadow: 0 4px 12px var(--success-glow);
}

#outputText {
    width: 100%;
    min-height: 350px;
    max-height: 60vh;
    padding: 1.25rem;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-family: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
    font-size: 0.85rem;
    line-height: 1.7;
    resize: vertical;
    outline: none;
    scrollbar-width: thin;
    scrollbar-color: var(--bg-card) transparent;
}

#outputText::-webkit-scrollbar {
    width: 6px;
}

#outputText::-webkit-scrollbar-track {
    background: transparent;
}

#outputText::-webkit-scrollbar-thumb {
    background: var(--bg-card);
    border-radius: 3px;
}

#outputText::placeholder {
    color: var(--text-muted);
    font-family: 'Inter', sans-serif;
    font-style: italic;
}

/* ========== Error / Warning Alerts ========== */

.alert-banner {
    display: none;
    padding: 1rem 1.25rem;
    border-radius: var(--radius-md);
    margin-bottom: 1.5rem;
    font-size: 0.85rem;
    line-height: 1.5;
    border: 1px solid;
    animation: fadeIn 0.4s ease-out;
}

.alert-banner.visible {
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.alert-banner.alert-error {
    background: var(--error-glow);
    border-color: rgba(248, 113, 113, 0.3);
    color: #fca5a5;
}

.alert-banner.alert-warning {
    background: rgba(251, 191, 36, 0.1);
    border-color: rgba(251, 191, 36, 0.3);
    color: #fde68a;
}

.alert-banner .alert-icon {
    font-size: 1.1rem;
    flex-shrink: 0;
    margin-top: 1px;
}

.alert-banner .alert-close {
    margin-left: auto;
    background: none;
    border: none;
    color: inherit;
    cursor: pointer;
    font-size: 1.1rem;
    opacity: 0.6;
    transition: opacity var(--transition-fast);
    flex-shrink: 0;
}

.alert-banner .alert-close:hover {
    opacity: 1;
}

/* ========== Stats Bar ========== */

.stats-bar {
    display: none;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stats-bar.visible {
    display: flex;
    animation: fadeIn 0.4s ease-out;
}

.stat-item {
    flex: 1;
    background: var(--bg-glass);
    backdrop-filter: blur(8px);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
    padding: 1rem;
    text-align: center;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-variant-numeric: tabular-nums;
}

.stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 2px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* ========== Lang Selector ========== */

.lang-selector {
    margin-bottom: 1.5rem;
}

.lang-selector label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 0.4rem;
    display: block;
    font-weight: 500;
}

.lang-selector select {
    background: var(--bg-card);
    border: 1px solid var(--border-glass);
    color: var(--text-primary);
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-family: inherit;
    cursor: pointer;
    outline: none;
    transition: border-color var(--transition-fast);
    appearance: auto;
}

.lang-selector select:focus {
    border-color: var(--accent-primary);
}

/* ========== Responsive ========== */

@media (max-width: 640px) {
    .app-container {
        padding: 1rem 1rem 3rem;
    }

    .app-header h1 {
        font-size: 1.6rem;
    }

    .drop-zone {
        padding: 2rem 1.5rem;
    }

    .drop-zone-icon {
        font-size: 2.5rem;
    }

    .stats-bar {
        flex-direction: column;
    }

    #outputText {
        min-height: 250px;
        font-size: 0.8rem;
    }
}

/* ========== Utility classes ========== */

.hidden {
    display: none !important;
}

.spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

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