@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Outfit:wght@400;600;700;800&family=Space+Grotesk:wght@700&display=swap');

/* ========== BASE ========== */
:root {
    --bmc-kp: #6366f1;   /* Key Partners - indigo */
    --bmc-ka: #8b5cf6;   /* Key Activities - violet */
    --bmc-kr: #a78bfa;   /* Key Resources - purple */
    --bmc-vp: #2563eb;   /* Value Proposition - blue */
    --bmc-cr: #0ea5e9;   /* Customer Relationships - sky */
    --bmc-ch: #06b6d4;   /* Channels - cyan */
    --bmc-cs: #14b8a6;   /* Customer Segments - teal */
    --bmc-cost: #f59e0b; /* Cost Structure - amber */
    --bmc-rev: #10b981;  /* Revenue Streams - emerald */
}

* { box-sizing: border-box; }

body {
    font-family: 'Inter', sans-serif;
    margin: 0;
    padding: 0;
    background: #f8fafc;
    color: #1e293b;
    transition: background 0.3s, color 0.3s;
}

.dark body, body.dark-mode {
    background: #0f172a;
    color: #e2e8f0;
}

.font-outfit { font-family: 'Outfit', sans-serif; }

/* ========== SCROLLBAR ========== */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; }
.dark ::-webkit-scrollbar-thumb { background: #475569; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* ========== ANIMATIONS ========== */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(16px); }
    to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}
@keyframes pulse-soft {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}
.animate-fade-in-up { animation: fadeInUp 0.5s ease-out both; }
.animate-fade-in    { animation: fadeIn 0.4s ease-out both; }

/* ========== MAIN CONTAINER ========== */
.app-container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 2rem 1.5rem 4rem;
}

/* ========== HERO ========== */
.hero {
    text-align: center;
    margin-bottom: 2.5rem;
}
.hero h1 {
    font-family: 'Outfit', sans-serif;
    font-weight: 800;
    font-size: 2.25rem;
    margin: 0 0 0.75rem;
    background: linear-gradient(135deg, #2563eb, #7c3aed);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.hero p {
    font-size: 1.1rem;
    color: #64748b;
    max-width: 640px;
    margin: 0 auto;
    line-height: 1.6;
}
.dark .hero p { color: #94a3b8; }

/* ========== CARD ========== */
.card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    padding: 1.75rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
    transition: box-shadow 0.2s, border-color 0.2s, background 0.3s;
}
.dark .card {
    background: #1e293b;
    border-color: #334155;
}
.card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.06);
}

.card-title {
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    font-size: 1.15rem;
    margin: 0 0 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.6rem;
}
.card-title i {
    color: #6366f1;
    font-size: 1rem;
}
.dark .card-title i { color: #a5b4fc; }

/* ========== TEMPLATES ========== */
.templates-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}
.template-card {
    cursor: pointer;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    padding: 1rem 1.15rem;
    background: #f8fafc;
    transition: all 0.25s ease;
    position: relative;
    overflow: hidden;
}
.template-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 4px;
    background: linear-gradient(90deg, #2563eb, #7c3aed);
    opacity: 0;
    transition: opacity 0.25s;
}
.template-card:hover {
    border-color: #6366f1;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.12);
}
.template-card:hover::before { opacity: 1; }
.template-card.active {
    border-color: #6366f1;
    background: #eef2ff;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}
.template-card.active::before { opacity: 1; }
.dark .template-card {
    background: #1e293b;
    border-color: #334155;
}
.dark .template-card:hover {
    border-color: #818cf8;
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.15);
}
.dark .template-card.active {
    border-color: #818cf8;
    background: rgba(99, 102, 241, 0.12);
}
.template-card h4 {
    font-weight: 700;
    font-size: 0.95rem;
    margin: 0 0 0.35rem;
}
.template-card .template-sector {
    font-size: 0.78rem;
    color: #64748b;
    display: flex;
    align-items: center;
    gap: 0.35rem;
}
.dark .template-card .template-sector { color: #94a3b8; }

/* ========== FORM ========== */
.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
}
@media (max-width: 640px) {
    .form-grid { grid-template-columns: 1fr; }
}
.form-group { display: flex; flex-direction: column; gap: 0.4rem; }
.form-group.full-width { grid-column: 1 / -1; }
.form-group label {
    font-size: 0.82rem;
    font-weight: 600;
    color: #475569;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.dark .form-group label { color: #94a3b8; }
.form-group select,
.form-group textarea {
    padding: 0.65rem 0.85rem;
    border: 1.5px solid #e2e8f0;
    border-radius: 10px;
    background: #f8fafc;
    font-size: 0.92rem;
    font-family: 'Inter', sans-serif;
    color: #1e293b;
    transition: border-color 0.2s, box-shadow 0.2s;
    outline: none;
    width: 100%;
}
.form-group select:focus,
.form-group textarea:focus {
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12);
}
.dark .form-group select,
.dark .form-group textarea {
    background: #0f172a;
    border-color: #334155;
    color: #e2e8f0;
}
.dark .form-group select:focus,
.dark .form-group textarea:focus {
    border-color: #818cf8;
    box-shadow: 0 0 0 3px rgba(129, 140, 248, 0.15);
}
.form-group textarea { resize: vertical; min-height: 80px; }

/* Custom Multi-select Dropdown */
.multiselect-group {
    position: relative;
    width: 100%;
}
.multiselect-trigger {
    padding: 0.65rem 0.85rem;
    border: 1.5px solid #e2e8f0;
    border-radius: 10px;
    background: #f8fafc;
    font-size: 0.92rem;
    font-family: 'Inter', sans-serif;
    color: #1e293b;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    transition: border-color 0.2s, box-shadow 0.2s;
    outline: none;
    user-select: none;
}
.multiselect-trigger:focus {
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12);
}
.dark .multiselect-trigger {
    background: #0f172a;
    border-color: #334155;
    color: #e2e8f0;
}
.dark .multiselect-trigger:focus {
    border-color: #818cf8;
    box-shadow: 0 0 0 3px rgba(129, 140, 248, 0.15);
}

.multiselect-value {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding-right: 0.5rem;
    color: #64748b; /* Placeholder color */
}
.dark .multiselect-value {
    color: #94a3b8;
}
.multiselect-value.has-value {
    color: #1e293b; /* Selected value color */
    font-weight: 500;
}
.dark .multiselect-value.has-value {
    color: #cbd5e1;
}

.multiselect-trigger i {
    font-size: 0.8rem;
    color: #64748b;
    transition: transform 0.2s;
}
.multiselect-group.open .multiselect-trigger i {
    transform: rotate(180deg);
}

.multiselect-options {
    position: absolute;
    top: 105%;
    left: 0;
    right: 0;
    background: #ffffff;
    border: 1.5px solid #e2e8f0;
    border-radius: 10px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.08);
    z-index: 100;
    max-height: 240px;
    overflow-y: auto;
    padding: 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}
.dark .multiselect-options {
    background: #1e293b;
    border-color: #334155;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
}

.multiselect-option {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.5rem 0.65rem;
    border-radius: 6px;
    font-size: 0.88rem;
    color: #475569;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
    user-select: none;
}
.multiselect-option:hover {
    background: #f1f5f9;
    color: #1e293b;
}
.dark .multiselect-option {
    color: #cbd5e1;
}
.dark .multiselect-option:hover {
    background: #334155;
    color: #f8fafc;
}

.multiselect-option input[type="checkbox"] {
    width: 15px;
    height: 15px;
    accent-color: #6366f1;
    cursor: pointer;
}
.dark .multiselect-option input[type="checkbox"] {
    accent-color: #818cf8;
}

.multiselect-option.selected {
    background: #eef2ff;
    color: #4338ca;
    font-weight: 600;
}
.dark .multiselect-option.selected {
    background: rgba(99, 102, 241, 0.15);
    color: #c7d2fe;
}


/* ========== BUTTONS ========== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.7rem 1.5rem;
    border: none;
    border-radius: 10px;
    font-family: 'Inter', sans-serif;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}
.btn-primary {
    background: linear-gradient(135deg, #2563eb, #7c3aed);
    color: #fff;
    box-shadow: 0 2px 10px rgba(37, 99, 235, 0.25);
}
.btn-primary:hover {
    box-shadow: 0 4px 20px rgba(37, 99, 235, 0.35);
    transform: translateY(-1px);
}
.btn-secondary {
    background: #f1f5f9;
    color: #475569;
    border: 1.5px solid #e2e8f0;
}
.btn-secondary:hover { background: #e2e8f0; }
.dark .btn-secondary {
    background: #1e293b;
    color: #94a3b8;
    border-color: #334155;
}
.dark .btn-secondary:hover { background: #334155; }
.btn-danger {
    background: transparent;
    color: #ef4444;
    border: 1.5px solid #fecaca;
}
.btn-danger:hover { background: #fef2f2; }
.dark .btn-danger {
    border-color: #7f1d1d;
    color: #fca5a5;
}
.dark .btn-danger:hover { background: rgba(127, 29, 29, 0.2); }

.btn-group {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    justify-content: center;
    margin-top: 1.75rem;
}

/* ========== BMC GRID ========== */
.bmc-wrapper {
    margin-top: 2.5rem;
    animation: fadeInUp 0.6s ease-out both;
}
.bmc-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
}
.bmc-actions h2 {
    font-family: 'Outfit', sans-serif;
    font-weight: 800;
    font-size: 1.6rem;
    margin: 0;
}

#bmc-grid {
    display: grid;
    grid-template-columns: repeat(10, 1fr);
    grid-template-rows: auto auto auto;
    gap: 0;
    border: 2px solid #e2e8f0;
    border-radius: 16px;
    overflow: hidden;
    background: #fff;
    box-shadow: 0 4px 24px rgba(0,0,0,0.06);
}
.dark #bmc-grid {
    border-color: #334155;
    background: #1e293b;
    box-shadow: 0 4px 24px rgba(0,0,0,0.2);
}

/* Classic BMC Layout (Osterwalder):
   Row 1-2 (top half):
     KP: col 1-2, row 1-2
     KA: col 3-4, row 1
     VP: col 5-6, row 1-2
     CR: col 7-8, row 1
     CS: col 9-10, row 1-2
     KR: col 3-4, row 2
     CH: col 7-8, row 2
   Row 3 (bottom):
     Cost: col 1-5
     Rev:  col 6-10
*/
.bmc-cell {
    border: 1px solid #e2e8f0;
    padding: 1rem;
    min-height: 160px;
    display: flex;
    flex-direction: column;
    position: relative;
    transition: background 0.2s;
}
.dark .bmc-cell { border-color: #334155; }

.bmc-cell-header {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    margin-bottom: 0.65rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid currentColor;
    opacity: 0.85;
}
.bmc-cell-header i { font-size: 0.85rem; }
.bmc-cell-header span {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.bmc-cell-content {
    flex: 1;
    font-size: 0.82rem;
    line-height: 1.55;
    color: #334155;
    outline: none;
    cursor: text;
    min-height: 60px;
    border-radius: 6px;
    padding: 0.35rem;
    transition: background 0.2s;
}
.bmc-cell-content:focus {
    background: rgba(99, 102, 241, 0.04);
}
.dark .bmc-cell-content { color: #cbd5e1; }
.dark .bmc-cell-content:focus {
    background: rgba(99, 102, 241, 0.08);
}

.bmc-cell-content ul {
    margin: 0;
    padding-left: 1.1rem;
    list-style: disc;
}
.bmc-cell-content li {
    margin-bottom: 0.3rem;
}

/* Cell grid positions */
.bmc-kp { grid-column: 1 / 3;  grid-row: 1 / 3; color: var(--bmc-kp); }
.bmc-ka { grid-column: 3 / 5;  grid-row: 1 / 2; color: var(--bmc-ka); }
.bmc-vp { grid-column: 5 / 7;  grid-row: 1 / 3; color: var(--bmc-vp); }
.bmc-cr { grid-column: 7 / 9;  grid-row: 1 / 2; color: var(--bmc-cr); }
.bmc-cs { grid-column: 9 / 11; grid-row: 1 / 3; color: var(--bmc-cs); }
.bmc-kr { grid-column: 3 / 5;  grid-row: 2 / 3; color: var(--bmc-kr); }
.bmc-ch { grid-column: 7 / 9;  grid-row: 2 / 3; color: var(--bmc-ch); }
.bmc-cost { grid-column: 1 / 6; grid-row: 3 / 4; color: var(--bmc-cost); }
.bmc-rev  { grid-column: 6 / 11; grid-row: 3 / 4; color: var(--bmc-rev); }

/* Cell background tints */
.bmc-kp  { background: rgba(99, 102, 241, 0.04); }
.bmc-ka  { background: rgba(139, 92, 246, 0.04); }
.bmc-kr  { background: rgba(167, 139, 250, 0.04); }
.bmc-vp  { background: rgba(37, 99, 235, 0.04); }
.bmc-cr  { background: rgba(14, 165, 233, 0.04); }
.bmc-ch  { background: rgba(6, 182, 212, 0.04); }
.bmc-cs  { background: rgba(20, 184, 166, 0.04); }
.bmc-cost { background: rgba(245, 158, 11, 0.04); }
.bmc-rev  { background: rgba(16, 185, 129, 0.04); }

.dark .bmc-kp  { background: rgba(99, 102, 241, 0.06); }
.dark .bmc-ka  { background: rgba(139, 92, 246, 0.06); }
.dark .bmc-kr  { background: rgba(167, 139, 250, 0.06); }
.dark .bmc-vp  { background: rgba(37, 99, 235, 0.06); }
.dark .bmc-cr  { background: rgba(14, 165, 233, 0.06); }
.dark .bmc-ch  { background: rgba(6, 182, 212, 0.06); }
.dark .bmc-cs  { background: rgba(20, 184, 166, 0.06); }
.dark .bmc-cost { background: rgba(245, 158, 11, 0.06); }
.dark .bmc-rev  { background: rgba(16, 185, 129, 0.06); }

/* ========== SOURCES ========== */
.sources-section {
    margin-top: 1.5rem;
    padding: 1.25rem;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
}
.dark .sources-section {
    background: #0f172a;
    border-color: #334155;
}
.sources-section h4 {
    font-size: 0.82rem;
    font-weight: 700;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin: 0 0 0.75rem;
}
.dark .sources-section h4 { color: #94a3b8; }
.sources-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}
.source-link {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.78rem;
    color: #6366f1;
    text-decoration: none;
    padding: 0.3rem 0.7rem;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    transition: all 0.2s;
    background: #fff;
}
.source-link:hover {
    background: #eef2ff;
    border-color: #6366f1;
}
.dark .source-link {
    color: #a5b4fc;
    background: #1e293b;
    border-color: #334155;
}
.dark .source-link:hover {
    background: rgba(99, 102, 241, 0.1);
    border-color: #818cf8;
}

/* ========== RESPONSIVE BMC ========== */
@media (max-width: 900px) {
    #bmc-grid {
        display: flex;
        flex-direction: column;
    }
    .bmc-cell {
        min-height: 120px;
    }
}

/* ========== PRINT / EXPORT ========== */
.export-header {
    display: none;
    padding: 1rem 1.5rem;
    border-bottom: 2px solid #e2e8f0;
    margin-bottom: 1rem;
    align-items: center;
    justify-content: space-between;
}
.export-header .eh-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}
.export-header .eh-logo {
    width: 36px; height: 36px;
    background: linear-gradient(135deg, #2563eb, #7c3aed);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 1.1rem;
}
.export-header .eh-brand {
    font-family: 'Space Grotesk', monospace;
    font-weight: 800;
    font-size: 1.1rem;
    color: #1e293b;
}
.export-header .eh-brand span { color: #2563eb; }
.export-header .eh-right {
    text-align: right;
    font-size: 0.82rem;
    color: #64748b;
}

/* ========== EDIT HINT ========== */
.edit-hint {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8rem;
    color: #94a3b8;
    padding: 0.6rem 1rem;
    background: rgba(99, 102, 241, 0.05);
    border: 1px dashed #c7d2fe;
    border-radius: 10px;
    margin-bottom: 1rem;
}
.dark .edit-hint {
    background: rgba(99, 102, 241, 0.08);
    border-color: #4338ca;
    color: #818cf8;
}

/* ========== HIDDEN UTIL ========== */
.hidden { display: none !important; }

/* ========== LOADING ========== */
.loading-spinner {
    width: 40px; height: 40px;
    border: 4px solid #e2e8f0;
    border-top-color: #6366f1;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 2rem auto;
}
.dark .loading-spinner {
    border-color: #334155;
    border-top-color: #a5b4fc;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Extracted from index.html */

.grimont-global-header {
    width: 100%;
    z-index: 1000;
    position: sticky;
    top: 0;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    padding: 14px 0;
    font-family: 'Outfit', 'Inter', sans-serif;
    color: #e2e8f0;
    box-sizing: border-box;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.15);
}
.grimont-global-header * { box-sizing: border-box; }
.grimont-global-header .ggh-container {
    max-width: 1152px;
    margin: 0 auto;
    padding: 0 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.ggh-left { display: flex; align-items: center; gap: 1.5rem; }
.ggh-logo-group {
    display: flex; align-items: center; gap: 0.875rem; text-decoration: none; transition: transform 0.2s ease;
}
.ggh-logo-group:hover { transform: scale(1.02); }
.ggh-logo-box {
    width: 40px; height: 40px; background: linear-gradient(135deg, #2563eb, #7c3aed);
    border-radius: 10px; display: flex; align-items: center; justify-content: center;
    color: white; font-weight: bold; font-size: 1.25rem; border: 1px solid rgba(255,255,255,0.15);
    box-shadow: 0 0 20px rgba(37, 99, 235, 0.25); flex-shrink: 0;
}
.ggh-logo-text {
    font-family: 'Space Grotesk', monospace; font-weight: 800; font-size: 1.2rem;
    color: white; letter-spacing: 0.05em; display: none;
}
.ggh-logo-text span { color: #00f2ff; }
@media (min-width: 640px) { .ggh-logo-text { display: block; } }
.ggh-separator { width: 1px; height: 36px; background-color: rgba(255, 255, 255, 0.1); display: none; }
@media (min-width: 768px) { .ggh-separator { display: block; } }
.ggh-app-info { display: flex; flex-direction: column; justify-content: center; }
.ggh-app-title-group { display: flex; align-items: center; gap: 0.6rem; }
.ggh-app-icon-container {
    width: 32px; height: 32px; border-radius: 8px; background: rgba(30, 41, 59, 1);
    border: 1px solid rgba(255, 255, 255, 0.1); display: flex; align-items: center; justify-content: center;
    font-size: 14px; color: #60a5fa; box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2); flex-shrink: 0;
}
.ggh-app-name { font-weight: 700; color: white; font-size: 1.05rem; margin: 0; padding: 0; letter-spacing: 0.02em; }
.ggh-app-desc {
    font-size: 0.8rem; color: #94a3b8; max-width: 600px;
     display: none; margin: 4px 0 0 0; padding: 0; line-height: 1.4; font-weight: 300;
}
@media (min-width: 1024px) { .ggh-app-desc { display: block; } }
.ggh-right { display: flex; align-items: center; gap: 1rem; }
.ggh-right button {
    background: rgba(30, 41, 59, 0.6) !important; border: 1px solid rgba(255, 255, 255, 0.1) !important;
    color: #cbd5e1 !important; width: 40px !important; height: 40px !important;
    border-radius: 50% !important; display: flex !important; align-items: center !important; justify-content: center !important;
    cursor: pointer !important; transition: all 0.2s ease !important; padding: 0 !important; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1) !important;
}
.ggh-right button:hover {
    background: rgba(30, 41, 59, 1) !important; color: white !important; border-color: rgba(255, 255, 255, 0.2) !important; transform: translateY(-1px) !important;
}

