:root {
    /* Light Theme Variables */
    --bg-color: #f0f4f8;
    --text-color: #1a202c;
    --card-bg: rgba(255, 255, 255, 0.7);
    --card-border: rgba(255, 255, 255, 0.4);
    --primary: #10B981;
    --primary-hover: #059669;
    --secondary: #E0E7FF;
    --danger: #EF4444;
    --success: #10B981;
    --blob-1: #cbb2ff;
    --blob-2: #10b981;
    --blob-3: #84fab0;
    --font-family: 'Outfit', sans-serif;
    --shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.1);
}

body.dark-theme {
    /* Dark Theme Variables */
    --bg-color: #0f172a;
    --text-color: #f8fafc;
    --card-bg: rgba(30, 41, 59, 0.7);
    --card-border: rgba(255, 255, 255, 0.1);
    --primary: #10B981;
    --primary-hover: #34d399;
    --secondary: #334155;
    --blob-1: #4c1d95;
    --blob-2: #064e3b;
    --blob-3: #047857;
    --shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
}

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

body {
    font-family: var(--font-family);
    background-color: var(--bg-color);
    color: var(--text-color);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    transition: background-color 0.4s ease, color 0.4s ease;
}

/* Background Animated Blobs */
.background-effects {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    z-index: -1;
    overflow: hidden;
    filter: blur(80px);
    opacity: 0.8;
}

.blob {
    position: absolute;
    border-radius: 50%;
    animation: float 15s infinite ease-in-out alternate;
}

.shape-1 { width: 400px; height: 400px; background: var(--blob-1); top: -10%; left: -10%; }
.shape-2 { width: 500px; height: 500px; background: var(--blob-2); bottom: -20%; right: -10%; animation-delay: -5s; }
.shape-3 { width: 300px; height: 300px; background: var(--blob-3); top: 40%; left: 40%; animation-delay: -10s; }

@keyframes float {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(50px, 50px) scale(1.1); }
}

/* Header */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 5%;
    background: var(--card-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--card-border);
    transition: background 0.4s ease;
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.logo {
    width: 45px;
    height: 45px;
    border-radius: 12px;
    object-fit: cover;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

.brand h1 {
    font-size: 1.5rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--primary), #a855f7);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.version-badge {
    font-size: 0.7rem;
    background: var(--primary);
    color: white;
    padding: 2px 6px;
    border-radius: 8px;
    vertical-align: top;
    margin-left: 5px;
}

/* Theme Toggle */
.theme-toggle {
    cursor: pointer;
    font-size: 1.5rem;
    transition: transform 0.3s ease;
    user-select: none;
}
.theme-toggle:hover {
    transform: scale(1.1);
}
body.dark-theme .sun { display: inline-block; }
body.dark-theme .moon { display: none; }
body:not(.dark-theme) .sun { display: none; }
body:not(.dark-theme) .moon { display: inline-block; }


/* Main Container */
.main-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 2rem 5%;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}

.hero {
    text-align: center;
    margin-bottom: 2.5rem;
}

.hero h2 {
    font-size: 2.5rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
}

.subtitle {
    font-size: 1.1rem;
    opacity: 0.8;
}

/* Glass Card */
.glass-card {
    background: var(--card-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--card-border);
    border-radius: 20px;
    box-shadow: var(--shadow);
    padding: 2rem;
    width: 100%;
    max-width: 800px;
    margin-bottom: 2rem;
    position: relative;
    overflow: hidden;
}

/* Tabs */
.tabs-container {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    background: var(--card-bg);
    padding: 0.5rem;
    border-radius: 16px;
    backdrop-filter: blur(10px);
    flex-wrap: wrap;
    justify-content: center;
}

.tab-btn {
    background: transparent;
    border: none;
    padding: 0.8rem 1.5rem;
    border-radius: 12px;
    color: var(--text-color);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-family: var(--font-family);
}

.tab-btn:hover {
    background: var(--secondary);
}

.tab-btn.active {
    background: var(--primary);
    color: white;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
}

/* Drop Zone */
.drop-zone {
    border: 2px dashed var(--primary);
    border-radius: 16px;
    padding: 3rem 1rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: rgba(var(--primary), 0.02);
}

.drop-zone.dragover {
    background: rgba(99, 102, 241, 0.1);
    border-color: var(--primary-hover);
    transform: scale(1.02);
}

.upload-icon {
    font-size: 3rem;
    display: block;
    margin-bottom: 1rem;
    animation: bounce 2s infinite;
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
    40% { transform: translateY(-10px); }
    60% { transform: translateY(-5px); }
}

.browse-btn {
    margin-top: 1rem;
    background: var(--secondary);
    color: var(--text-color);
    border: none;
    padding: 0.8rem 1.5rem;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.browse-btn:hover {
    background: var(--primary);
    color: white;
}

.mt-1 { margin-top: 1rem; }

/* Preview Area */
.hidden { display: none !important; }

.preview-area {
    margin-top: 2rem;
    animation: fadeIn 0.4s ease;
}

.file-list {
    margin-top: 1rem;
    max-height: 400px;
    overflow-y: auto;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 1rem;
    padding: 0.5rem;
}

.file-list::-webkit-scrollbar { width: 6px; }
.file-list::-webkit-scrollbar-thumb { background: var(--primary); border-radius: 10px; }

.file-item {
    position: relative;
    background: linear-gradient(135deg, #1e3a8a, #064e3b);
    border-radius: 14px;
    overflow: hidden;
    height: 130px;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 4px 15px rgba(0,0,0,0.15);
    cursor: grab;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.file-item:hover {
    transform: scale(1.03);
}

.file-item:active {
    cursor: grabbing;
    transform: scale(0.95);
    box-shadow: 0 8px 25px rgba(0,0,0,0.3);
}

.sortable-ghost {
    opacity: 0.3;
    transform: scale(0.9);
}

.file-thumbnail {
    width: 100%;
    height: 100%;
    object-fit: cover;
    pointer-events: none;
}

.file-icon {
    font-size: 2.5rem;
    color: rgba(255,255,255,0.8);
    pointer-events: none;
}

.file-name-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    background: rgba(0,0,0,0.6);
    color: white;
    font-size: 0.7rem;
    padding: 6px 6px 6px 35px;
    text-align: left;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    pointer-events: none;
    box-sizing: border-box;
}

.file-index {
    position: absolute;
    bottom: 4px;
    left: 4px;
    background: rgba(0,0,0,0.8);
    color: white;
    font-weight: 800;
    font-size: 0.7rem;
    min-width: 22px;
    height: 22px;
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 50%;
    z-index: 2;
    pointer-events: none;
}

.remove-file {
    position: absolute;
    top: 6px;
    right: 6px;
    background: rgba(0,0,0,0.6);
    border: none;
    color: white;
    cursor: pointer;
    font-size: 0.7rem;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: all 0.2s ease;
    z-index: 2;
}

.remove-file:hover {
    background: var(--danger);
    transform: scale(1.1);
}

.action-buttons {
    display: flex;
    gap: 1rem;
    margin-top: 1.5rem;
    justify-content: flex-end;
}

.primary-btn {
    background: var(--primary);
    color: white;
    border: none;
    padding: 0.8rem 2rem;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

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

.secondary-btn {
    background: transparent;
    color: var(--text-color);
    border: 1px solid var(--primary);
    padding: 0.8rem 1.5rem;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.secondary-btn:hover {
    background: var(--secondary);
}

/* Progress Overlay */
.progress-overlay {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: var(--card-bg);
    backdrop-filter: blur(10px);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 10;
    border-radius: 20px;
}

.spinner {
    width: 50px; height: 50px;
    border: 5px solid var(--secondary);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

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

/* Future Scope */
.future-scope h3 { margin-bottom: 1.5rem; text-align: center; }
.scope-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
}

.scope-item {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    padding: 1.5rem;
    text-align: center;
    transition: all 0.3s ease;
}

.scope-item:hover {
    transform: translateY(-5px);
    background: rgba(255, 255, 255, 0.1);
}

.scope-item .icon { font-size: 2rem; display: block; margin-bottom: 0.5rem; }
.scope-item h4 { margin-bottom: 1rem; font-size: 1.1rem; }
.badge {
    background: linear-gradient(135deg, #f59e0b, #ef4444);
    color: white;
    font-size: 0.75rem;
    padding: 4px 10px;
    border-radius: 12px;
    font-weight: 600;
}

/* Footer */
.footer {
    text-align: center;
    padding: 2rem;
    background: var(--card-bg);
    backdrop-filter: blur(10px);
    border-top: 1px solid var(--card-border);
    margin-top: auto;
}

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

.footer a:hover { text-decoration: underline; }

/* Modal */
.modal {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(5px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
}

.modal-content {
    max-width: 450px;
    padding: 2.5rem;
    text-align: center;
}

.modal-actions {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-top: 1.5rem;
}

.modal-btn {
    padding: 1rem;
    border-radius: 12px;
    border: none;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.merge-btn { background: var(--primary); color: white; }
.zip-btn { background: #10B981; color: white; }
.modal-btn:hover { transform: scale(1.02); filter: brightness(1.1); }

.close-btn {
    position: absolute;
    top: 1rem; right: 1.5rem;
    background: transparent;
    border: none;
    color: var(--text-color);
    font-size: 1.5rem;
    cursor: pointer;
}

/* Toasts */
.toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 1000;
}

.toast {
    padding: 1rem 1.5rem;
    border-radius: 12px;
    color: white;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    animation: slideIn 0.3s ease, slideOut 0.3s ease 2.7s forwards;
}

.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }

@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes slideOut { from { transform: translateX(0); opacity: 1; } to { transform: translateX(100%); opacity: 0; } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* Animations */
.animate-up {
    animation: slideUp 0.6s ease-out forwards;
    opacity: 0;
    transform: translateY(20px);
}

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

.hero .animate-up:nth-child(1) { animation-delay: 0.1s; }
.hero .animate-up:nth-child(2) { animation-delay: 0.2s; }
.tabs-container.animate-up { animation-delay: 0.3s; }
.tool-section.animate-up { animation-delay: 0.4s; }
.future-scope.animate-up { animation-delay: 0.5s; }

/* Advanced Options Container */
.options-container {
    margin-top: 1.5rem;
    padding: 1.2rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--card-border);
    border-radius: 12px;
}

.options-container h5 {
    margin-bottom: 1rem;
    font-size: 1.1rem;
    color: var(--primary);
    text-align: left;
}

.options-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    text-align: left;
}

.option-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.option-group label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-color);
}

.toggle-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}

.inline-inputs {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.mt-half { margin-top: 0.5rem; }

.input-light, .select-light {
    background: var(--bg-color);
    border: 1px solid var(--card-border);
    color: var(--text-color);
    padding: 0.4rem 0.6rem;
    border-radius: 6px;
    font-family: inherit;
    font-size: 0.9rem;
    width: 100%;
}

.input-light:focus, .select-light:focus {
    outline: none;
    border-color: var(--primary);
}

.watermark-input {
    width: 100%;
}

input[type="color"] {
    -webkit-appearance: none;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    background: none;
}
input[type="color"]::-webkit-color-swatch-wrapper {
    padding: 0;
}
input[type="color"]::-webkit-color-swatch {
    border: 2px solid var(--card-border);
    border-radius: 6px;
}
input[type="color"]:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Responsive Grid/Flexbox */
@media (max-width: 600px) {
    .hero h2 { font-size: 2rem; }
    .tabs-container { gap: 0.5rem; }
    .tab-btn { padding: 0.6rem 1rem; font-size: 0.9rem; }
    .drop-zone { padding: 2rem 1rem; }
    .options-grid { grid-template-columns: 1fr; }
}

/* V1.3.0 Extrusion Mappings */
.list-header-group {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--card-border);
    padding-bottom: 0.5rem;
}

.list-controls {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.icon-btn {
    background: var(--card-border);
    border: none;
    border-radius: 6px;
    padding: 0.4rem 0.6rem;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.2s ease;
}

.icon-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.icon-btn:not(:disabled):hover {
    background: var(--primary);
}

.small-btn {
    padding: 0.4rem 0.8rem;
    font-size: 0.8rem;
    border-radius: 6px;
}

.modal-large {
    max-width: 800px;
    width: 95%;
    padding: 1.5rem;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--card-border);
}

.modal-body-scroll {
    overflow-y: auto;
    max-height: 80vh;
    border-radius: 8px;
}

.download-history {
    background: var(--secondary);
    padding: 1rem;
    border-radius: 8px;
    margin-top: 1rem;
    border: 1px solid var(--card-border);
}

#history-list {
    list-style: none;
    padding: 0;
    margin: 0.5rem 0 0 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

#history-list li a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
    display: flex;
    align-items: center;
    background: var(--bg-color);
    padding: 0.5rem 1rem;
    border-radius: 6px;
    transition: all 0.2s ease;
}

#history-list li a:hover {
    filter: brightness(1.2);
    transform: translateX(5px);
}
