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

/* ─── CSS Variables ─── */
:root {
    --bg-primary: #f8fafc;
    --bg-secondary: #ffffff;
    --bg-card: #ffffff;
    --bg-input: #f1f5f9;
    --text-primary: #0f172a;
    --text-secondary: #334155;
    --text-muted: #64748b;
    --text-label: #475569;
    --border-color: #e2e8f0;
    --border-light: #f1f5f9;
    --accent-blue: #2563eb;
    --accent-purple: #7c3aed;
    --accent-gradient: linear-gradient(135deg, #2563eb, #7c3aed);
    --accent-gradient-soft: linear-gradient(135deg, rgba(37,99,235,0.08), rgba(124,58,237,0.08));
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.04);
    --shadow-md: 0 4px 16px rgba(0,0,0,0.06);
    --shadow-lg: 0 8px 32px rgba(0,0,0,0.08);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --success: #059669;
    --success-bg: #ecfdf5;
    --warning: #d97706;
    --warning-bg: #fffbeb;
    --danger: #dc2626;
    --danger-bg: #fef2f2;
    --info: #2563eb;
    --info-bg: #eff6ff;
}

[data-theme="dark"] {
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-card: #1e293b;
    --bg-input: #0f172a;
    --text-primary: #f1f5f9;
    --text-secondary: #cbd5e1;
    --text-muted: #94a3b8;
    --text-label: #94a3b8;
    --border-color: #334155;
    --border-light: #1e293b;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.2);
    --shadow-md: 0 4px 16px rgba(0,0,0,0.3);
    --shadow-lg: 0 8px 32px rgba(0,0,0,0.4);
    --accent-gradient-soft: linear-gradient(135deg, rgba(37,99,235,0.12), rgba(124,58,237,0.12));
    --success-bg: rgba(5,150,105,0.12);
    --warning-bg: rgba(217,119,6,0.12);
    --danger-bg: rgba(220,38,38,0.12);
    --info-bg: rgba(37,99,235,0.12);
}

/* ─── Reset & Base ─── */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    transition: background-color 0.3s ease, color 0.3s ease;
    min-height: 100vh;
}

/* ─── Scrollbar ─── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ─── Container ─── */
.app-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1.5rem 4rem;
}

/* ─── Hero Section ─── */
.hero {
    text-align: center;
    padding: 2.5rem 1rem 2rem;
    animation: fadeInUp 0.6s ease-out;
}

.hero h1 {
    font-family: 'Outfit', sans-serif;
    font-size: clamp(1.8rem, 4vw, 2.8rem);
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 0.75rem;
    line-height: 1.2;
}

.text-gradient {
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero p {
    font-size: 1.05rem;
    color: var(--text-muted);
    max-width: 650px;
    margin: 0 auto;
    line-height: 1.7;
}

/* ─── Glass Panel ─── */
.glass-panel {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-md);
    transition: box-shadow 0.3s ease, transform 0.3s ease, background 0.3s ease;
}

/* ─── Config Section ─── */
.config-section {
    padding: 2rem;
    margin-bottom: 2rem;
    animation: fadeInUp 0.6s ease-out 0.1s backwards;
}

.config-section h2 {
    font-family: 'Outfit', sans-serif;
    font-size: 1.35rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    color: var(--text-primary);
}

.config-section h2 i {
    color: var(--accent-blue);
    font-size: 1.1rem;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

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

.form-group label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-label);
    display: flex;
    align-items: center;
    gap: 0.4rem;
    letter-spacing: 0.02em;
}

.form-group label i {
    font-size: 0.9rem;
    color: var(--accent-blue);
}

.form-group select {
    padding: 0.75rem 1rem;
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 0.95rem;
    font-family: 'Inter', sans-serif;
    background: var(--bg-input);
    color: var(--text-primary);
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-group select:focus {
    outline: none;
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.form-actions {
    display: flex;
    justify-content: center;
    padding-top: 0.5rem;
}

/* ─── Buttons ─── */
.btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.85rem 2rem;
    background: var(--accent-gradient);
    color: white;
    font-size: 1rem;
    font-weight: 600;
    font-family: 'Inter', sans-serif;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.25s ease;
    box-shadow: 0 4px 14px rgba(37, 99, 235, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(37, 99, 235, 0.4);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.btn-secondary {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.7rem 1.4rem;
    background: var(--bg-input);
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 600;
    font-family: 'Inter', sans-serif;
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-secondary:hover {
    background: var(--border-color);
    transform: translateY(-1px);
}

.btn-export-png {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 1rem;
    background: var(--accent-gradient-soft);
    color: var(--accent-blue);
    font-size: 0.8rem;
    font-weight: 600;
    font-family: 'Inter', sans-serif;
    border: 1px solid rgba(37,99,235,0.2);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-export-png:hover {
    background: rgba(37,99,235,0.15);
    transform: translateY(-1px);
}

.btn-export-pdf {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 1rem;
    background: var(--danger-bg);
    color: var(--danger);
    font-size: 0.8rem;
    font-weight: 600;
    font-family: 'Inter', sans-serif;
    border: 1px solid rgba(220,38,38,0.2);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-export-pdf:hover {
    background: rgba(220,38,38,0.15);
    transform: translateY(-1px);
}

/* ─── Loader ─── */
.loader-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
    padding: 4rem 2rem;
    animation: fadeIn 0.3s ease;
}

.spinner {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 3px solid var(--border-color);
    border-top-color: var(--accent-blue);
    animation: spin 0.8s linear infinite;
}

.loader-container p {
    font-size: 1rem;
    color: var(--text-muted);
    font-weight: 500;
}

/* ─── Results Section ─── */
.results-section {
    animation: fadeInUp 0.5s ease-out;
}

.results-header {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.results-header h2 {
    font-family: 'Outfit', sans-serif;
    font-size: 1.6rem;
    font-weight: 700;
}

.results-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
}

.edit-hint {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: var(--text-muted);
    background: var(--accent-gradient-soft);
    padding: 0.6rem 1rem;
    border-radius: var(--radius-md);
    margin-bottom: 1.5rem;
}

.edit-hint i { color: var(--accent-blue); }

/* ─── ICP Cards Grid ─── */
.icp-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

@media (max-width: 800px) {
    .icp-grid {
        grid-template-columns: 1fr;
    }
}

/* ─── ICP Card ─── */
.icp-card-wrapper {
    position: relative;
}

.icp-card-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.icp-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    overflow: hidden;
    box-shadow: var(--shadow-md);
    transition: box-shadow 0.3s ease, transform 0.3s ease;
    position: relative;
}

.icp-card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

/* Card Header */
.icp-card-header {
    padding: 1.5rem 1.5rem 1rem;
    background: var(--accent-gradient);
    color: white;
    position: relative;
    overflow: hidden;
}

.icp-card-header::after {
    content: '';
    position: absolute;
    top: -50%;
    right: -30%;
    width: 200px;
    height: 200px;
    background: rgba(255,255,255,0.06);
    border-radius: 50%;
}

.icp-card-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    background: rgba(255,255,255,0.18);
    padding: 0.3rem 0.7rem;
    border-radius: 20px;
    margin-bottom: 0.75rem;
    backdrop-filter: blur(4px);
}

.icp-card-company-name {
    font-family: 'Outfit', sans-serif;
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.icp-card-company-desc {
    font-size: 0.82rem;
    opacity: 0.85;
    line-height: 1.5;
}

/* Card Body */
.icp-card-body {
    padding: 1.25rem 1.5rem 1.5rem;
}

.icp-section {
    margin-bottom: 1.25rem;
}

.icp-section:last-child {
    margin-bottom: 0;
}

.icp-section-title {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    margin-bottom: 0.6rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.icp-section-title i {
    font-size: 0.75rem;
    color: var(--accent-blue);
}

/* Key-Value Grid */
.kv-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
}

.kv-item {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.kv-label {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.kv-value {
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--text-primary);
}

/* Tag list */
.tag-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}

.tag {
    font-size: 0.75rem;
    font-weight: 500;
    padding: 0.25rem 0.6rem;
    border-radius: 6px;
    background: var(--accent-gradient-soft);
    color: var(--accent-blue);
    border: 1px solid rgba(37,99,235,0.1);
}

.tag.green {
    background: var(--success-bg);
    color: var(--success);
    border-color: rgba(5,150,105,0.15);
}

.tag.amber {
    background: var(--warning-bg);
    color: var(--warning);
    border-color: rgba(217,119,6,0.15);
}

.tag.red {
    background: var(--danger-bg);
    color: var(--danger);
    border-color: rgba(220,38,38,0.15);
}

/* Bullet list */
.bullet-list {
    list-style: none;
    padding: 0;
}

.bullet-list li {
    font-size: 0.85rem;
    color: var(--text-secondary);
    padding: 0.3rem 0;
    padding-left: 1.2rem;
    position: relative;
    line-height: 1.5;
}

.bullet-list li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0.65rem;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--accent-blue);
}

.bullet-list.green li::before { background: var(--success); }
.bullet-list.red li::before { background: var(--danger); }

/* Quote */
.icp-quote {
    font-size: 0.88rem;
    font-style: italic;
    color: var(--text-secondary);
    padding: 0.75rem 1rem;
    border-left: 3px solid var(--accent-blue);
    background: var(--accent-gradient-soft);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    line-height: 1.6;
}

/* Progress bar */
.progress-row {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 0.4rem;
}

.progress-label {
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--text-secondary);
    min-width: 110px;
}

.progress-bar-bg {
    flex: 1;
    height: 6px;
    border-radius: 3px;
    background: var(--bg-input);
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    border-radius: 3px;
    background: var(--accent-gradient);
    transition: width 1s ease-out;
}

.progress-value {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-primary);
    min-width: 32px;
    text-align: right;
}

/* Watermark for exports */
.export-watermark {
    display: none;
    text-align: center;
    padding: 0.75rem;
    border-top: 1px solid var(--border-color);
    font-size: 0.7rem;
    color: var(--text-muted);
}

.export-watermark a {
    color: var(--accent-blue);
    text-decoration: none;
    font-weight: 600;
}

/* ─── Sources Panel ─── */
.sources-panel {
    padding: 1.5rem 2rem;
    margin-bottom: 2rem;
}

.sources-panel h3 {
    font-family: 'Outfit', sans-serif;
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-primary);
}

.sources-panel h3 i {
    color: var(--accent-blue);
}

.sources-list {
    list-style: none;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 0.75rem;
}

.sources-list li {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    padding: 0.6rem 0.8rem;
    border-radius: var(--radius-sm);
    background: var(--bg-input);
    border: 1px solid var(--border-light);
    transition: background 0.2s ease;
}

.sources-list li:hover {
    background: var(--accent-gradient-soft);
}

.sources-list li i {
    color: var(--accent-blue);
    font-size: 0.75rem;
    margin-top: 0.3rem;
    flex-shrink: 0;
}

.source-info {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    min-width: 0;
}

.source-name {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-primary);
}

.source-detail {
    font-size: 0.72rem;
    color: var(--text-muted);
    line-height: 1.4;
}

.source-link {
    font-size: 0.72rem;
    color: var(--accent-blue);
    text-decoration: none;
    word-break: break-all;
}

.source-link:hover {
    text-decoration: underline;
}

/* ─── Footer ─── */
.app-footer {
    text-align: center;
    padding: 2rem 1rem;
    font-size: 0.82rem;
    color: var(--text-muted);
    border-top: 1px solid var(--border-color);
    margin-top: 2rem;
}

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

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

/* ─── Editable fields ─── */
[contenteditable="true"] {
    outline: none;
    cursor: text;
    border-radius: 4px;
    transition: background 0.2s ease, box-shadow 0.2s ease;
    padding: 1px 3px;
    margin: -1px -3px;
}

[contenteditable="true"]:hover {
    background: rgba(37,99,235,0.06);
}

[contenteditable="true"]:focus {
    background: rgba(37,99,235,0.1);
    box-shadow: 0 0 0 2px rgba(37,99,235,0.2);
}

/* ─── Animations ─── */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

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

.animate-fade-in {
    animation: fadeInUp 0.5s ease-out forwards;
}

/* ─── Hide on export ─── */
.hide-on-export {}

/* ─── Responsive ─── */
@media (max-width: 640px) {
    .app-container {
        padding: 1rem;
    }
    .config-section {
        padding: 1.25rem;
    }
    .form-grid {
        grid-template-columns: 1fr;
    }
    .hero h1 {
        font-size: 1.6rem;
    }
    .icp-card-header {
        padding: 1.25rem;
    }
    .icp-card-body {
        padding: 1rem 1.25rem 1.25rem;
    }
    .kv-grid {
        grid-template-columns: 1fr;
    }
    .results-header {
        flex-direction: column;
        align-items: flex-start;
    }
    .sources-list {
        grid-template-columns: 1fr;
    }
}

/* ─── Print / PDF preparation ─── */
@media print {
    .hide-on-export,
    .grimont-global-header,
    .icp-card-actions {
        display: none !important;
    }
    .icp-card {
        break-inside: avoid;
        page-break-inside: avoid;
    }
}

/* 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: 1200px;
    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;
}

