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

:root {
    --primary: #6C5CE7;
    --primary-dark: #5A4BD1;
    --secondary: #00CEC9;
    --bg: #F8F9FA;
    --surface: #FFFFFF;
    --text: #2D3436;
    --text-light: #636E72;
    --border: #DFE6E9;
    --radius: 12px;
    --shadow: 0 2px 12px rgba(0,0,0,0.08);
    --shadow-lg: 0 8px 32px rgba(0,0,0,0.12);
}

body {
    font-family: 'Inter', -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.container { max-width: 1200px; margin: 0 auto; padding: 0 24px; width: 100%; }

/* Navbar */
.navbar {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(8px);
}
.nav-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 64px;
}
.nav-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    font-weight: 700;
    font-size: 1.2rem;
    color: var(--text);
}
.nav-links {
    display: flex;
    align-items: center;
    gap: 20px;
}
.nav-links a {
    text-decoration: none;
    color: var(--text-light);
    font-weight: 500;
    font-size: 0.9rem;
    transition: color 0.2s;
}
.nav-links a:hover { color: var(--primary); }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 24px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.9rem;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
}
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); transform: translateY(-1px); }
.btn-outline { background: transparent; color: var(--text); border: 1px solid var(--border); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }
.btn-danger { background: #E74C3C; color: white; }
.btn-danger:hover { background: #C0392B; }
.btn-sm { padding: 6px 16px; font-size: 0.8rem; }
.btn-lg { padding: 14px 32px; font-size: 1rem; }

/* Forms */
.form-group { margin-bottom: 20px; }
.form-group label {
    display: block;
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text);
    margin-bottom: 6px;
}
.form-input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-size: 0.95rem;
    font-family: inherit;
    transition: border-color 0.2s;
    background: var(--surface);
}
.form-input:focus {
    outline: none;
    border-color: var(--primary);
}
.form-input.error { border-color: #E74C3C; }

/* Cards */
.card {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 24px;
    transition: transform 0.2s, box-shadow 0.2s;
}
.card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }

/* Auth Pages */
.auth-page {
    min-height: calc(100vh - 64px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 24px;
}
.auth-card {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    padding: 48px;
    width: 100%;
    max-width: 440px;
}
.auth-card h1 {
    font-size: 1.8rem;
    margin-bottom: 8px;
}
.auth-card p {
    color: var(--text-light);
    margin-bottom: 32px;
}
.auth-footer {
    text-align: center;
    margin-top: 24px;
    font-size: 0.9rem;
    color: var(--text-light);
}
.auth-footer a { color: var(--primary); text-decoration: none; font-weight: 600; }

.alert {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 0.9rem;
    font-weight: 500;
}
.alert-error { background: #FEE2E2; color: #DC2626; border: 1px solid #FECACA; }
.alert-success { background: #D1FAE5; color: #059669; border: 1px solid #A7F3D0; }

/* Landing Page */
.hero {
    text-align: center;
    padding: 80px 24px;
    max-width: 800px;
    margin: 0 auto;
}
.hero h1 {
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: 16px;
    line-height: 1.2;
}
.hero h1 span { color: var(--primary); }
.hero p {
    font-size: 1.2rem;
    color: var(--text-light);
    margin-bottom: 40px;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}
.hero-actions { display: flex; gap: 16px; justify-content: center; }

.features {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 24px;
    padding: 40px 24px 80px;
    max-width: 1200px;
    margin: 0 auto;
}
.feature-card {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 32px;
    text-align: center;
    box-shadow: var(--shadow);
}
.feature-card .icon {
    width: 64px;
    height: 64px;
    border-radius: 16px;
    background: rgba(108,92,231,0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    font-size: 1.5rem;
}
.feature-card h3 { margin-bottom: 8px; }
.feature-card p { color: var(--text-light); font-size: 0.9rem; }

/* Dashboard */
.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 40px 0 24px;
}
.dashboard-header h1 { font-size: 1.8rem; }

.project-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    padding-bottom: 40px;
}

.project-card {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
    text-decoration: none;
    color: inherit;
    display: block;
}
.project-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.project-preview {
    height: 200px;
    background: #F0F0F0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    color: var(--text-light);
}
.project-info { padding: 20px; }
.project-info h3 { margin-bottom: 4px; font-size: 1rem; }
.project-info p { color: var(--text-light); font-size: 0.8rem; }

.project-card.empty {
    border: 2px dashed var(--border);
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 280px;
    cursor: pointer;
}
.project-card.empty:hover { border-color: var(--primary); }
.project-card.empty .empty-content { text-align: center; color: var(--text-light); }
.project-card.empty .empty-content .icon { font-size: 3rem; margin-bottom: 12px; }

/* Tool Page */
.tool-page {
    padding: 24px 0;
}
.tool-layout {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 24px;
    min-height: calc(100vh - 180px);
}
.tool-sidebar {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 24px;
    overflow-y: auto;
    max-height: calc(100vh - 180px);
}
.tool-sidebar h2 {
    font-size: 1.1rem;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}
.tool-canvas {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    position: relative;
}
.tool-canvas canvas {
    display: block;
    width: 100%;
}
.tool-canvas-controls {
    position: absolute;
    bottom: 16px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 8px;
}

.option-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 16px;
}
.option-item {
    padding: 10px;
    border: 2px solid var(--border);
    border-radius: 8px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.8rem;
    font-weight: 500;
}
.option-item:hover { border-color: var(--primary); }
.option-item.active { border-color: var(--primary); background: rgba(108,92,231,0.1); }
.option-item .preview {
    font-size: 1.5rem;
    display: block;
    margin-bottom: 4px;
}

.color-picker-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}
.color-picker-row input[type="color"] {
    width: 48px;
    height: 48px;
    border: 2px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    padding: 2px;
}
.color-picker-row label { font-weight: 500; font-size: 0.9rem; }

.tool-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 16px;
}
.tool-actions .btn { justify-content: center; }

/* Main Content */
.main-content {
    flex: 1;
}

/* Footer */
.footer {
    background: var(--surface);
    border-top: 1px solid var(--border);
    padding: 24px 0;
    text-align: center;
    color: var(--text-light);
    font-size: 0.85rem;
    margin-top: auto;
}

/* Loading Spinner */
.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Responsive */
@media (max-width: 768px) {
    .hero h1 { font-size: 2rem; }
    .tool-layout { grid-template-columns: 1fr; }
    .tool-sidebar { max-height: none; }
    .auth-card { padding: 32px 24px; }
    .dashboard-header { flex-direction: column; gap: 16px; }
    .project-grid { grid-template-columns: 1fr; }
    .option-grid { grid-template-columns: repeat(3, 1fr); }
}
