/* =====================
   LæringsGPT - Design
   ===================== */

:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --success: #16a34a;
    --danger: #dc2626;
    --warning: #d97706;
    --bg-light: #f8fafc;
    --bg-card: #ffffff;
    --border: #e2e8f0;
    --text-muted: #64748b;
    --radius: 0.75rem;
    --shadow: 0 1px 3px rgba(0,0,0,.08), 0 4px 16px rgba(0,0,0,.06);
    --shadow-sm: 0 1px 2px rgba(0,0,0,.06);
}

html, body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background-color: var(--bg-light);
    color: #1e293b;
    min-height: 100vh;
}

/* ---- Navbar ---- */
.navbar {
    background: linear-gradient(135deg, #1e3a5f 0%, #2563eb 100%) !important;
    box-shadow: 0 2px 12px rgba(37,99,235,.3);
    padding: .75rem 0;
}

.navbar-brand {
    font-size: 1.3rem;
    font-weight: 700;
    letter-spacing: -.3px;
    color: #fff !important;
}

.navbar .nav-link {
    color: rgba(255,255,255,.85) !important;
    font-weight: 500;
    padding: .4rem .8rem;
    border-radius: .5rem;
    transition: background .2s, color .2s;
}

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

.navbar .btn-link.nav-link {
    text-decoration: none;
    border: none;
    background: none;
}

/* ---- Page container ---- */
.container {
    max-width: 1100px;
}

/* ---- Cards ---- */
.card {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    transition: box-shadow .2s;
}

.card:hover {
    box-shadow: 0 4px 20px rgba(0,0,0,.1);
}

.card-header {
    background: var(--bg-light);
    border-bottom: 1px solid var(--border);
    font-weight: 600;
    padding: .9rem 1.25rem;
}

/* ---- Page headings ---- */
h2, h3 {
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 1.25rem;
}

h5, h6 {
    font-weight: 600;
    color: #1e293b;
}

/* ---- Buttons ---- */
.btn {
    border-radius: .5rem;
    font-weight: 500;
    padding: .45rem 1rem;
    transition: all .2s;
}

.btn-primary {
    background: var(--primary);
    border-color: var(--primary);
}

.btn-primary:hover {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(37,99,235,.3);
}

.btn-success {
    background: var(--success);
    border-color: var(--success);
}

.btn-danger {
    background: var(--danger);
    border-color: var(--danger);
}

/* ---- Forms ---- */
.form-control, .form-select {
    border: 1px solid var(--border);
    border-radius: .5rem;
    padding: .5rem .85rem;
    transition: border-color .2s, box-shadow .2s;
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37,99,235,.15);
    outline: none;
}

.form-label {
    font-weight: 500;
    color: #374151;
    margin-bottom: .35rem;
}

/* ---- Alerts ---- */
.alert {
    border-radius: var(--radius);
    border: none;
    font-size: .92rem;
}

.alert-info { background: #eff6ff; color: #1d4ed8; }
.alert-success { background: #f0fdf4; color: #15803d; }
.alert-danger { background: #fef2f2; color: #b91c1c; }
.alert-warning { background: #fffbeb; color: #b45309; }

/* ---- Chat box ---- */
.chat-box {
    background: #f8fafc;
    border: 1px solid var(--border) !important;
    border-radius: var(--radius) !important;
    scroll-behavior: smooth;
}

.chat-bubble {
    max-width: 75%;
    padding: .65rem 1rem;
    border-radius: 1rem;
    font-size: .93rem;
    line-height: 1.5;
    box-shadow: var(--shadow-sm);
    overflow-wrap: break-word;
    word-break: break-word;
}

.chat-bubble-gpt {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    color: #1e3a5f;
    border-bottom-left-radius: .25rem;
}

.chat-bubble-user {
    background: var(--primary);
    color: #fff;
    border-bottom-right-radius: .25rem;
}

.chat-bubble-system {
    background: #fef3c7;
    border: 1px solid #fde68a;
    color: #92400e;
}

.chat-timestamp {
    font-size: .74rem;
    opacity: .65;
    margin-top: .25rem;
}

/* ---- List group ---- */
.list-group-item {
    border-color: var(--border);
    padding: .7rem 1rem;
}

.list-group-item:first-child { border-radius: var(--radius) var(--radius) 0 0; }
.list-group-item:last-child  { border-radius: 0 0 var(--radius) var(--radius); }

/* ---- Badges ---- */
.badge {
    font-weight: 500;
    padding: .3em .65em;
    border-radius: .4rem;
}

/* ---- Tables ---- */
.table {
    font-size: .9rem;
}

.table thead th {
    background: var(--bg-light);
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    font-size: .75rem;
    letter-spacing: .05em;
    border-bottom: 2px solid var(--border);
}

.table-hover tbody tr:hover {
    background: #f0f9ff;
}

/* ---- Nav tabs (Manage) ---- */
.nav-tabs {
    border-bottom: 2px solid var(--border);
    gap: .25rem;
}

.nav-tabs .nav-link {
    color: var(--text-muted);
    font-weight: 500;
    border: none;
    border-radius: .5rem .5rem 0 0;
    padding: .6rem 1.25rem;
}

.nav-tabs .nav-link:hover {
    color: var(--primary);
    background: #eff6ff;
}

.nav-tabs .nav-link.active {
    color: var(--primary);
    background: #eff6ff;
    border-bottom: 2px solid var(--primary);
    font-weight: 600;
}

/* ---- Spinner ---- */
.spinner-border {
    color: var(--primary);
}

/* ---- Home hero ---- */
.hero-section {
    background: linear-gradient(135deg, #1e3a5f 0%, #2563eb 100%);
    border-radius: calc(var(--radius) * 2);
    color: #fff;
    padding: 3rem 2rem;
    margin-bottom: 2rem;
    text-align: center;
    box-shadow: 0 8px 32px rgba(37,99,235,.25);
}

.hero-section h1 { color: #fff; font-size: 2.2rem; font-weight: 800; }
.hero-section p  { color: rgba(255,255,255,.85); font-size: 1.1rem; }

/* ---- Sidebar nav (Manage page) ---- */
.manage-nav .nav-link {
    color: #374151;
    border-radius: .5rem;
    padding: .55rem .9rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: .5rem;
}

.manage-nav .nav-link:hover  { background: #eff6ff; color: var(--primary); }
.manage-nav .nav-link.active { background: #eff6ff; color: var(--primary); font-weight: 600; }

/* ---- Page header strip ---- */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    padding-bottom: .75rem;
    border-bottom: 2px solid var(--border);
}

.page-header h2, .page-header h3 {
    margin: 0;
}

/* ---- Responsive tweaks ---- */
@media (max-width: 768px) {
    .hero-section { padding: 2rem 1rem; }
    .hero-section h1 { font-size: 1.6rem; }
    .chat-bubble { max-width: 92%; }
}
