:root {
    --bg-primary: #0f0f23;
    --bg-secondary: #1a1a2e;
    --bg-card: #16213e;
    --bg-hover: #1e2a4a;
    --text-primary: #e0e0e0;
    --text-secondary: #a0a0b0;
    --accent: #6c63ff;
    --accent-hover: #5a52d5;
    --accent-glow: rgba(108, 99, 255, 0.3);
    --danger: #ff4757;
    --success: #2ed573;
    --warning: #ffa502;
    --border: #2a2a4a;
    --sidebar-bg: #0d0d1f;
    --shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

[data-theme="light"] {
    --bg-primary: #f0f2f5;
    --bg-secondary: #ffffff;
    --bg-card: #ffffff;
    --bg-hover: #f5f5ff;
    --text-primary: #1a1a2e;
    --text-secondary: #666680;
    --accent: #6c63ff;
    --accent-hover: #5a52d5;
    --accent-glow: rgba(108, 99, 255, 0.15);
    --border: #e0e0e8;
    --sidebar-bg: #ffffff;
    --shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
}

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--accent);
}

/* Sidebar */
.sidebar {
    width: 260px;
    min-width: 260px;
    height: 100vh;
    background: var(--sidebar-bg);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    left: 0;
    top: 0;
    z-index: 100;
    transition: transform 0.3s;
}

.sidebar.collapsed {
    transform: translateX(-260px);
}

.sidebar-header {
    padding: 24px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid var(--border);
}

.logo-icon {
    font-size: 28px;
    color: var(--accent);
    filter: drop-shadow(0 0 10px var(--accent-glow));
}

.logo-text {
    font-size: 20px;
    font-weight: 700;
    background: linear-gradient(135deg, var(--accent), #ff6b6b);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.sidebar-menu {
    list-style: none;
    padding: 16px 12px;
    flex: 1;
}

.sidebar-menu li {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: 10px;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all 0.2s;
    margin-bottom: 4px;
    font-size: 14px;
}

.sidebar-menu li:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.sidebar-menu li.active {
    background: var(--accent);
    color: white;
    box-shadow: 0 4px 15px var(--accent-glow);
}

.sidebar-menu li i {
    width: 20px;
    text-align: center;
    font-size: 16px;
}

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--accent), #ff6b6b);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 14px;
}

.user-name {
    font-size: 14px;
    font-weight: 600;
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.logout-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 18px;
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    transition: all 0.2s;
}

.logout-btn:hover {
    color: var(--danger);
    background: rgba(255, 71, 87, 0.1);
}

/* Top Bar */
.topbar {
    position: fixed;
    top: 0;
    left: 260px;
    right: 0;
    height: 64px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    z-index: 50;
    transition: left 0.3s;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.menu-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 20px;
    cursor: pointer;
    padding: 8px;
}

.page-title {
    font-size: 20px;
    font-weight: 600;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.search-box {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 8px 14px;
    width: 260px;
}

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

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

.lang-selector {
    display: flex;
    align-items: center;
    gap: 6px;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 8px 12px;
}

.lang-selector i {
    color: var(--accent);
    font-size: 14px;
}

.lang-selector select {
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 13px;
    cursor: pointer;
    outline: none;
}

.lang-selector select option {
    background: var(--bg-card);
    color: var(--text-primary);
}

.theme-btn {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 8px 12px;
    cursor: pointer;
    color: var(--text-primary);
    font-size: 16px;
    transition: all 0.3s;
}

.theme-btn:hover {
    background: var(--accent);
    color: white;
}

/* Main Content */
.main-content {
    margin-left: 260px;
    margin-top: 64px;
    padding: 24px;
    flex: 1;
    min-height: calc(100vh - 64px);
    transition: margin-left 0.3s;
}

.content-section {
    display: none;
}

.content-section.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

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

/* Section Header */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.section-header h3 {
    font-size: 18px;
    font-weight: 600;
}

.view-toggle {
    display: flex;
    gap: 4px;
    background: var(--bg-card);
    border-radius: 8px;
    padding: 4px;
}

.view-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    padding: 6px 10px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.view-btn.active {
    background: var(--accent);
    color: white;
}

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

.projects-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.project-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 20px;
    cursor: pointer;
    transition: all 0.3s;
    position: relative;
    overflow: hidden;
}

.project-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--accent), #ff6b6b);
    opacity: 0;
    transition: opacity 0.3s;
}

.project-card:hover {
    border-color: var(--accent);
    transform: translateY(-4px);
    box-shadow: 0 8px 30px var(--accent-glow);
}

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

.project-card-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 12px;
}

.project-card-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: white;
}

.project-card-actions {
    display: flex;
    gap: 4px;
}

.project-action-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    padding: 6px 8px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 14px;
}

.project-action-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.project-action-btn.delete:hover {
    color: var(--danger);
    background: rgba(255, 71, 87, 0.1);
}

.project-card h4 {
    font-size: 16px;
    margin-bottom: 6px;
}

.project-card-meta {
    display: flex;
    gap: 12px;
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.project-card-meta span {
    display: flex;
    align-items: center;
    gap: 4px;
}

.project-card-tags {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.tag {
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
}

.tag.lang {
    background: rgba(108, 99, 255, 0.15);
    color: var(--accent);
}

.tag.engine {
    background: rgba(255, 107, 107, 0.15);
    color: #ff6b6b;
}

.tag.category {
    background: rgba(46, 213, 115, 0.15);
    color: #2ed573;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 80px 20px;
}

.empty-state i {
    font-size: 64px;
    color: var(--text-secondary);
    opacity: 0.3;
    margin-bottom: 20px;
}

.empty-state h3 {
    font-size: 20px;
    margin-bottom: 8px;
}

.empty-state p {
    color: var(--text-secondary);
    margin-bottom: 24px;
}

.create-first-btn {
    padding: 12px 24px;
    background: var(--accent);
    border: none;
    border-radius: 10px;
    color: white;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.create-first-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px var(--accent-glow);
}

/* Create Wizard */
.create-wizard {
    max-width: 900px;
    margin: 0 auto;
}

.wizard-steps {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-bottom: 40px;
}

.wizard-step {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: 10px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    transition: all 0.3s;
    font-size: 13px;
}

.wizard-step.active {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
}

.wizard-step.completed {
    background: rgba(46, 213, 115, 0.15);
    border-color: var(--success);
    color: var(--success);
}

.step-number {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 13px;
}

.wizard-step.completed .step-number {
    background: var(--success);
    color: white;
}

.wizard-content h3 {
    text-align: center;
    margin-bottom: 24px;
    font-size: 22px;
}

.options-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
}

.option-card {
    background: var(--bg-card);
    border: 2px solid var(--border);
    border-radius: 14px;
    padding: 24px 16px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
}

.option-card:hover {
    border-color: var(--accent);
    transform: translateY(-4px);
    box-shadow: 0 8px 30px var(--accent-glow);
}

.option-card.selected {
    border-color: var(--accent);
    background: rgba(108, 99, 255, 0.1);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.option-card.disabled {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
}

.option-icon {
    width: 56px;
    height: 56px;
    margin: 0 auto 12px;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--accent), #ff6b6b);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: white;
}

.option-card h4 {
    margin-bottom: 6px;
    font-size: 15px;
}

.option-card p {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.4;
}

/* Project Details */
.details-form {
    max-width: 600px;
    margin: 0 auto;
}

.detail-group {
    margin-bottom: 20px;
}

.detail-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    font-size: 14px;
}

.detail-group input,
.detail-group textarea {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-card);
    border: 2px solid var(--border);
    border-radius: 10px;
    color: var(--text-primary);
    font-size: 15px;
    outline: none;
    transition: border-color 0.3s;
    font-family: inherit;
}

.detail-group input:focus,
.detail-group textarea:focus {
    border-color: var(--accent);
}

.project-summary {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 20px;
    margin-top: 24px;
}

.project-summary h4 {
    margin-bottom: 16px;
    font-size: 16px;
}

.summary-items {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.summary-item {
    display: flex;
    justify-content: space-between;
    font-size: 14px;
}

.summary-item span {
    color: var(--text-secondary);
}

/* Wizard Navigation */
.wizard-nav {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-top: 32px;
}

.nav-btn {
    padding: 12px 28px;
    border: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 8px;
}

.prev-btn {
    background: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--border);
}

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

.next-btn {
    background: var(--accent);
    color: white;
}

.next-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px var(--accent-glow);
}

.next-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.confirm-btn {
    background: linear-gradient(135deg, var(--success), #00b894);
    color: white;
}

.confirm-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(46, 213, 115, 0.3);
}

/* Templates */
.templates-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
}

.template-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    overflow: hidden;
    transition: all 0.3s;
}

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

.template-preview {
    height: 140px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 48px;
    color: white;
}

.template-card h4 {
    padding: 16px 16px 4px;
    font-size: 15px;
}

.template-card p {
    padding: 0 16px;
    font-size: 13px;
    color: var(--text-secondary);
}

.use-template-btn {
    margin: 12px 16px 16px;
    padding: 8px 16px;
    background: var(--accent);
    border: none;
    border-radius: 8px;
    color: white;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.use-template-btn:hover {
    background: var(--accent-hover);
}

/* Learn & Community */
.learn-grid,
.community-content {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.learn-card,
.community-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 32px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
}

.learn-card:hover,
.community-card:hover {
    border-color: var(--accent);
    transform: translateY(-4px);
    box-shadow: 0 8px 30px var(--accent-glow);
}

.learn-card i,
.community-card i {
    font-size: 40px;
    color: var(--accent);
    margin-bottom: 16px;
}

.learn-card h4,
.community-card h4 {
    margin-bottom: 8px;
    font-size: 17px;
}

.learn-card p,
.community-card p {
    color: var(--text-secondary);
    font-size: 14px;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.show {
    display: flex;
}

.modal-content {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 32px;
    max-width: 400px;
    width: 90%;
}

.modal-content h3 {
    margin-bottom: 12px;
    font-size: 18px;
}

.modal-content p {
    color: var(--text-secondary);
    margin-bottom: 24px;
    font-size: 14px;
}

.modal-buttons {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

.modal-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.modal-btn.cancel {
    background: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.modal-btn.danger {
    background: var(--danger);
    color: white;
}

.modal-btn.primary {
    background: var(--accent);
    color: white;
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-260px);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .topbar {
        left: 0;
    }

    .main-content {
        margin-left: 0;
    }

    .menu-toggle {
        display: block;
    }

    .search-box {
        width: 160px;
    }

    .wizard-steps {
        flex-wrap: wrap;
    }

    .options-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }
}