/* SiteWeather Research — Competitor Intelligence */
:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --secondary: #64748b;
    --success: #22c55e;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #06b6d4;
    --dark: #1e293b;
    --light: #f8fafc;
    --border: #e2e8f0;
    --bg-card: #ffffff;
    --bg-page: #f1f5f9;
    --text: #334155;
    --text-muted: #94a3b8;
    --header-height: 56px;
}

* { box-sizing: border-box; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-page);
    color: var(--text);
    margin: 0;
    padding: 0;
    min-height: 100vh;
}

/* Layout */
#app-container { display: flex; flex-direction: column; min-height: 100vh; }

/* Header */
#app-header {
    background: var(--dark);
    color: white;
    height: var(--header-height);
    display: flex;
    align-items: center;
    padding: 0 20px;
    position: sticky;
    top: 0;
    z-index: 1030;
    gap: 16px;
}

#app-header .brand {
    font-weight: 700;
    font-size: 17px;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 8px;
}
#app-header .brand i { color: var(--primary); font-size: 20px; }

#global-search {
    flex: 1;
    max-width: 360px;
    position: relative;
}
#global-search input {
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.15);
    color: white;
    border-radius: 6px;
    padding: 6px 12px 6px 34px;
    width: 100%;
    font-size: 13px;
}
#global-search input::placeholder { color: rgba(255,255,255,0.5); }
#global-search input:focus { background: rgba(255,255,255,0.15); outline: none; border-color: var(--primary); }
#global-search .search-icon { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: rgba(255,255,255,0.5); }
#search-results-dropdown {
    position: absolute; top: 100%; left: 0; right: 0; background: white;
    border-radius: 0 0 8px 8px; box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    display: none; max-height: 400px; overflow-y: auto; z-index: 1050;
}
#search-results-dropdown.show { display: block; }
#search-results-dropdown .search-item { padding: 10px 14px; border-bottom: 1px solid var(--border); cursor: pointer; color: var(--text); }
#search-results-dropdown .search-item:hover { background: var(--light); }

.header-actions {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-left: auto;
}
.header-actions a, .header-actions button { color: rgba(255,255,255,0.6); text-decoration: none; }
.header-actions a:hover, .header-actions button:hover { color: white; }

/* Navigation */
#main-nav {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    padding: 0 20px;
    overflow-x: auto;
}
#nav-tabs {
    display: flex;
    gap: 0;
    list-style: none;
    margin: 0;
    padding: 0;
    white-space: nowrap;
}
#nav-tabs .nav-item { display: flex; }
#nav-tabs .nav-link {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 12px 16px;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    border-bottom: 2px solid transparent;
    transition: all 0.15s;
}
#nav-tabs .nav-link:hover { color: var(--text); }
#nav-tabs .nav-link.active { color: var(--primary); border-bottom-color: var(--primary); }
#nav-tabs .nav-link i { font-size: 15px; }

/* Main Content */
#main-content { flex: 1; padding: 20px; }

/* Tab Panes */
.tab-pane { display: none; }
.tab-pane.active { display: block; }

/* Cards */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    margin-bottom: 16px;
}
.card-header {
    padding: 14px 18px;
    border-bottom: 1px solid var(--border);
    font-weight: 600;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.card-body { padding: 18px; }

/* Stat cards */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; margin-bottom: 20px; }
.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 18px;
    text-align: center;
}
.stat-card .stat-value { font-size: 28px; font-weight: 700; color: var(--primary); }
.stat-card .stat-label { font-size: 12px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; margin-top: 4px; }

/* Tables */
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th { text-align: left; padding: 10px 12px; font-weight: 600; color: var(--text-muted); font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; border-bottom: 2px solid var(--border); }
.table td { padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:hover td { background: rgba(37,99,235,0.03); }

/* Threat level stars */
.threat-stars i { color: var(--warning); font-size: 12px; margin-right: 1px; }
.threat-stars i.bi-star { color: var(--border); }

/* Threat badges */
.threat-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
}
.threat-1 { background: #dcfce7; color: #166534; }
.threat-2 { background: #fef3c7; color: #92400e; }
.threat-3 { background: #fed7aa; color: #9a3412; }
.threat-4 { background: #fecaca; color: #991b1b; }
.threat-5 { background: #ef4444; color: white; }

/* Status badges */
.status-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 500;
}
.status-active { background: #dcfce7; color: #166534; }
.status-inactive { background: #f1f5f9; color: #64748b; }
.status-acquired { background: #dbeafe; color: #1e40af; }
.status-startup { background: #fae8ff; color: #86198f; }

/* Segment badges */
.segment-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 500;
    background: #f1f5f9;
    color: #475569;
}

/* Support level colors (for comparison matrix) */
.support-none { background: #f8fafc; color: #cbd5e1; }
.support-basic { background: #fef3c7; color: #92400e; }
.support-partial { background: #fed7aa; color: #9a3412; }
.support-full { background: #dcfce7; color: #166534; }
.support-superior { background: #2563eb; color: white; }

.support-cell {
    padding: 6px 10px;
    text-align: center;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    border: 1px solid var(--border);
    min-width: 80px;
    transition: opacity 0.15s;
}
.support-cell:hover { opacity: 0.8; }

/* Feature importance */
.importance-stars i { color: var(--primary); font-size: 10px; }
.importance-stars i.bi-star { color: var(--border); }

/* Tags */
.tag {
    display: inline-block;
    padding: 2px 8px;
    background: #eff6ff;
    color: var(--primary);
    border-radius: 4px;
    font-size: 11px;
    margin: 1px 2px;
}

/* SWOT grid */
.swot-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.swot-card { border-radius: 8px; padding: 16px; }
.swot-card h4 { font-size: 14px; font-weight: 600; margin-bottom: 10px; display: flex; align-items: center; gap: 6px; }
.swot-strengths { background: #f0fdf4; border: 1px solid #bbf7d0; }
.swot-strengths h4 { color: #166534; }
.swot-weaknesses { background: #fef2f2; border: 1px solid #fecaca; }
.swot-weaknesses h4 { color: #991b1b; }
.swot-opportunities { background: #eff6ff; border: 1px solid #bfdbfe; }
.swot-opportunities h4 { color: #1e40af; }
.swot-threats { background: #fefce8; border: 1px solid #fef08a; }
.swot-threats h4 { color: #854d0e; }
.swot-item { padding: 6px 0; font-size: 13px; border-bottom: 1px solid rgba(0,0,0,0.05); }
.swot-item:last-child { border-bottom: none; }

/* Buttons */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; border-radius: 6px; font-size: 13px; font-weight: 500; border: 1px solid var(--border); cursor: pointer; transition: all 0.15s; text-decoration: none; }
.btn-primary { background: var(--primary); color: white; border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-dark); }
.btn-secondary { background: var(--bg-card); color: var(--text); }
.btn-secondary:hover { background: var(--light); }
.btn-danger { background: var(--danger); color: white; border-color: var(--danger); }
.btn-danger:hover { background: #dc2626; }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-link { background: none; border: none; color: var(--primary); padding: 4px; cursor: pointer; }
.btn-link:hover { color: var(--primary-dark); }

/* Filters bar */
.filters-bar { display: flex; gap: 10px; align-items: center; margin-bottom: 16px; flex-wrap: wrap; }
.filters-bar select, .filters-bar input {
    padding: 6px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 13px;
    background: var(--bg-card);
    color: var(--text);
}

/* Form fields */
.form-group { margin-bottom: 14px; }
.form-group label { display: block; font-size: 12px; font-weight: 600; color: var(--text-muted); margin-bottom: 4px; text-transform: uppercase; letter-spacing: 0.3px; }
.form-group input, .form-group select, .form-group textarea {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 13px;
    color: var(--text);
    background: var(--bg-card);
}
.form-group textarea { min-height: 80px; resize: vertical; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* Toast */
#toast-container { position: fixed; top: 70px; right: 20px; z-index: 10001; display: flex; flex-direction: column; gap: 8px; }
.toast-item {
    padding: 10px 16px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    animation: toastIn 0.3s ease;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    display: flex;
    align-items: center;
    gap: 8px;
}
.toast-item.success { background: #166534; color: white; }
.toast-item.error { background: var(--danger); color: white; }
.toast-item.info { background: var(--primary); color: white; }
@keyframes toastIn { from { opacity: 0; transform: translateX(40px); } to { opacity: 1; transform: translateX(0); } }

/* Overlay / Confirm dialog */
.overlay-backdrop {
    position: fixed; inset: 0; background: rgba(0,0,0,0.4);
    display: flex; align-items: center; justify-content: center;
    z-index: 10002; animation: fadeIn 0.15s ease;
}
.overlay-dialog {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 24px;
    min-width: 360px;
    max-width: 500px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.2);
}
.overlay-dialog h5 { margin: 0 0 8px; font-size: 16px; }
.overlay-dialog p { margin: 0 0 18px; color: var(--text-muted); font-size: 14px; }
.overlay-dialog .btn-row { display: flex; gap: 8px; justify-content: flex-end; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* Modal */
.modal-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,0.4);
    display: flex; align-items: flex-start; justify-content: center;
    padding-top: 80px; z-index: 10002;
}
.modal-dialog {
    background: var(--bg-card);
    border-radius: 12px;
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 40px rgba(0,0,0,0.2);
}
.modal-dialog-lg { max-width: 900px; }
.modal-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.modal-header h5 { margin: 0; font-size: 16px; }
.modal-body { padding: 20px; overflow-y: auto; flex: 1; }
.modal-footer { padding: 14px 20px; border-top: 1px solid var(--border); display: flex; gap: 8px; justify-content: flex-end; }
.btn-close { background: none; border: none; font-size: 20px; cursor: pointer; color: var(--text-muted); padding: 0; line-height: 1; }

/* Loading */
.loading-spinner { display: flex; align-items: center; justify-content: center; padding: 40px; color: var(--text-muted); }

/* Empty state */
.empty-state { text-align: center; padding: 40px; color: var(--text-muted); }
.empty-state i { font-size: 48px; margin-bottom: 12px; display: block; }

/* Two column detail layout */
.detail-grid { display: grid; grid-template-columns: 1fr 320px; gap: 20px; }
.detail-main { min-width: 0; }
.detail-sidebar { min-width: 0; }

/* News items */
.news-item { padding: 12px 0; border-bottom: 1px solid var(--border); }
.news-item:last-child { border-bottom: none; }
.news-item .news-title { font-weight: 600; font-size: 14px; }
.news-item .news-meta { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.news-item .news-category {
    display: inline-block; padding: 1px 6px; border-radius: 3px;
    font-size: 10px; font-weight: 600; text-transform: uppercase;
    background: #eff6ff; color: var(--primary);
}

/* Boolean indicators */
.bool-yes { color: var(--success); }
.bool-no { color: #cbd5e1; }

/* Responsive */
@media (max-width: 768px) {
    .stat-grid { grid-template-columns: repeat(2, 1fr); }
    .detail-grid { grid-template-columns: 1fr; }
    .swot-grid { grid-template-columns: 1fr; }
    .form-row { grid-template-columns: 1fr; }
    #global-search { display: none; }
    #nav-tabs .nav-link span { display: none; }
    #nav-tabs .nav-link { padding: 12px 10px; }
}
