/* ============================================
   Freecvt — Word to PDF Converter Styles
   Mobile-first, CSS-variable-driven theme
   ============================================ */

:root {
    --bg-primary: #0f172a;
    --bg-card: #1e293b;
    --bg-hover: #334155;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --accent: #3b82f6;
    --accent-hover: #2563eb;
    --accent-glow: rgba(59, 130, 246, 0.25);
    --border: #334155;
    --border-active: #3b82f6;
    --success: #22c55e;
    --error: #ef4444;
    --error-bg: rgba(239, 68, 68, 0.1);
    --radius: 10px;
    --radius-sm: 6px;
    --shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
    --font: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --transition: 0.2s ease;
}

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

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font);
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    line-height: 1.5;
}

/* ---- Layout ---- */
.app {
    width: 100%;
    max-width: 560px;
    padding: 1.5rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    flex: 1;
}

header {
    text-align: center;
    padding: 0.5rem 0;
}

header h1 {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

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

/* ---- Upload Zone ---- */
.upload-zone {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 2.5rem 1.5rem;
    text-align: center;
    cursor: pointer;
    transition: border-color var(--transition), background var(--transition);
    position: relative;
    background: var(--bg-card);
}

.upload-zone:hover,
.upload-zone.dragover {
    border-color: var(--accent);
    background: rgba(59, 130, 246, 0.05);
}

.upload-zone:focus-within {
    border-color: var(--accent);
    outline: 2px solid var(--accent-glow);
    outline-offset: 2px;
}

.upload-zone.has-file {
    border-color: var(--success);
    border-style: solid;
    background: rgba(34, 197, 94, 0.05);
}

.upload-icon {
    width: 48px;
    height: 48px;
    margin: 0 auto 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

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

.upload-zone:hover .upload-icon svg,
.upload-zone.dragover .upload-icon svg {
    stroke: var(--accent);
}

.upload-text {
    font-size: 0.95rem;
    color: var(--text-secondary);
    margin-bottom: 0.35rem;
}

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

.upload-zone input[type="file"] {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

/* ---- File Info ---- */
.file-info {
    display: none;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: var(--bg-card);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}

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

.file-info-icon {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    background: var(--accent-glow);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
}

.file-info-icon svg {
    width: 18px;
    height: 18px;
    stroke: var(--accent);
}

.file-info-details {
    flex: 1;
    min-width: 0;
}

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

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

.file-info-remove {
    flex-shrink: 0;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.25rem;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    transition: color var(--transition), background var(--transition);
}

.file-info-remove:hover {
    color: var(--error);
    background: var(--error-bg);
}

.file-info-remove:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 1px;
}

/* ---- Buttons ---- */
.btn-convert {
    width: 100%;
    padding: 0.85rem;
    font-size: 0.95rem;
    font-weight: 600;
    font-family: var(--font);
    color: #fff;
    background: var(--accent);
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background var(--transition), opacity var(--transition), transform 0.1s;
    position: relative;
    overflow: hidden;
}

.btn-convert:hover:not(:disabled) {
    background: var(--accent-hover);
}

.btn-convert:active:not(:disabled) {
    transform: scale(0.985);
}

.btn-convert:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.btn-convert:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* ---- Progress ---- */
.progress-container {
    display: none;
    flex-direction: column;
    gap: 0.5rem;
}

.progress-container.visible {
    display: flex;
}

.progress-bar-track {
    width: 100%;
    height: 6px;
    background: var(--bg-hover);
    border-radius: 3px;
    overflow: hidden;
}

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

.progress-text {
    font-size: 0.78rem;
    color: var(--text-muted);
    text-align: center;
}

/* ---- Result ---- */
.result {
    display: none;
    flex-direction: column;
    gap: 0.75rem;
    text-align: center;
    padding: 1.25rem;
    background: var(--bg-card);
    border-radius: var(--radius);
    border: 1px solid var(--success);
}

.result.visible {
    display: flex;
}

.result-icon {
    width: 48px;
    height: 48px;
    margin: 0 auto;
    background: rgba(34, 197, 94, 0.12);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.result-icon svg {
    width: 28px;
    height: 28px;
    stroke: var(--success);
}

.result-text {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.btn-download {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.7rem 1.5rem;
    font-size: 0.9rem;
    font-weight: 600;
    font-family: var(--font);
    color: #fff;
    background: var(--success);
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    text-decoration: none;
    transition: background var(--transition), transform 0.1s;
    align-self: center;
}

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

.btn-download:active {
    transform: scale(0.98);
}

.btn-download:focus-visible {
    outline: 2px solid var(--success);
    outline-offset: 2px;
}

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

/* ---- Error ---- */
.error-msg {
    display: none;
    padding: 0.75rem 1rem;
    background: var(--error-bg);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: var(--radius-sm);
    font-size: 0.82rem;
    color: var(--error);
    text-align: center;
}

.error-msg.visible {
    display: block;
}

/* ---- Footer ---- */
footer {
    padding: 1.25rem 1rem;
    text-align: center;
    font-size: 0.72rem;
    color: var(--text-muted);
}

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

footer a:hover {
    color: var(--accent);
}

/* ---- Focus Visible global ---- */
:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* ---- Tablet+ ---- */
@media (min-width: 640px) {
    .app {
        padding: 2.5rem 1.5rem;
        gap: 1.5rem;
    }

    header h1 {
        font-size: 1.6rem;
    }

    header p {
        font-size: 0.9rem;
    }

    .upload-zone {
        padding: 3rem 2rem;
    }

    .upload-text {
        font-size: 1rem;
    }
}

/* ---- Desktop ---- */
@media (min-width: 1024px) {
    .app {
        padding: 3rem 2rem;
    }

    header h1 {
        font-size: 1.75rem;
    }
}
