:root {
    --primary: #4f46e5;
    --primary-dark: #3730a3;
    --primary-light: #e0e7ff;
    --easy: #16a34a;
    --medium: #d97706;
    --advanced: #dc2626;
    --bg: #f5f7ff;
    --card-border: #dde3f8;
    --card-shadow: 0 2px 8px rgba(79, 70, 229, 0.06);
    --card-shadow-hover: 0 6px 20px rgba(79, 70, 229, 0.14);
    --text-main: #1e1b4b;
    --text-muted: #6b7280;
}

* { box-sizing: border-box; }

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background-color: var(--bg);
    color: var(--text-main);
    font-size: 0.95rem;
}

/* ── Navbar ── */
.navbar {
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 100%);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.18);
    padding: 0.6rem 0;
}

.navbar-brand {
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: -0.3px;
}

.navbar .nav-link {
    color: rgba(255,255,255,0.82) !important;
    font-size: 0.88rem;
    font-weight: 500;
    padding: 0.4rem 0.7rem;
    border-radius: 6px;
    transition: background 0.15s, color 0.15s;
}

.navbar .nav-link:hover,
.navbar .nav-link.active {
    color: #fff !important;
    background: rgba(255,255,255,0.15);
}

.navbar .dropdown-menu {
    border: 1.5px solid var(--card-border);
    border-radius: 10px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.1);
    padding: 0.4rem;
}

.navbar .dropdown-item {
    border-radius: 6px;
    font-size: 0.88rem;
    padding: 0.45rem 0.75rem;
}

.btn-add-nav {
    background: #fff;
    color: var(--primary);
    border: none;
    font-weight: 600;
    font-size: 0.88rem;
    padding: 0.4rem 1rem;
    border-radius: 8px;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: background 0.15s, transform 0.1s;
}

.btn-add-nav:hover {
    background: #eef2ff;
    color: var(--primary-dark);
    transform: translateY(-1px);
}

/* ── Page layout ── */
.main-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1.5rem 1.5rem;
}

.page-title {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-main);
}

/* ── Search bar ── */
.search-wrap {
    background: white;
    border: 2px solid var(--card-border);
    border-radius: 12px;
    overflow: hidden;
    display: flex;
    align-items: center;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.search-wrap:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.search-wrap .search-icon {
    padding: 0 0.75rem;
    color: var(--text-muted);
    font-size: 1rem;
}

.search-wrap input {
    border: none;
    outline: none;
    flex: 1;
    padding: 0.65rem 0;
    font-size: 0.95rem;
    background: transparent;
}

.search-wrap .btn-search {
    background: var(--primary);
    color: white;
    border: none;
    padding: 0.65rem 1.2rem;
    font-weight: 600;
    font-size: 0.88rem;
    transition: background 0.15s;
}

.search-wrap .btn-search:hover {
    background: var(--primary-dark);
}

.search-wrap .btn-clear {
    background: none;
    border: none;
    color: var(--text-muted);
    padding: 0.5rem 0.6rem;
    font-size: 0.85rem;
    cursor: pointer;
}

.search-wrap .btn-clear:hover {
    color: var(--advanced);
}

/* ── Filter bar ── */
.filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

.filter-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.btn-filter {
    background: white;
    border: 1.5px solid var(--card-border);
    color: #374151;
    font-size: 0.82rem;
    padding: 0.3rem 0.75rem;
    border-radius: 20px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    text-decoration: none;
}

.btn-filter:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: #f0f0ff;
}

.btn-filter.is-active {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

.active-tag-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: #ede9fe;
    color: var(--primary);
    font-size: 0.82rem;
    font-weight: 500;
    padding: 0.3rem 0.65rem;
    border-radius: 20px;
}

.active-tag-chip a {
    color: inherit;
    text-decoration: none;
    font-size: 1rem;
    line-height: 1;
    opacity: 0.7;
}

.active-tag-chip a:hover { opacity: 1; }

/* ── Use-case cards ── */
.use-case-card {
    background: white;
    border: 1.5px solid var(--card-border);
    border-radius: 14px;
    box-shadow: var(--card-shadow);
    transition: box-shadow 0.2s, transform 0.2s, border-color 0.2s;
    display: flex;
    flex-direction: column;
}

.use-case-card:hover {
    box-shadow: var(--card-shadow-hover);
    transform: translateY(-3px);
    border-color: #c7d2fe;
}

.use-case-card .card-body { flex: 1; padding: 1.1rem 1.1rem 0.7rem; }
.use-case-card .card-footer {
    padding: 0.6rem 1.1rem;
    background: #fafbff;
    border-top: 1px solid var(--card-border);
    border-radius: 0 0 14px 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-title a {
    color: var(--text-main);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.97rem;
    line-height: 1.35;
}

.card-title a:hover { color: var(--primary); }

.card-desc {
    font-size: 0.82rem;
    color: var(--text-muted);
    line-height: 1.5;
    margin: 0.4rem 0;
}

/* ── Difficulty badges ── */
.diff-badge {
    font-size: 0.73rem;
    font-weight: 700;
    padding: 0.2rem 0.55rem;
    border-radius: 20px;
    color: white;
    white-space: nowrap;
}

.diff-easy   { background: var(--easy); }
.diff-medium { background: var(--medium); }
.diff-advanced { background: var(--advanced); }

/* ── Category / AI tool badges ── */
.cat-badge {
    font-size: 0.74rem;
    font-weight: 600;
    padding: 0.18rem 0.55rem;
    border-radius: 6px;
    color: white;
    background: var(--primary);
    text-decoration: none;
    cursor: pointer;
    transition: opacity 0.15s;
}
.cat-badge:hover { opacity: 0.85; color: white; }

.tool-badge {
    font-size: 0.74rem;
    font-weight: 600;
    padding: 0.18rem 0.55rem;
    border-radius: 6px;
    background: #e0f2fe;
    color: #0369a1;
    text-decoration: none;
    cursor: pointer;
    transition: opacity 0.15s;
}
.tool-badge:hover { opacity: 0.85; color: #0369a1; }

.user-badge {
    font-size: 0.74rem;
    padding: 0.18rem 0.5rem;
    border-radius: 6px;
    background: #f3f4f6;
    color: #4b5563;
    border: 1px solid #e5e7eb;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.15s;
}
.user-badge:hover { background: #e5e7eb; color: #374151; }

/* ── Tags ── */
.tag-link {
    font-size: 0.78rem;
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
}
.tag-link:hover { text-decoration: underline; color: var(--primary-dark); }

/* ── Tag chip input ── */
.tag-input-area {
    border: 2px solid var(--card-border);
    border-radius: 8px;
    padding: 0.35rem 0.6rem;
    min-height: 44px;
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    align-items: center;
    cursor: text;
    transition: border-color 0.2s, box-shadow 0.2s;
    background: white;
}

.tag-input-area:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.tag-chip {
    background: #ede9fe;
    color: var(--primary);
    border-radius: 5px;
    padding: 2px 7px;
    font-size: 0.8rem;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.tag-chip .remove-tag {
    background: none;
    border: none;
    color: var(--primary);
    padding: 0;
    font-size: 0.9rem;
    line-height: 1;
    cursor: pointer;
    opacity: 0.6;
    transition: opacity 0.1s;
}

.tag-chip .remove-tag:hover { opacity: 1; }

.tag-text-input {
    border: none;
    outline: none;
    font-size: 0.88rem;
    min-width: 100px;
    flex: 1;
    background: transparent;
    padding: 2px 2px;
}

/* ── Forms ── */
.form-label {
    font-weight: 500;
    font-size: 0.88rem;
    color: #374151;
    margin-bottom: 0.3rem;
}

.form-control, .form-select {
    border: 2px solid var(--card-border);
    border-radius: 8px;
    font-size: 0.9rem;
    color: var(--text-main);
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

textarea.form-control { resize: vertical; }

.section-divider {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-muted);
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--card-border);
    margin-bottom: 1rem;
}

/* Difficulty radio buttons */
.diff-radio-group { display: flex; gap: 0.5rem; }

.diff-radio-group input[type="radio"] { display: none; }

.diff-radio-label {
    padding: 0.35rem 1rem;
    border-radius: 8px;
    border: 2px solid var(--card-border);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    user-select: none;
}

.diff-radio-group input[value="Easy"] + .diff-radio-label { color: var(--easy); border-color: #86efac; }
.diff-radio-group input[value="Easy"]:checked + .diff-radio-label { background: var(--easy); color: white; border-color: var(--easy); }

.diff-radio-group input[value="Medium"] + .diff-radio-label { color: var(--medium); border-color: #fcd34d; }
.diff-radio-group input[value="Medium"]:checked + .diff-radio-label { background: var(--medium); color: white; border-color: var(--medium); }

.diff-radio-group input[value="Advanced"] + .diff-radio-label { color: var(--advanced); border-color: #fca5a5; }
.diff-radio-group input[value="Advanced"]:checked + .diff-radio-label { background: var(--advanced); color: white; border-color: var(--advanced); }

/* Target user checkboxes */
.target-users-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.4rem;
}

.form-check-card {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 0.35rem 0.6rem;
    border: 1.5px solid var(--card-border);
    border-radius: 7px;
    cursor: pointer;
    transition: all 0.15s;
    font-size: 0.84rem;
    user-select: none;
}

.form-check-card:hover { border-color: var(--primary); background: #f5f3ff; }
.form-check-card input:checked ~ span { color: var(--primary); font-weight: 600; }
.form-check-card:has(input:checked) { border-color: var(--primary); background: #ede9fe; }

/* ── View page ── */
.detail-card {
    background: white;
    border: 1.5px solid var(--card-border);
    border-radius: 14px;
    padding: 1.75rem 2rem;
    box-shadow: var(--card-shadow);
}

.detail-label {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--text-muted);
    margin-bottom: 0.3rem;
    display: block;
}

.prompt-box {
    background: #f8f8ff;
    border: 2px solid var(--card-border);
    border-radius: 10px;
    padding: 1rem 1.1rem;
    font-family: 'Courier New', Consolas, monospace;
    font-size: 0.88rem;
    line-height: 1.6;
    white-space: pre-wrap;
    word-break: break-word;
    color: #1e293b;
    position: relative;
}

.copy-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    font-size: 0.78rem;
    padding: 0.2rem 0.6rem;
    opacity: 0.7;
    transition: opacity 0.15s;
}

.copy-btn:hover { opacity: 1; }

/* ── Stats ── */
.stat-card {
    background: white;
    border: 1.5px solid var(--card-border);
    border-radius: 14px;
    padding: 1.5rem;
    text-align: center;
    box-shadow: var(--card-shadow);
}

.stat-number {
    font-size: 2.8rem;
    font-weight: 800;
    color: var(--primary);
    line-height: 1;
}

.stat-label {
    font-size: 0.82rem;
    color: var(--text-muted);
    font-weight: 500;
    margin-top: 0.3rem;
}

.chart-card {
    background: white;
    border: 1.5px solid var(--card-border);
    border-radius: 14px;
    padding: 1.5rem;
    box-shadow: var(--card-shadow);
}

.chart-title {
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    margin-bottom: 1rem;
}

/* ── Empty state ── */
.empty-state {
    padding: 4rem 1rem;
    text-align: center;
}

.empty-state i {
    font-size: 4rem;
    color: #c7d2fe;
}

/* ── Alerts ── */
.alert {
    border-radius: 10px;
    border: none;
    font-size: 0.88rem;
}

/* ── Results count ── */
.results-info {
    font-size: 0.82rem;
    color: var(--text-muted);
}

/* ── Breadcrumb ── */
.breadcrumb {
    font-size: 0.82rem;
}

/* ── Responsive ── */
@media (max-width: 640px) {
    .main-content { padding: 1rem; }
    .target-users-grid { grid-template-columns: repeat(2, 1fr); }
    .detail-card { padding: 1.2rem; }
}
