:root {
    --bg-body: #0b0f19;
    --bg-surface: #151c2c;
    --bg-surface-hover: #1e293b;
    --bg-input: #1a2336;
    --border-subtle: #2a364f;
    --border-accent: rgba(16, 185, 129, 0.4);
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --text-dim: #64748b;
    --accent-primary: #10b981;
    --accent-primary-hover: #059669;
    --accent-glow: rgba(16, 185, 129, 0.15);
    --accent-secondary: #6366f1;
    --danger: #ef4444;
    --danger-bg: rgba(239, 68, 68, 0.1);
    --success-bg: rgba(16, 185, 129, 0.1);
    --radius-card: 14px;
    --radius-pill: 9999px;
    --font-display: "Outfit", sans-serif;
    --font-body: "DM Sans", sans-serif;
    --font-mono: "JetBrains Mono", monospace;
}

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

body {
    font-family: var(--font-body);
    background-color: var(--bg-body);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    line-height: 1.5;
    background-image:
        radial-gradient(
            circle at 15% 15%,
            rgba(99, 102, 241, 0.08) 0%,
            transparent 45%
        ),
        radial-gradient(
            circle at 85% 85%,
            rgba(16, 185, 129, 0.06) 0%,
            transparent 45%
        );
}

.container {
    max-width: 1240px;
    margin: 0 auto;
    padding: 32px 20px 60px;
    width: 100%;
    flex: 1;
}

/* Header Section */
.header {
    text-align: center;
    margin-bottom: 40px;
}

.privacy-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid var(--border-accent);
    color: var(--accent-primary);
    padding: 6px 16px;
    border-radius: var(--radius-pill);
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 16px;
}

.header h1 {
    font-family: var(--font-display);
    font-size: clamp(2.2rem, 5vw, 3.5rem);
    font-weight: 800;
    color: var(--text-main);
    letter-spacing: -0.03em;
    margin-bottom: 12px;
    text-wrap: balance;
}

.header h1 span {
    color: var(--accent-primary);
}

.header p {
    font-size: 1.125rem;
    color: var(--text-muted);
    max-width: 620px;
    margin: 0 auto;
    text-wrap: balance;
}

/* Control Bar: Search & Category Tabs */
.control-bar {
    margin-bottom: 32px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    align-items: center;
}

.search-box {
    position: relative;
    width: 100%;
    max-width: 500px;
}

.search-box input {
    width: 100%;
    padding: 14px 20px 14px 46px;
    background: var(--bg-input);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-pill);
    color: var(--text-main);
    font-family: var(--font-body);
    font-size: 0.95rem;
    outline: none;
    transition:
        border-color 0.2s ease,
        box-shadow 0.2s ease;
}

.search-box input:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.search-box input::placeholder {
    color: var(--text-dim);
}

.search-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-dim);
    font-size: 1.1rem;
    pointer-events: none;
}

.category-tabs {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
}

.tab-btn {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    color: var(--text-muted);
    padding: 8px 18px;
    border-radius: var(--radius-pill);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.tab-btn:hover {
    background: var(--bg-surface-hover);
    color: var(--text-main);
}

.tab-btn.active {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
    color: #042f2e;
    font-weight: 600;
}

/* Tools Grid */
.tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
    gap: 20px;
}

.tool-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-card);
    padding: 24px;
    display: flex;
    flex-direction: column;
    transition:
        transform 0.2s cubic-bezier(0.16, 1, 0.3, 1),
        border-color 0.2s ease,
        box-shadow 0.2s ease;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.tool-card:hover {
    transform: translateY(-3px);
    border-color: var(--border-accent);
    box-shadow: 0 12px 30px -10px rgba(0, 0, 0, 0.5);
}

.tool-card:focus-visible {
    outline: 2px solid var(--accent-primary);
    outline-offset: 2px;
}

.tool-header {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 14px;
}

.tool-icon {
    font-size: 2rem;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.tool-card h2 {
    font-family: var(--font-display);
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--text-main);
}

.tool-card p {
    color: var(--text-muted);
    font-size: 0.88rem;
    line-height: 1.45;
    flex: 1;
    margin-bottom: 16px;
}

.tool-badge {
    align-self: flex-start;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: rgba(255, 255, 255, 0.03);
    padding: 4px 10px;
    border-radius: var(--radius-pill);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.empty-search {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 20px;
    background: var(--bg-surface);
    border: 1px dashed var(--border-subtle);
    border-radius: var(--radius-card);
    color: var(--text-muted);
}

/* Tool Workspace View */
.workspace {
    max-width: 800px;
    margin: 0 auto;
}

.back-btn {
    background: transparent;
    border: 1px solid var(--border-subtle);
    color: var(--text-muted);
    padding: 8px 16px;
    border-radius: var(--radius-pill);
    cursor: pointer;
    font-family: var(--font-body);
    font-size: 0.9rem;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 24px;
    transition: all 0.2s ease;
}

.back-btn:hover {
    background: var(--bg-surface);
    color: var(--text-main);
    border-color: var(--text-muted);
}

.workspace-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-card);
    padding: 36px;
}

.workspace-header {
    text-align: center;
    margin-bottom: 28px;
}

.workspace-header .icon {
    font-size: 3rem;
    margin-bottom: 12px;
    display: inline-block;
}

.workspace-header h2 {
    font-family: var(--font-display);
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 8px;
}

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

/* Upload Area */
.upload-area {
    border: 2px dashed var(--border-subtle);
    border-radius: var(--radius-card);
    padding: 44px 20px;
    text-align: center;
    background: var(--bg-input);
    cursor: pointer;
    transition: all 0.25s ease;
    margin-bottom: 24px;
}

.upload-area:hover,
.upload-area.dragover {
    border-color: var(--accent-primary);
    background: rgba(16, 185, 129, 0.04);
}

.upload-icon {
    font-size: 2.5rem;
    color: var(--accent-primary);
    margin-bottom: 14px;
}

.upload-title {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 6px;
}

.upload-subtitle {
    font-size: 0.85rem;
    color: var(--text-dim);
    margin-bottom: 18px;
}

.file-input {
    display: none;
}

.btn-select {
    background: var(--accent-primary);
    color: #042f2e;
    padding: 10px 24px;
    border: none;
    border-radius: var(--radius-pill);
    font-family: var(--font-body);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease;
}

.btn-select:hover {
    background: var(--accent-primary-hover);
}

/* File List */
.file-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 24px;
}

.file-item {
    background: var(--bg-body);
    border: 1px solid var(--border-subtle);
    padding: 12px 18px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.file-info {
    display: flex;
    align-items: center;
    gap: 12px;
    overflow: hidden;
}

.file-icon {
    font-size: 1.3rem;
    flex-shrink: 0;
}

.file-name {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

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

.btn-remove {
    background: transparent;
    border: none;
    color: var(--danger);
    cursor: pointer;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 500;
    transition: background 0.2s ease;
}

.btn-remove:hover {
    background: var(--danger-bg);
}

/* Actions & Progress */
.action-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.btn-convert {
    background: var(--accent-primary);
    color: #042f2e;
    padding: 14px 36px;
    border: none;
    border-radius: var(--radius-pill);
    font-family: var(--font-body);
    font-size: 1.05rem;
    font-weight: 700;
    cursor: pointer;
    width: 100%;
    max-width: 320px;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.btn-convert:hover:not(:disabled) {
    background: var(--accent-primary-hover);
    transform: translateY(-1px);
}

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

.progress-container {
    width: 100%;
    margin: 16px 0;
}

.progress-track {
    width: 100%;
    height: 8px;
    background: var(--bg-body);
    border-radius: 4px;
    overflow: hidden;
    border: 1px solid var(--border-subtle);
}

.progress-bar {
    height: 100%;
    background: var(--accent-primary);
    width: 0%;
    transition: width 0.3s ease;
}

.progress-text {
    font-size: 0.85rem;
    color: var(--text-muted);
    text-align: center;
    margin-top: 8px;
}

/* Result & Error banners */
.alert-box {
    padding: 20px;
    border-radius: 12px;
    margin-top: 24px;
    text-align: center;
}

.alert-success {
    background: var(--success-bg);
    border: 1px solid rgba(16, 185, 129, 0.3);
    color: #6ee7b7;
}

.alert-error {
    background: var(--danger-bg);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #fca5a5;
}

.alert-title {
    font-family: var(--font-display);
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 6px;
}

.alert-msg {
    font-size: 0.9rem;
    opacity: 0.9;
}

.hidden {
    display: none !important;
}

/* Footer */
.footer {
    text-align: center;
    padding: 24px 20px;
    border-top: 1px solid var(--border-subtle);
    color: var(--text-dim);
    font-size: 0.875rem;
    margin-top: auto;
}

.footer a {
    color: var(--text-muted);
    text-decoration: none;
    transition: color 0.2s ease;
}

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

/* Spinner */
.spinner {
    width: 18px;
    height: 18px;
    border: 2px solid rgba(4, 47, 46, 0.3);
    border-top-color: #042f2e;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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