:root {
    --bg-color: #0b0f19; /* Deep space dark */
    --surface-color: rgba(30, 41, 59, 0.4); /* Glassmorphic surface */
    --primary-color: #8b5cf6; /* Vibrant Purple */
    --primary-glow: rgba(139, 92, 246, 0.5);
    --secondary-color: #ec4899; /* Electric Pink */
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --border-color: rgba(255, 255, 255, 0.08);
    --border-hover: rgba(139, 92, 246, 0.4);
    --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    --font-family: 'Inter', sans-serif;
    --font-heading: 'Outfit', sans-serif;
}

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

body {
    font-family: var(--font-family);
    background-color: var(--bg-color);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    /* Immersive animated gradient mesh */
    background-image: 
        radial-gradient(circle at 10% 20%, rgba(139, 92, 246, 0.15) 0%, transparent 40%),
        radial-gradient(circle at 90% 80%, rgba(236, 72, 153, 0.1) 0%, transparent 40%);
    background-attachment: fixed;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Base Layout */
.app-container {
    display: flex;
    height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 280px;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    padding: 30px 0;
    transition: all 0.3s ease;
    z-index: 10;
}

.logo {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 0 30px 40px;
    font-family: var(--font-heading);
    font-size: 26px;
    font-weight: 700;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-color);
}

.logo i {
    color: var(--primary-color);
    font-size: 32px;
    filter: drop-shadow(0 0 8px var(--primary-glow));
}

.nav-menu {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 30px 20px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 14px 20px;
    text-decoration: none;
    color: var(--text-secondary);
    border-radius: 14px;
    font-weight: 500;
    font-size: 15px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.nav-link::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: -1;
    border-radius: 14px;
}

.nav-link:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
    transform: translateX(5px);
}

.nav-link.active {
    color: white;
    box-shadow: 0 4px 20px rgba(139, 92, 246, 0.3);
}

.nav-link.active::before {
    opacity: 1;
}

.nav-link i {
    font-size: 22px;
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.topbar {
    height: 90px;
    padding: 0 50px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border-color);
    background: rgba(11, 15, 25, 0.7);
    backdrop-filter: blur(12px);
    z-index: 5;
}

.search-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    border-radius: 100px;
    padding: 12px 24px;
    width: 400px;
    transition: all 0.3s ease;
}

.search-bar:focus-within {
    border-color: var(--primary-color);
    box-shadow: 0 0 15px rgba(139, 92, 246, 0.2);
    background: rgba(255, 255, 255, 0.05);
}

.search-bar input {
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 15px;
    width: 100%;
    outline: none;
    font-family: var(--font-family);
}

.search-bar input::placeholder {
    color: var(--text-secondary);
}

.search-bar i {
    color: var(--text-secondary);
    font-size: 20px;
}

.user-profile .avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    cursor: pointer;
    box-shadow: 0 0 15px rgba(139, 92, 246, 0.4);
    transition: transform 0.3s ease;
}

.user-profile .avatar:hover {
    transform: scale(1.1);
}

.workspace {
    flex: 1;
    padding: 50px;
    overflow-y: auto;
    position: relative;
}

/* Dynamic Tool Views */
.tool-header {
    margin-bottom: 40px;
    animation: fadeInDown 0.6s ease;
}

.tool-header h1 {
    font-family: var(--font-heading);
    font-size: 42px;
    font-weight: 700;
    margin-bottom: 12px;
    background: linear-gradient(to right, #fff, #a5b4fc);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.tool-header p {
    color: var(--text-secondary);
    font-size: 18px;
    max-width: 600px;
    line-height: 1.6;
}

/* Conversion Grid */
.conversion-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 24px;
    margin-bottom: 50px;
    animation: fadeIn 0.8s ease;
}

.convert-card {
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 30px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 16px;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    backdrop-filter: blur(12px);
    position: relative;
    overflow: hidden;
}

.convert-card::before {
    content: '';
    position: absolute;
    top: -50%; left: -50%; width: 200%; height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 60%);
    opacity: 0;
    transition: opacity 0.4s ease;
    pointer-events: none;
}

.convert-card:hover {
    transform: translateY(-8px);
    border-color: var(--border-hover);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.4), inset 0 0 0 1px rgba(139, 92, 246, 0.3);
    background: rgba(30, 41, 59, 0.6);
}

.convert-card:hover::before {
    opacity: 1;
}

.convert-card.selected {
    background: rgba(139, 92, 246, 0.15);
    border-color: var(--primary-color);
    box-shadow: 0 0 30px rgba(139, 92, 246, 0.2);
    transform: translateY(-5px) scale(1.02);
}

.convert-card i {
    font-size: 42px;
    color: var(--text-secondary);
    transition: all 0.4s ease;
}

.convert-card:hover i, .convert-card.selected i {
    color: var(--primary-color);
    transform: scale(1.1);
    filter: drop-shadow(0 0 8px var(--primary-glow));
}

.convert-card span {
    font-weight: 600;
    font-size: 15px;
    color: var(--text-primary);
}

/* Dropzone Interface */
.dropzone-container {
    background: rgba(15, 23, 42, 0.3);
    border: 2px dashed rgba(139, 92, 246, 0.3);
    border-radius: 30px;
    padding: 80px 40px;
    text-align: center;
    transition: all 0.4s ease;
    display: none; /* Block when active */
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 20px;
    position: relative;
    overflow: hidden;
}

.dropzone-container::after {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at center, rgba(139, 92, 246, 0.05) 0%, transparent 70%);
    pointer-events: none;
}

.dropzone-container.active {
    display: flex;
    animation: scaleIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.dropzone-container:hover, .dropzone-container.drag-over {
    border-color: var(--primary-color);
    background: rgba(139, 92, 246, 0.08);
}

.dropzone-container.drag-over {
    transform: scale(1.02);
}

.dropzone-icon {
    font-size: 80px;
    color: var(--primary-color);
    margin-bottom: 10px;
    filter: drop-shadow(0 10px 15px rgba(139, 92, 246, 0.3));
    animation: float 3s ease-in-out infinite;
}

.dropzone-text h3 {
    font-family: var(--font-heading);
    font-size: 28px;
    margin-bottom: 8px;
}

.dropzone-text p {
    color: var(--text-secondary);
    font-size: 16px;
    margin-bottom: 30px;
}

.btn-upload {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    border: none;
    padding: 16px 40px;
    border-radius: 50px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 8px 25px rgba(236, 72, 153, 0.3);
    position: relative;
    overflow: hidden;
}

.btn-upload::after {
    content: '';
    position: absolute;
    top: -50%; left: -50%; width: 200%; height: 200%;
    background: linear-gradient(to bottom right, rgba(255,255,255,0.2), rgba(255,255,255,0));
    transform: rotate(45deg);
    transition: all 0.3s ease;
}

.btn-upload:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 12px 30px rgba(236, 72, 153, 0.5);
}

/* File Active State */
.file-active-state {
    display: none;
    background: var(--surface-color);
    border: 1px solid rgba(139, 92, 246, 0.4);
    border-radius: 24px;
    padding: 40px;
    margin-top: 40px;
    text-align: center;
    backdrop-filter: blur(20px);
    box-shadow: 0 20px 40px rgba(0,0,0,0.4);
    animation: slideUp 0.5s ease;
}

.file-info {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    margin-bottom: 40px;
    background: rgba(0,0,0,0.2);
    padding: 20px;
    border-radius: 16px;
    display: inline-flex;
}

.file-info i {
    font-size: 48px;
    color: var(--primary-color);
}

.file-details {
    text-align: left;
}

.file-details h4 {
    font-size: 18px;
    margin-bottom: 6px;
    color: var(--text-primary);
}

.file-details p {
    color: var(--text-secondary);
    font-size: 14px;
}

/* Progress bar */
.progress-container {
    width: 100%;
    max-width: 600px;
    margin: 0 auto 40px;
    display: none;
}

.progress-bar {
    width: 100%;
    height: 12px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 12px;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.3);
}

.progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color), var(--primary-color));
    background-size: 200% 100%;
    border-radius: 10px;
    transition: width 0.3s ease;
    animation: gradientMove 2s linear infinite;
    box-shadow: 0 0 10px var(--primary-glow);
}

.progress-text {
    font-size: 15px;
    color: var(--text-secondary);
    font-weight: 500;
}

/* Action Buttons inside Active State */
.action-buttons {
    display: flex;
    gap: 20px;
    justify-content: center;
}

.btn-convert {
    background: rgba(139, 92, 246, 0.1);
    color: var(--primary-color);
    border: 1px solid var(--primary-color);
    padding: 14px 36px;
    border-radius: 50px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-convert:hover {
    background: var(--primary-color);
    color: white;
    box-shadow: 0 8px 25px rgba(139, 92, 246, 0.4);
    transform: translateY(-2px);
}

.btn-download {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
    border: none;
    padding: 14px 36px;
    border-radius: 50px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: none;
    box-shadow: 0 8px 25px rgba(16, 185, 129, 0.3);
}

.btn-download:hover {
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 12px 30px rgba(16, 185, 129, 0.4);
}

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

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

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

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

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-15px); }
}

@keyframes gradientMove {
    0% { background-position: 100% 0; }
    100% { background-position: -100% 0; }
}

/* Responsive Design */
@media (max-width: 992px) {
    .app-container {
        flex-direction: column;
    }
    .sidebar {
        width: 100%;
        flex-direction: row;
        height: auto;
        padding: 20px;
        overflow-x: auto;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
        align-items: center;
    }
    .logo {
        padding: 0 30px 0 0;
        margin-bottom: 0;
        border-bottom: none;
        border-right: 1px solid var(--border-color);
    }
    .nav-menu {
        flex-direction: row;
        padding: 0 0 0 30px;
        gap: 15px;
    }
    .nav-link {
        white-space: nowrap;
    }
    .topbar {
        padding: 0 30px;
    }
    .search-bar {
        width: auto;
        flex: 1;
        margin-right: 20px;
    }
    .workspace {
        padding: 30px;
    }
}

@media (max-width: 600px) {
    .conversion-grid {
        grid-template-columns: 1fr;
    }
    .dropzone-container {
        padding: 40px 20px;
    }
    .btn-upload {
        width: 100%;
    }
    .action-buttons {
        flex-direction: column;
    }
    .btn-convert, .btn-download {
        width: 100%;
    }
}
