/* Muninn Custom Styles */

:root {
    --primary-color: #ff6b9d;
    --secondary-color: #c44569;
    --light-color: #ffd6e8;
    /* Decorative text (icons/kickers) sitting directly on the body background */
    --accent-text-color: var(--secondary-color);
}

[data-bs-theme="dark"] {
    /* Darker/more saturated than the light-mode values so white button text keeps enough contrast */
    --primary-color: #e0447d;
    --secondary-color: #b8265f;
    --light-color: #3a2530;
    --accent-text-color: #ff9dc0;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--bs-body-bg);
    color: var(--bs-body-color);
}

.navbar-brand {
    font-weight: bold;
    font-size: 1.3rem;
    /* Navbar is always dark regardless of page theme, so use a fixed color for legibility */
    color: #ff6b9d !important;
}

.navbar-brand i {
    margin-right: 0.5rem;
}

/* Theme toggle */
#themeToggle {
    color: rgba(255, 255, 255, 0.85);
    border: 0;
}

#themeToggle:hover,
#themeToggle:focus {
    color: #fff;
}

.theme-option.active {
    background-color: var(--bs-secondary-bg);
    font-weight: 600;
}

/* Focus states */
a:focus-visible,
button:focus-visible,
.btn:focus-visible,
.form-control:focus-visible,
.nav-link:focus-visible {
    outline: 0.15rem solid var(--primary-color);
    outline-offset: 0.1rem;
}

h1, h2, h3, h4, h5, h6 {
    color: var(--bs-emphasis-color);
}

.muninn-hero {
    display: grid;
    place-items: center;
    min-height: calc(100vh - 13rem);
    padding: 4rem 1rem;
    text-align: center;
}

.muninn-mark {
    display: grid;
    place-items: center;
    width: 4rem;
    height: 4rem;
    margin-bottom: 1.5rem;
    border: 1px solid var(--light-color);
    border-radius: 50% !important;
    color: var(--accent-text-color);
    font-size: 1.75rem;
}

.muninn-kicker {
    margin-bottom: 0.75rem;
    color: var(--accent-text-color);
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 0;
    text-transform: uppercase;
}

.muninn-hero h1 {
    margin-bottom: 1rem;
    font-family: Georgia, 'Times New Roman', serif;
    font-size: 4.5rem;
    font-weight: 700;
    letter-spacing: 0;
}

.muninn-intro {
    max-width: 40rem;
    margin-bottom: 2rem;
    color: var(--bs-secondary-color);
    font-size: 1.15rem;
    line-height: 1.7;
}

.muninn-features {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1.25rem 2rem;
    margin-top: 3.5rem;
    color: var(--bs-secondary-color);
    font-size: 0.95rem;
}

.muninn-features div {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.muninn-features i {
    color: var(--accent-text-color);
    font-size: 1.1rem;
}

/* Entry Cards */
.card {
    border: none;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s, box-shadow 0.2s;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.card-header {
    background-color: var(--bs-tertiary-bg);
    border-bottom: 2px solid var(--bs-border-color);
}

/* Utility classes that Bootstrap does not adapt automatically per color mode */
[data-bs-theme="dark"] .bg-light {
    background-color: var(--bs-tertiary-bg) !important;
    color: var(--bs-body-color) !important;
}

/* Bootstrap's outline button variants use fixed gray/red shades that don't keep
   enough contrast against a dark background, so lighten them for dark mode */
[data-bs-theme="dark"] .btn-outline-secondary {
    --bs-btn-color: #adb5bd;
    --bs-btn-border-color: #adb5bd;
    --bs-btn-hover-color: #fff;
    --bs-btn-hover-bg: #6c757d;
    --bs-btn-hover-border-color: #6c757d;
    --bs-btn-active-color: #fff;
    --bs-btn-active-bg: #6c757d;
    --bs-btn-active-border-color: #6c757d;
}

[data-bs-theme="dark"] .btn-outline-danger {
    --bs-btn-color: #ff7a8a;
    --bs-btn-border-color: #ff7a8a;
    --bs-btn-hover-color: #fff;
    --bs-btn-hover-bg: #dc3545;
    --bs-btn-hover-border-color: #dc3545;
    --bs-btn-active-color: #fff;
    --bs-btn-active-bg: #dc3545;
    --bs-btn-active-border-color: #dc3545;
}

/* Markdown editor */
.markdown-editor .nav-tabs {
    border-bottom: none;
}

.markdown-textarea {
    min-height: 320px;
    font-size: 0.95rem;
    line-height: 1.6;
    resize: vertical;
}

.markdown-preview {
    min-height: 320px;
    padding: 0.75rem;
    border: 1px solid var(--bs-border-color);
    border-radius: 0.375rem;
    background: var(--bs-body-bg);
}

@media (max-width: 768px) {
    .markdown-toolbar .btn-group {
        margin-bottom: 0.25rem;
    }
}

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

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

.btn-primary:active,
.btn-primary:focus {
    background-color: var(--secondary-color);
    border-color: var(--secondary-color);
    box-shadow: 0 0 0 0.25rem rgba(255, 107, 157, 0.25);
}

/* Entry Content */
.entry-content {
    line-height: 1.8;
    color: var(--bs-body-color);
}

.entry-content p {
    margin-bottom: 1rem;
}

/* Leftover blank lines from pasted content shouldn't take up a full paragraph's space */
.entry-content p:empty,
.entry-content p:has(> br:only-child) {
    margin-bottom: 0.5rem;
    min-height: 1em;
}

.entry-content h1,
.entry-content h2,
.entry-content h3 {
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
    line-height: 1.3;
}

.entry-content ul,
.entry-content ol {
    margin-bottom: 1rem;
}

.entry-content li {
    margin-bottom: 0.25rem;
}

.entry-content strong {
    color: var(--bs-emphasis-color);
    font-weight: 600;
}

.entry-content em {
    color: var(--bs-secondary-color);
}

/* Badges */
.badge {
    padding: 0.5rem 0.75rem;
    font-weight: 500;
}

/* Footer */
footer {
    border-top: 1px solid var(--bs-border-color);
    margin-top: auto;
}

/* Responsive */
@media (max-width: 768px) {
    .navbar-brand {
        font-size: 1.1rem;
    }

    h1 {
        font-size: 1.75rem;
    }

    .btn-group {
        flex-direction: column !important;
    }

    .btn-group .btn {
        width: 100%;
        margin-bottom: 0.25rem;
    }
}

/* Animations */
.fade-in {
    animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Alert styles */
.alert {
    border-radius: 0.5rem;
    border: none;
}

/* Like button */
#likeBtn.active {
    color: #ff6b9d;
}

/* Friend cards */
.friend-card {
    cursor: pointer;
    transition: all 0.2s;
}

.friend-card:hover {
    border-color: var(--primary-color);
}

/* Profile avatar */
.nav-profile-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.nav-profile-avatar {
    width: 16px;
    height: 16px;
    min-width: 16px;
    min-height: 16px;
    max-width: 16px;
    max-height: 16px;
    flex: 0 0 16px;
    border-radius: 50% !important;
    object-fit: cover;
    overflow: hidden;
}

.nav-profile-avatar-placeholder {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #6c757d;
    color: #fff;
    font-size: 0.9rem;
}

.avatar-upload {
    position: relative;
    display: inline-block;
}

.avatar-upload input[type="file"] {
    display: none;
}

.avatar-upload label {
    cursor: pointer;
}

/* Min height for main content */
main {
    min-height: 60vh;
}

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