/* Global Styles & Variables */
:root {
    --bg-dark: #090d16;
    --bg-card: rgba(17, 24, 39, 0.65);
    --border-color: rgba(255, 255, 255, 0.08);
    --border-hover: rgba(99, 102, 241, 0.4);
    
    --text-primary: #f3f4f6;
    --text-secondary: #9ca3af;
    --text-muted: #6b7280;
    
    --primary-gradient: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #d946ef 100%);
    --quark-gradient: linear-gradient(135deg, #00c6ff 0%, #0072ff 100%);
    --primary-color: #6366f1;
    --primary-hover: #4f46e5;
    
    --success-color: #10b981;
    --success-bg: rgba(16, 185, 129, 0.1);
    --error-color: #ef4444;
    --error-bg: rgba(239, 68, 68, 0.1);
    
    --sidebar-width: 280px;
    --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

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

body::before {
    content: '';
    position: absolute;
    top: -20%;
    left: -10%;
    width: 60vw;
    height: 60vw;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.15) 0%, rgba(0,0,0,0) 70%);
    z-index: -1;
    pointer-events: none;
}

body::after {
    content: '';
    position: absolute;
    bottom: -10%;
    right: -10%;
    width: 50vw;
    height: 50vw;
    background: radial-gradient(circle, rgba(217, 70, 239, 0.1) 0%, rgba(0,0,0,0) 70%);
    z-index: -1;
    pointer-events: none;
}

.app-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar Styling */
.sidebar {
    width: var(--sidebar-width);
    background: rgba(7, 10, 19, 0.8);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    padding: 2rem 1.5rem;
    position: fixed;
    height: 100vh;
    z-index: 10;
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 2rem;
}

.brand-icon {
    width: 28px;
    height: 28px;
    color: var(--primary-color);
    animation: rotate 12s linear infinite;
}

.brand-name {
    font-size: 1.4rem;
    font-weight: 700;
    letter-spacing: -0.5px;
    background: linear-gradient(135deg, #ffffff 0%, #a5b4fc 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.nav-menu {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    flex-grow: 1;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: none;
    border: none;
    color: var(--text-secondary);
    padding: 0.85rem 1rem;
    border-radius: 12px;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 500;
    text-align: left;
    transition: var(--transition-smooth);
}

.nav-item i {
    width: 20px;
    height: 20px;
    transition: var(--transition-smooth);
}

.nav-item:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.04);
}

.nav-item.active {
    color: #ffffff;
    background: rgba(99, 102, 241, 0.15);
    border: 1px solid rgba(99, 102, 241, 0.25);
    box-shadow: 0 4px 20px rgba(99, 102, 241, 0.1);
}

.nav-item.active i {
    color: var(--primary-color);
}

.sidebar-footer {
    border-top: 1px solid var(--border-color);
    padding-top: 1rem;
    font-size: 0.8rem;
    color: var(--text-muted);
    text-align: center;
    line-height: 1.5;
}

.sidebar-footer .sub-text {
    font-size: 0.75rem;
    color: var(--primary-color);
    opacity: 0.8;
}

/* Main Content Area */
.main-content {
    margin-left: var(--sidebar-width);
    flex-grow: 1;
    padding: 3rem 4rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    max-width: 1200px;
    width: calc(100% - var(--sidebar-width));
}

.workspace-header {
    animation: slideUp 0.5s ease-out;
}

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

.workspace-header h1 {
    font-size: 2.2rem;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.limit-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(99, 102, 241, 0.12);
    border: 1px solid rgba(99, 102, 241, 0.3);
    padding: 0.45rem 1rem;
    border-radius: 20px;
    font-size: 0.9rem;
    color: var(--text-primary);
}

.limit-badge i {
    width: 18px;
    height: 18px;
    color: var(--primary-color);
}

.limit-badge strong {
    color: #a5b4fc;
    font-size: 1rem;
}

.tool-description {
    color: var(--text-secondary);
    font-size: 1.05rem;
}

/* Prominent Workspace Banner */
.workspace-promo-banner {
    background: linear-gradient(135deg, rgba(0, 198, 255, 0.08) 0%, rgba(99, 102, 241, 0.1) 100%);
    border: 1px solid rgba(0, 198, 255, 0.25);
    border-radius: 18px;
    padding: 1.25rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
    animation: fadeIn 0.5s ease-out;
}

.promo-banner-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.promo-icon-box {
    width: 44px;
    height: 44px;
    background: rgba(0, 198, 255, 0.15);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.promo-icon-box i {
    width: 24px;
    height: 24px;
    color: #00c6ff;
}

.promo-banner-left h4 {
    font-size: 1rem;
    font-weight: 600;
    color: #ffffff;
    margin-bottom: 0.2rem;
}

.promo-banner-left p {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.btn-quark-sm {
    background: var(--quark-gradient);
    color: white;
    padding: 0.65rem 1.25rem;
    font-size: 0.85rem;
    font-weight: 600;
    border-radius: 10px;
    text-decoration: none;
    white-space: nowrap;
    transition: var(--transition-smooth);
    box-shadow: 0 4px 12px rgba(0, 198, 255, 0.25);
}

.btn-quark-sm:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(0, 198, 255, 0.4);
}

.workspace-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 24px;
    padding: 2.5rem;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    min-height: 380px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    position: relative;
    overflow: hidden;
    animation: fadeIn 0.6s ease-out;
}

/* Dropzone */
.dropzone {
    border: 2px dashed var(--border-color);
    border-radius: 18px;
    padding: 4rem 2rem;
    text-align: center;
    cursor: pointer;
    transition: var(--transition-smooth);
    background: rgba(255, 255, 255, 0.01);
    position: relative;
}

.dropzone:hover, .dropzone.dragover {
    border-color: var(--primary-color);
    background: rgba(99, 102, 241, 0.03);
    box-shadow: 0 0 20px rgba(99, 102, 241, 0.05);
}

.dropzone-prompt {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.25rem;
}

.upload-icon-container {
    width: 72px;
    height: 72px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-smooth);
}

.dropzone:hover .upload-icon-container, .dropzone.dragover .upload-icon-container {
    transform: translateY(-5px);
    background: rgba(99, 102, 241, 0.1);
    border-color: var(--border-hover);
}

.upload-icon {
    width: 32px;
    height: 32px;
    color: var(--text-secondary);
    transition: var(--transition-smooth);
}

.dropzone:hover .upload-icon, .dropzone.dragover .upload-icon {
    color: var(--primary-color);
}

.dropzone h3 {
    font-size: 1.2rem;
    font-weight: 500;
}

.dropzone h3 span {
    color: var(--primary-color);
    text-decoration: underline;
    text-underline-offset: 4px;
}

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

/* File Queue */
.file-queue-container {
    animation: fadeIn 0.4s ease-out;
}

.file-queue-container h4 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--text-secondary);
}

.file-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 2rem;
    max-height: 250px;
    overflow-y: auto;
    padding-right: 0.5rem;
}

.file-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    padding: 0.85rem 1.25rem;
    border-radius: 12px;
    animation: slideUp 0.3s ease-out;
}

.file-item-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.file-item-info i {
    color: var(--primary-color);
    width: 18px;
    height: 18px;
}

.file-name {
    font-size: 0.95rem;
    font-weight: 500;
    max-width: 350px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

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

.btn-remove {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 6px;
    transition: var(--transition-smooth);
    display: flex;
    align-items: center;
    justify-content: center;
}

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

/* Action Buttons */
.action-bar {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    font-size: 0.95rem;
    font-weight: 600;
    border-radius: 12px;
    cursor: pointer;
    transition: var(--transition-smooth);
    border: 1px solid transparent;
    text-decoration: none;
}

.btn-primary {
    background: var(--primary-gradient);
    color: #ffffff;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.4);
}

.btn-quark {
    background: var(--quark-gradient);
    color: #ffffff;
    box-shadow: 0 4px 15px rgba(0, 198, 255, 0.3);
}

.btn-quark:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 198, 255, 0.4);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.08);
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
}

.btn-outline:hover {
    border-color: var(--primary-color);
    color: #ffffff;
}

/* Status Loading UI */
.status-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
    animation: fadeIn 0.4s ease-out;
}

.loader-spinner {
    width: 60px;
    height: 60px;
    border: 4px solid rgba(255, 255, 255, 0.05);
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    animation: rotate 1s linear infinite;
}

.progress-bar-container {
    width: 100%;
    max-width: 400px;
    height: 6px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 3px;
    overflow: hidden;
    margin-top: 0.5rem;
}

.progress-bar {
    height: 100%;
    background: var(--primary-gradient);
    border-radius: 3px;
    transition: width 0.2s ease-out;
}

/* Success & Error UI */
.success-container, .error-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
    animation: scaleUp 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.success-icon-container {
    width: 80px;
    height: 80px;
    background: var(--success-bg);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.success-icon {
    width: 40px;
    height: 40px;
    color: var(--success-color);
}

.success-actions {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
}

.error-icon-container {
    width: 80px;
    height: 80px;
    background: var(--error-bg);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.error-icon {
    width: 40px;
    height: 40px;
    color: var(--error-color);
}

/* Unlock Modal Glassmorphism Overlay */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    animation: fadeIn 0.3s ease-out;
}

.modal-card {
    background: rgba(17, 24, 39, 0.95);
    border: 1px solid rgba(0, 198, 255, 0.4);
    border-radius: 24px;
    padding: 2.5rem;
    max-width: 520px;
    width: 100%;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    animation: scaleUp 0.3s ease-out;
}

.modal-header {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
}

.modal-icon-container {
    width: 64px;
    height: 64px;
    background: rgba(239, 68, 68, 0.12);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-icon {
    width: 32px;
    height: 32px;
    color: var(--error-color);
}

.modal-header h2 {
    font-size: 1.4rem;
    font-weight: 700;
}

.modal-header p {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

.modal-body {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.modal-body .btn-quark {
    width: 100%;
    padding: 0.9rem;
    font-size: 0.95rem;
}

.unlock-input-group {
    display: flex;
    gap: 0.5rem;
}

.unlock-input-group input {
    flex-grow: 1;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 0.75rem 1rem;
    color: white;
    font-size: 0.95rem;
    outline: none;
    transition: var(--transition-smooth);
}

.unlock-input-group input:focus {
    border-color: var(--primary-color);
    background: rgba(99, 102, 241, 0.05);
}

.unlock-tip {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-align: center;
    line-height: 1.4;
}

.modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0.5rem;
    transition: var(--transition-smooth);
}

.modal-close:hover {
    color: white;
}

/* Animations */
@keyframes rotate {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

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

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

@keyframes scaleUp {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}

/* Responsiveness */
@media (max-width: 1024px) {
    .app-container { flex-direction: column; }
    .sidebar { width: 100%; height: auto; position: relative; border-right: none; border-bottom: 1px solid var(--border-color); padding: 1.5rem; }
    .brand { margin-bottom: 1.5rem; justify-content: center; }
    .nav-menu { flex-direction: row; flex-wrap: wrap; justify-content: center; gap: 0.5rem; }
    .nav-item { padding: 0.6rem 0.85rem; font-size: 0.85rem; }
    .main-content { margin-left: 0; width: 100%; padding: 2rem 1.5rem; }
    .workspace-promo-banner { flex-direction: column; align-items: flex-start; }
    .btn-quark-sm { width: 100%; text-align: center; }
}
