/* badlo.in Theme & Design System */
:root {
    --primary-color: #e5322d;
    --primary-hover: #c8231e;
    --primary-light: #fde8e7;
    --primary-gradient: linear-gradient(135deg, #e5322d 0%, #ff5252 100%);
    --bg-color: #f8fafc;
    --card-bg: #ffffff;
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --border-color: #e2e8f0;
    --border-hover: #cbd5e1;
    --shadow-sm: 0 2px 5px rgba(0,0,0,0.04);
    --shadow-md: 0 10px 25px -5px rgba(0, 0, 0, 0.06), 0 8px 10px -6px rgba(0, 0, 0, 0.02);
    --shadow-lg: 0 20px 35px -10px rgba(229, 50, 45, 0.18);
    --shadow-hover: 0 20px 30px -8px rgba(0, 0, 0, 0.12);
    --radius-sm: 12px;
    --radius-md: 20px;
    --radius-lg: 28px;
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

[data-theme="dark"] {
    --bg-color: #0b0f19;
    --card-bg: #151d2a;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --border-color: #1e293b;
    --border-hover: #334155;
    --shadow-md: 0 10px 25px -5px rgba(0, 0, 0, 0.4);
    --shadow-hover: 0 20px 35px -10px rgba(0, 0, 0, 0.6);
    --primary-light: rgba(229, 50, 45, 0.18);
}

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

body {
    font-family: var(--font-sans);
    background-color: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Header Navbar */
.navbar {
    background: var(--card-bg);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 1000;
    backdrop-filter: blur(14px);
    box-shadow: var(--shadow-sm);
}

.nav-container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0.9rem 1.75rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    font-weight: 800;
    font-size: 1.5rem;
    color: var(--text-primary);
    letter-spacing: -0.03em;
}

.brand-icon {
    width: 42px;
    height: 42px;
    background: var(--primary-gradient);
    color: #fff;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 900;
    font-size: 1.25rem;
    box-shadow: 0 4px 14px rgba(229, 50, 45, 0.35);
}

.brand-span {
    color: var(--primary-color);
}

.nav-menu {
    display: flex;
    align-items: center;
    gap: 1rem;
    list-style: none;
}

.nav-link {
    text-decoration: none;
    color: var(--text-secondary);
    font-weight: 700;
    font-size: 0.95rem;
    padding: 0.55rem 0.9rem;
    border-radius: 10px;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.nav-link:hover, .nav-link.active {
    color: var(--primary-color);
    background: var(--primary-light);
}

/* Nav Dropdowns (iLovePDF Style) */
.nav-dropdown {
    position: relative;
}

.dropdown-toggle {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-family: var(--font-sans);
    font-weight: 700;
    font-size: 0.95rem;
    padding: 0.55rem 0.9rem;
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    transition: all 0.2s ease;
}

.dropdown-toggle:hover, .nav-dropdown:hover .dropdown-toggle {
    color: var(--primary-color);
    background: var(--primary-light);
}

.arrow-down {
    font-size: 0.75rem;
    transition: transform 0.2s ease;
}

.nav-dropdown:hover .arrow-down {
    transform: rotate(180deg);
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 0.75rem;
    min-width: 230px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.12);
    display: none;
    flex-direction: column;
    gap: 0.35rem;
    z-index: 1001;
    animation: fadeInDown 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

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

.nav-dropdown:hover .dropdown-menu {
    display: flex;
}

.dropdown-item {
    text-decoration: none;
    color: var(--text-primary);
    font-weight: 600;
    font-size: 0.925rem;
    padding: 0.65rem 1rem;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    transition: all 0.2s ease;
}

.dropdown-item:hover {
    background: var(--primary-light);
    color: var(--primary-color);
    transform: translateX(4px);
}

/* Actions Right */
.nav-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.theme-toggle {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 0.55rem 1.1rem;
    border-radius: 50px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    font-weight: 700;
    transition: all 0.2s ease;
    box-shadow: var(--shadow-sm);
}

.theme-toggle:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
    transform: translateY(-1px);
}

.mobile-menu-toggle {
    display: none;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    font-size: 1.35rem;
    padding: 0.4rem 0.85rem;
    border-radius: 10px;
    cursor: pointer;
}

/* Mobile Responsiveness for Navbar */
@media (max-width: 992px) {
    .mobile-menu-toggle {
        display: block;
    }

    .nav-menu {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: var(--card-bg);
        border-bottom: 1px solid var(--border-color);
        padding: 1.5rem;
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
        box-shadow: 0 15px 30px rgba(0,0,0,0.1);
    }

    .nav-menu.open {
        display: flex;
    }

    .nav-dropdown {
        width: 100%;
    }

    .dropdown-menu {
        position: static;
        box-shadow: none;
        border: none;
        padding-left: 1rem;
        display: flex;
    }
}

/* Main Container */
.main-wrapper {
    flex: 1;
    max-width: 1240px;
    width: 100%;
    margin: 0 auto;
    padding: 3rem 1.5rem;
}

/* Hero Section */
.hero-section {
    text-align: center;
    margin-bottom: 3.5rem;
}

.tool-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--primary-light);
    color: var(--primary-color);
    padding: 0.45rem 1.2rem;
    border-radius: 50px;
    font-size: 0.85rem;
    font-weight: 700;
    margin-bottom: 1.25rem;
    text-transform: uppercase;
    letter-spacing: 0.8px;
}

.hero-title {
    font-size: 3.25rem;
    font-weight: 900;
    letter-spacing: -0.03em;
    margin-bottom: 1rem;
    line-height: 1.15;
    background: linear-gradient(135deg, var(--text-primary) 30%, var(--primary-color) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero-subtitle {
    font-size: 1.2rem;
    color: var(--text-secondary);
    max-width: 720px;
    margin: 0 auto;
    font-weight: 400;
}

/* Home Grid of Tools (iLovePDF Style) */
.tools-grid-section {
    margin-bottom: 4.5rem;
}

.tools-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.75rem;
}

@media (max-width: 992px) {
    .tools-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.5rem;
    }
}

@media (max-width: 640px) {
    .tools-grid {
        grid-template-columns: 1fr;
        gap: 1.25rem;
    }
}

.tool-card-item {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 2rem 1.75rem;
    text-decoration: none;
    color: var(--text-primary);
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow-md);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.tool-card-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--primary-gradient);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.tool-card-item:hover {
    transform: translateY(-6px);
    box-shadow: var(--shadow-hover);
    border-color: var(--border-hover);
}

.tool-card-item:hover::before {
    opacity: 1;
}

.tool-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.25rem;
}

.tool-card-icon {
    width: 56px;
    height: 56px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 15px rgba(0,0,0,0.06);
}

.tool-card-icon svg {
    width: 30px;
    height: 30px;
}

.icon-bg-red { background: #fee2e2; color: #e5322d; }
.icon-bg-orange { background: #ffedd5; color: #ea580c; }
.icon-bg-green { background: #dcfce7; color: #16a34a; }
.icon-bg-purple { background: #f3e8ff; color: #9333ea; }
.icon-bg-blue { background: #dbeafe; color: #2563eb; }
.icon-bg-teal { background: #ccfbf1; color: #0d9488; }
.icon-bg-pink { background: #fce7f3; color: #db2777; }
.icon-bg-indigo { background: #e0e7ff; color: #4f46e5; }
.icon-bg-yellow { background: #fef9c3; color: #ca8a04; }

.tool-card-arrow {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--bg-color);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-weight: bold;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.tool-card-item:hover .tool-card-arrow {
    background: var(--primary-color);
    color: #ffffff;
    transform: translateX(4px);
}

.tool-card-title {
    font-size: 1.25rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
    letter-spacing: -0.01em;
}

.tool-card-desc {
    color: var(--text-secondary);
    font-size: 0.925rem;
    line-height: 1.5;
}

/* Main Converter Box */
.converter-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    padding: 3rem 2.5rem;
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
    margin-bottom: 4rem;
}

.dropzone {
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-md);
    padding: 4rem 2rem;
    text-align: center;
    background: var(--bg-color);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.dropzone:hover, .dropzone.dragover {
    border-color: var(--primary-color);
    background: var(--primary-light);
    transform: translateY(-2px);
}

.upload-icon-wrapper {
    width: 88px;
    height: 88px;
    background: var(--card-bg);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.5rem auto;
    box-shadow: 0 10px 25px rgba(0,0,0,0.06);
    color: var(--primary-color);
    transition: transform 0.3s ease;
}

.dropzone:hover .upload-icon-wrapper {
    transform: scale(1.1) rotate(-5deg);
}

.upload-title {
    font-size: 1.45rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
    letter-spacing: -0.01em;
}

.upload-hint {
    color: var(--text-secondary);
    font-size: 0.98rem;
    margin-bottom: 1.75rem;
}

.btn-select-file {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    background: var(--primary-gradient);
    color: #ffffff;
    font-weight: 800;
    font-size: 1.15rem;
    padding: 1.1rem 2.5rem;
    border-radius: 50px;
    border: none;
    cursor: pointer;
    box-shadow: var(--shadow-lg);
    transition: all 0.25s ease;
}

.btn-select-file:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 40px rgba(229, 50, 45, 0.3);
}

.file-input {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

/* File Selected State */
.file-selected-view {
    display: none;
    text-align: center;
}

.file-preview-card {
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    max-width: 520px;
    margin: 0 auto 2rem auto;
    display: flex;
    align-items: center;
    gap: 1.25rem;
    text-align: left;
    position: relative;
    box-shadow: var(--shadow-sm);
}

.pdf-icon-badge {
    width: 56px;
    height: 56px;
    background: #fee2e2;
    color: var(--primary-color);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
    flex-shrink: 0;
}

.file-info {
    flex: 1;
    overflow: hidden;
}

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

.file-meta {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-top: 0.2rem;
}

.btn-remove-file {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.25rem;
    cursor: pointer;
    padding: 0.4rem;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.btn-remove-file:hover {
    color: var(--primary-color);
    background: var(--primary-light);
}

.btn-convert {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    background: var(--primary-gradient);
    color: #ffffff;
    font-weight: 800;
    font-size: 1.25rem;
    padding: 1.15rem 3.25rem;
    border-radius: 50px;
    border: none;
    cursor: pointer;
    box-shadow: var(--shadow-lg);
    transition: all 0.25s ease;
    width: 100%;
    max-width: 360px;
}

.btn-convert:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 16px 45px rgba(229, 50, 45, 0.35);
}

/* Processing State */
.processing-view {
    display: none;
    text-align: center;
    padding: 2rem 0;
}

.spinner-wrapper {
    margin-bottom: 1.5rem;
}

.spinner {
    width: 64px;
    height: 64px;
    border: 4px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s infinite linear;
    margin: 0 auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.progress-bar-container {
    max-width: 440px;
    height: 10px;
    background: var(--border-color);
    border-radius: 10px;
    margin: 1.5rem auto 1rem auto;
    overflow: hidden;
}

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

.processing-status {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-primary);
}

/* Result / Download State */
.result-view {
    display: none;
    text-align: center;
    padding: 1rem 0;
}

.success-icon-badge {
    width: 76px;
    height: 76px;
    background: #dcfce7;
    color: #16a34a;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    margin: 0 auto 1.25rem auto;
    box-shadow: 0 8px 25px rgba(22, 163, 74, 0.25);
}

.result-title {
    font-size: 1.85rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
    letter-spacing: -0.02em;
}

.result-subtitle {
    color: var(--text-secondary);
    font-size: 1.05rem;
    margin-bottom: 2rem;
}

.action-buttons {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1.25rem;
}

.btn-download {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    background: #16a34a;
    color: #ffffff;
    font-weight: 800;
    font-size: 1.2rem;
    padding: 1.1rem 2.75rem;
    border-radius: 50px;
    text-decoration: none;
    box-shadow: 0 10px 25px rgba(22, 163, 74, 0.3);
    transition: all 0.25s ease;
}

.btn-download:hover {
    background: #15803d;
    transform: translateY(-2px);
    box-shadow: 0 14px 35px rgba(22, 163, 74, 0.4);
}

.btn-secondary {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    font-weight: 700;
    font-size: 1rem;
    padding: 1rem 2rem;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-secondary:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
    background: var(--primary-light);
}

/* Features Section */
.features-section {
    margin-top: 4rem;
}

.section-title {
    text-align: center;
    font-size: 2rem;
    font-weight: 900;
    margin-bottom: 2.5rem;
    letter-spacing: -0.02em;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1.75rem;
}

.feature-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 2rem;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    box-shadow: var(--shadow-md);
}

.feature-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-hover);
}

.feature-icon {
    width: 52px;
    height: 52px;
    background: var(--primary-light);
    color: var(--primary-color);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
    margin-bottom: 1.25rem;
}

.feature-heading {
    font-size: 1.2rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
}

.feature-desc {
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.5;
}

/* Footer */
.footer {
    background: var(--card-bg);
    border-top: 1px solid var(--border-color);
    padding: 2.5rem 2rem;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin-top: auto;
}

.footer a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 700;
}
