:root {
    --night: #3b3486;
    --night-dark: #2d2766;
    --moon: #ffc95c;
    --cream: #fdf8ef;
    --ink: #3a3341;
    --teal: #1f8a70;
}

body {
    font-family: 'Vazirmatn', 'Segoe UI', Tahoma, sans-serif;
    background-color: var(--cream);
    color: var(--ink);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

main {
    flex: 1 0 auto;
}

/* ---------- Navbar ---------- */
.app-navbar {
    background: linear-gradient(135deg, var(--night) 0%, var(--night-dark) 100%);
    box-shadow: 0 2px 12px rgba(45, 39, 102, .35);
}

.app-navbar .navbar-brand {
    color: var(--moon);
    font-weight: 700;
    font-size: 1.35rem;
}

.app-navbar .nav-link {
    color: #efeafd;
    font-weight: 500;
}

.app-navbar .nav-link:hover,
.app-navbar .nav-link.active {
    color: var(--moon);
}

.app-navbar .navbar-toggler {
    border-color: rgba(255, 255, 255, .4);
}

.app-navbar .navbar-toggler-icon {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba%28255, 255, 255, 0.85%29' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
}

.navbar-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--moon);
}

/* ---------- Hero (homepage) ---------- */
.hero {
    background: linear-gradient(160deg, var(--night) 0%, #5146a8 60%, #6a5cc9 100%);
    color: #fff;
    border-radius: 0 0 2rem 2rem;
    padding: 3.5rem 0 3rem;
}

.hero h1 {
    font-weight: 700;
    color: var(--moon);
}

/* ---------- Cards ---------- */
.card {
    border: none;
    border-radius: 1.25rem;
    box-shadow: 0 3px 14px rgba(59, 52, 134, .08);
}

.tale-card {
    transition: transform .15s ease, box-shadow .15s ease;
    overflow: hidden;
    height: 100%;
}

.tale-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 22px rgba(59, 52, 134, .18);
}

.tale-cover {
    height: 170px;
    object-fit: cover;
    width: 100%;
}

.tale-cover-placeholder {
    height: 170px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3.5rem;
    background: linear-gradient(135deg, #efe9ff, #dcd2ff);
}

/* ---------- Buttons: large tap targets, friendly for children and elderly users ---------- */
.btn {
    border-radius: .9rem;
}

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

.btn-primary:hover, .btn-primary:focus {
    background-color: var(--night-dark);
    border-color: var(--night-dark);
}

.btn-warm {
    background-color: var(--moon);
    border-color: var(--moon);
    color: var(--night-dark);
    font-weight: 700;
}

.btn-warm:hover {
    background-color: #f0b73f;
    border-color: #f0b73f;
    color: var(--night-dark);
}

.btn-big {
    font-size: 1.25rem;
    padding: .85rem 2rem;
}

.form-control, .form-select {
    border-radius: .8rem;
    padding: .6rem .9rem;
}

.form-control-lg {
    font-size: 1.15rem;
}

/* ---------- Category chips ---------- */
.category-chip {
    display: inline-block;
    background: #efe9ff;
    color: var(--night);
    border-radius: 2rem;
    padding: .35rem 1rem;
    margin: .15rem;
    font-weight: 500;
    text-decoration: none;
    transition: background .15s;
}

.category-chip:hover, .category-chip.active {
    background: var(--night);
    color: #fff;
}

/* ---------- Star rating ---------- */
.stars {
    direction: ltr;
    display: inline-flex;
    gap: .15rem;
    font-size: 1.6rem;
    line-height: 1;
}

.stars .star {
    color: #d8d2e8;
    cursor: default;
    background: none;
    border: none;
    padding: 0;
    font-size: inherit;
}

.stars .star.filled {
    color: var(--moon);
}

.stars.interactive .star {
    cursor: pointer;
    transition: transform .1s;
}

.stars.interactive .star:hover {
    transform: scale(1.2);
}

.stars-sm {
    font-size: 1.05rem;
}

/* ---------- Audio player ---------- */
audio {
    width: 100%;
}

/* ---------- Recorder ---------- */
.record-btn {
    width: 92px;
    height: 92px;
    border-radius: 50%;
    border: none;
    background: #d9534f;
    color: #fff;
    font-size: 2.2rem;
    box-shadow: 0 4px 14px rgba(217, 83, 79, .4);
}

.record-btn.recording {
    animation: pulse 1.2s infinite;
    background: #b02a25;
}

@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(217, 83, 79, .5); }
    70% { box-shadow: 0 0 0 18px rgba(217, 83, 79, 0); }
    100% { box-shadow: 0 0 0 0 rgba(217, 83, 79, 0); }
}

/* ---------- Comments ---------- */
.comment {
    border-inline-start: 3px solid #e4ddf5;
    padding-inline-start: 1rem;
}

.comment-reply {
    margin-inline-start: 2.5rem;
}

.comment-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
}

.comment-avatar-placeholder {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #efe9ff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

/* ---------- Status badges ---------- */
.badge {
    font-weight: 500;
}

/* ---------- Progress bars in dashboard ---------- */
.progress {
    height: .8rem;
    border-radius: 1rem;
}

.progress-bar {
    background-color: var(--teal);
}

/* ---------- Footer ---------- */
.app-footer {
    flex-shrink: 0;
    background: var(--night-dark);
    color: #cfc8ee;
    margin-top: 3rem;
}

.app-footer a {
    color: var(--moon);
    text-decoration: none;
}

/* ---------- Top-5 ribbon ---------- */
.top-rank {
    position: absolute;
    top: .6rem;
    inset-inline-start: .6rem;
    background: var(--moon);
    color: var(--night-dark);
    font-weight: 700;
    border-radius: 50%;
    width: 2.3rem;
    height: 2.3rem;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, .25);
}
