/* ═══════════════════════════════════════════════
   FPP Studio — Main Stylesheet
   Thingiverse-inspired, playful, quilter-friendly
   ═══════════════════════════════════════════════ */

:root {
    --primary: #6C5CE7;
    --primary-dark: #5A4BD1;
    --secondary: #00B894;
    --accent: #FD79A8;
    --warning: #FDCB6E;
    --danger: #E17055;
    --bg: #F8F9FA;
    --bg-card: #FFFFFF;
    --text: #2D3436;
    --text-light: #636E72;
    --text-muted: #B2BEC3;
    --border: #E9ECEF;
    --shadow: 0 2px 12px rgba(0,0,0,0.08);
    --shadow-hover: 0 8px 30px rgba(108,92,231,0.15);
    --radius: 12px;
    --radius-sm: 8px;
    --font: 'Inter', -apple-system, sans-serif;
    --font-display: 'Space Grotesk', sans-serif;
}

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

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

main { flex: 1; }

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); }

/* ─── Navbar ─── */
.navbar {
    background: white;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(10px);
}
.nav-container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 24px;
    height: 64px;
    display: flex;
    align-items: center;
    gap: 24px;
}
.nav-logo {
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1.25rem;
    color: var(--text);
}
.logo-icon { font-size: 1.5rem; }
.nav-links {
    display: flex;
    gap: 8px;
    flex: 1;
}
.nav-link {
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    color: var(--text-light);
    font-weight: 500;
    font-size: 0.9rem;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
}
.nav-link:hover { background: var(--bg); color: var(--text); }
.nav-cta {
    background: var(--primary);
    color: white !important;
}
.nav-cta:hover { background: var(--primary-dark); color: white !important; }
.nav-right {
    display: flex;
    align-items: center;
    gap: 12px;
}
.nav-xp { display: flex; gap: 6px; }
.xp-badge {
    background: linear-gradient(135deg, #FDCB6E, #F9CA24);
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    color: #6D4C00;
}
.level-badge {
    background: var(--primary);
    color: white;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}
.nav-dropdown { position: relative; }
.nav-user-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    background: none;
    border: 1px solid var(--border);
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.9rem;
    font-family: var(--font);
    color: var(--text);
}
.user-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.8rem;
}
.dropdown-menu {
    display: none;
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    min-width: 200px;
    overflow: hidden;
}
.nav-dropdown.open .dropdown-menu { display: block; }
.dropdown-menu a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    color: var(--text);
    font-size: 0.9rem;
}
.dropdown-menu a:hover { background: var(--bg); }
.dropdown-menu hr { border: none; border-top: 1px solid var(--border); }

/* ─── Buttons ─── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius-sm);
    font-family: var(--font);
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); color: white; transform: translateY(-1px); box-shadow: var(--shadow-hover); }
.btn-secondary { background: var(--secondary); color: white; }
.btn-secondary:hover { background: #00A884; color: white; }
.btn-outline { background: white; border: 2px solid var(--border); color: var(--text); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }
.btn-accent { background: var(--accent); color: white; }
.btn-sm { padding: 6px 14px; font-size: 0.8rem; }
.btn-lg { padding: 14px 28px; font-size: 1rem; }
.btn-block { width: 100%; justify-content: center; }

/* ─── Flash messages ─── */
.flash-container { max-width: 1280px; margin: 16px auto; padding: 0 24px; }
.flash {
    padding: 12px 20px;
    border-radius: var(--radius-sm);
    margin-bottom: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9rem;
    animation: slideDown 0.3s ease;
}
@keyframes slideDown { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: translateY(0); } }
.flash-success { background: #D4EDDA; color: #155724; border-left: 4px solid var(--secondary); }
.flash-error { background: #F8D7DA; color: #721C24; border-left: 4px solid var(--danger); }
.flash-info { background: #D1ECF1; color: #0C5460; border-left: 4px solid #17A2B8; }
.flash-close { background: none; border: none; font-size: 1.2rem; cursor: pointer; opacity: 0.6; }

/* ─── Cards / Grid ─── */
.container { max-width: 1280px; margin: 0 auto; padding: 0 24px; }
.section { padding: 48px 0; }
.section-title {
    font-family: var(--font-display);
    font-size: 1.75rem;
    margin-bottom: 8px;
}
.section-subtitle { color: var(--text-light); margin-bottom: 32px; }

.pattern-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 24px;
}
.pattern-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid var(--border);
    transition: all 0.3s;
    position: relative;
}
.pattern-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-hover);
    border-color: var(--primary);
}
.card-cover {
    height: 200px;
    background: linear-gradient(135deg, #DFE6E9, #B2BEC3);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
}
.card-cover img { width: 100%; height: 100%; object-fit: cover; }
.card-cover svg { max-width: 90%; max-height: 90%; }
.card-cover .placeholder-icon { font-size: 3rem; opacity: 0.3; }
.card-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    background: var(--primary);
    color: white;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 600;
}
.card-badge.free { background: var(--secondary); }
.card-body { padding: 16px; }
.card-title {
    font-weight: 600;
    font-size: 1rem;
    margin-bottom: 4px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.card-meta {
    display: flex;
    gap: 12px;
    font-size: 0.8rem;
    color: var(--text-light);
    margin-bottom: 8px;
}
.card-meta span { display: flex; align-items: center; gap: 4px; }
.card-stats {
    display: flex;
    justify-content: space-between;
    padding-top: 12px;
    border-top: 1px solid var(--border);
    font-size: 0.8rem;
    color: var(--text-muted);
}
.card-stats span { display: flex; align-items: center; gap: 4px; }
.difficulty-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
}
.difficulty-beginner { background: #D4EDDA; color: #155724; }
.difficulty-intermediate { background: #FFF3CD; color: #856404; }
.difficulty-advanced { background: #F8D7DA; color: #721C24; }
.difficulty-expert { background: #D4C5F9; color: #4A2D7A; }

/* ─── Hero ─── */
.hero {
    background: linear-gradient(135deg, #6C5CE7 0%, #A29BFE 50%, #FD79A8 100%);
    color: white;
    padding: 80px 0;
    text-align: center;
    position: relative;
    overflow: hidden;
}
.hero::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.05'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}
.hero-content { position: relative; z-index: 1; }
.hero h1 {
    font-family: var(--font-display);
    font-size: 3rem;
    margin-bottom: 16px;
    text-shadow: 0 2px 20px rgba(0,0,0,0.1);
}
.hero p {
    font-size: 1.25rem;
    opacity: 0.9;
    margin-bottom: 32px;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}
.hero-stats {
    display: flex;
    justify-content: center;
    gap: 48px;
    margin-top: 48px;
}
.hero-stat {
    text-align: center;
}
.hero-stat .number {
    font-family: var(--font-display);
    font-size: 2rem;
    font-weight: 700;
}
.hero-stat .label {
    font-size: 0.9rem;
    opacity: 0.8;
}

/* ─── Forms ─── */
.form-group { margin-bottom: 20px; }
.form-label {
    display: block;
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 6px;
    color: var(--text);
}
.form-input, .form-select, .form-textarea {
    width: 100%;
    padding: 10px 14px;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: var(--font);
    font-size: 0.95rem;
    transition: border-color 0.2s;
    background: white;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(108,92,231,0.1);
}
.form-textarea { resize: vertical; min-height: 100px; }

.auth-container {
    max-width: 440px;
    margin: 60px auto;
    padding: 0 24px;
}
.auth-card {
    background: white;
    padding: 40px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
}
.auth-card h1 {
    font-family: var(--font-display);
    text-align: center;
    margin-bottom: 8px;
}
.auth-card .subtitle {
    text-align: center;
    color: var(--text-light);
    margin-bottom: 32px;
}

/* ─── Pattern Detail ─── */
.pattern-hero {
    background: white;
    border-bottom: 1px solid var(--border);
    padding: 32px 0;
}
.pattern-layout {
    display: grid;
    grid-template-columns: 1fr 360px;
    gap: 40px;
    align-items: start;
}
.pattern-preview {
    background: var(--bg);
    border-radius: var(--radius);
    padding: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 400px;
}
.pattern-info h1 {
    font-family: var(--font-display);
    font-size: 1.75rem;
    margin-bottom: 12px;
}
.pattern-creator {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
    font-size: 0.9rem;
    color: var(--text-light);
}
.pattern-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 20px;
}
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}
.badge-score { background: #D4EDDA; color: #155724; }
.badge-pieces { background: #D1ECF1; color: #0C5460; }
.badge-remix { background: #E8D5F5; color: #5B2D8E; }
.pattern-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 24px;
}

/* ─── Sewability Score ─── */
.score-meter {
    width: 100%;
    height: 8px;
    background: var(--border);
    border-radius: 4px;
    overflow: hidden;
    margin: 8px 0;
}
.score-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.5s ease;
}
.score-high { background: var(--secondary); }
.score-mid { background: var(--warning); }
.score-low { background: var(--danger); }

/* ─── Footer ─── */
.footer {
    background: var(--text);
    color: white;
    padding: 40px 0;
    margin-top: 48px;
}
.footer-container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 24px;
}
.footer-brand {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1.1rem;
}
.footer-tagline { display: block; font-size: 0.8rem; opacity: 0.6; font-weight: 400; margin-top: 4px; }
.footer-links { display: flex; gap: 24px; }
.footer-links a { color: rgba(255,255,255,0.7); font-size: 0.9rem; }
.footer-links a:hover { color: white; }
.footer-copy { font-size: 0.8rem; opacity: 0.5; }

/* ─── Blog ─── */
.blog-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 24px;
}
.blog-card {
    background: white;
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid var(--border);
    transition: all 0.3s;
}
.blog-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-hover); }
.blog-card-body { padding: 20px; }
.blog-card-body h3 { font-size: 1.1rem; margin-bottom: 8px; }
.blog-card-body .excerpt { color: var(--text-light); font-size: 0.9rem; margin-bottom: 12px; }
.blog-card-body .date { font-size: 0.8rem; color: var(--text-muted); }

/* ─── Upload area ─── */
.upload-area {
    border: 3px dashed var(--border);
    border-radius: var(--radius);
    padding: 60px 40px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
    background: white;
}
.upload-area:hover, .upload-area.dragover {
    border-color: var(--primary);
    background: rgba(108,92,231,0.03);
}
.upload-area .icon { font-size: 3rem; color: var(--text-muted); margin-bottom: 16px; }
.upload-area h3 { margin-bottom: 8px; }
.upload-area p { color: var(--text-light); font-size: 0.9rem; }

/* ─── Create start page ─── */
.create-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 24px;
    max-width: 960px;
    margin: 0 auto;
}
.create-option {
    background: white;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    padding: 40px 30px;
    text-align: center;
    transition: all 0.3s;
    display: block;
    color: var(--text);
}
.create-option:hover {
    border-color: var(--primary);
    transform: translateY(-4px);
    box-shadow: var(--shadow-hover);
    color: var(--text);
}
.create-option .option-icon { font-size: 2.5rem; margin-bottom: 16px; }
.create-option h3 { font-family: var(--font-display); margin-bottom: 8px; }
.create-option p { color: var(--text-light); font-size: 0.9rem; }

/* ─── Filter bar ─── */
.filter-bar {
    background: white;
    border-bottom: 1px solid var(--border);
    padding: 16px 0;
    position: sticky;
    top: 64px;
    z-index: 50;
}
.filter-row {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
}
.filter-row .form-input { max-width: 300px; }
.filter-chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
    padding: 6px 14px;
    border-radius: 20px;
    border: 1px solid var(--border);
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s;
    background: white;
    color: var(--text-light);
    text-decoration: none;
}
.chip:hover, .chip.active { background: var(--primary); color: white; border-color: var(--primary); }

/* ─── Responsive ─── */
@media (max-width: 768px) {
    .hero h1 { font-size: 2rem; }
    .hero-stats { gap: 24px; }
    .pattern-layout { grid-template-columns: 1fr; }
    .nav-links { display: none; }
    .nav-xp { display: none; }
    .footer-container { flex-direction: column; text-align: center; }
}
