/* ===== RESET ===== */
* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: 'Source Serif 4', Georgia, serif;
    background-color: #fbf5f2;
    background-image: radial-gradient(circle, rgba(125, 75, 59, 0.07) 1px, transparent 1px);
    background-size: 22px 22px;
    color: #2c1f14;
}

/* ===== HEADER ===== */
.header {
    position: sticky;
    top: 0;
    z-index: 10;

    background: #eddad4;
    border-bottom: 1px solid #e0cbc4;
}

.header-inner {
    max-width: 1060px;
    margin: 0 auto;

    padding: 14px 24px;

    display: flex;
    align-items: center;
    justify-content: space-between;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Logo */
.logo {
    font-family: 'Playfair Display', serif;
    font-size: 20px;
    display: flex;
    gap: 6px;
    align-items: center;
    text-decoration: none;
    color: #7d4b3b;
}

.logo span {
    letter-spacing: 0.04em;
}

.logo-emoji {
    font-size: 22px;
    line-height: 1;
}

/* Nav */
.nav {
    display: flex;
    gap: 18px;
}

.nav a {
    font-family: 'Lora', serif;
    font-size: 17px;
    font-weight: 650;
    color: #7d4b3b;
    text-decoration: none;
    position: relative;
}

/* underline animation */
.nav a::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: -4px;
    width: 0%;
    height: 1px;
    background: #7d4b3b;
    transition: width 0.2s ease;
}

.nav a:hover::after {
    width: 100%;
}

.nav a.primary {
    color: #7d4b3b;
}

.nav a.active {
    color: #7d4b3b;
    cursor: default;
}

.nav a.active::after,
.nav a.active:hover::after {
    width: 0% !important;
}

/* Header right */
.header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Search */
.search-form {
    position: relative;
    max-width: 210px;
}

.search-icon {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    width: 14px;
    height: 14px;
    color: #a89880;
    pointer-events: none;
}

.search-input {
    width: 100%;
    padding: 7px 12px 7px 32px;
    border-radius: 20px;
    border: 1px solid rgba(210, 195, 175, 0.7);
    background: rgba(255, 253, 247, 0.4);
    font-family: 'Source Serif 4', serif;
    font-size: 13px;
    color: #2c1f14;
    height: auto;
    transition: all 0.2s;
}

.search-input:focus {
    outline: none;
    border-color: rgba(139, 58, 58, 0.5);
    background: rgba(255, 253, 247, 0.85);
    box-shadow: 0 0 0 3px rgba(139, 58, 58, 0.08);
}

.search-input::placeholder {
    color: #b0a090;
}

.search-input::-webkit-search-cancel-button {
    display: none;
}

.search-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    min-width: 260px;
    background: rgba(255, 253, 247, 0.97);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(210, 195, 175, 0.8);
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(44, 31, 20, 0.12);
    overflow: hidden;
    z-index: 200;
}

.search-suggestion {
    display: flex;
    flex-direction: column;
    padding: 10px 14px;
    text-decoration: none;
    border-bottom: 1px solid rgba(232, 224, 208, 0.5);
    transition: background 0.1s;
}

.search-suggestion:last-child {
    border-bottom: none;
}

.search-suggestion:hover {
    background: rgba(139, 58, 58, 0.06);
}

.suggestion-title {
    font-family: 'Lora', serif;
    font-size: 14px;
    font-weight: 600;
    color: #2c1f14;
}

.suggestion-author {
    font-family: 'Source Serif 4', serif;
    font-size: 12px;
    color: #7a6652;
    font-style: italic;
    margin-top: 2px;
}

/* Logout */
.logout-btn {
    font-family: 'Lora', serif;
    font-size: 17px;
    font-weight: 650;
    color: #7d4b3b;
    text-decoration: none;
    padding: 6px 14px;
    border-radius: 8px;
    background: rgba(204, 196, 182, 0.7);
    transition: background 0.2s, color 0.2s;
}

.logout-btn:hover {
    background: #b8b0a2;
    color: #2c1f14;
}

/* ===== HERO ===== */
.hero {
    margin-bottom: 32px;
}

.hero h1 {
    font-family: 'Playfair Display', serif;
    font-size: 2.2rem;
    margin-bottom: 8px;
    color: #7d4b3b;
}

.hero p {
    color: #7d4b3b;
    margin-bottom: 18px;
}

/* ===== CARDS ===== */
.card {
    background: rgba(255, 253, 247, 0.75);
    backdrop-filter: blur(8px);

    padding: 32px;
    border-radius: 14px;

    border: 1px solid rgba(232, 224, 208, 0.6);

    box-shadow:
        0 4px 20px rgba(44, 31, 20, 0.06),
        0 1px 2px rgba(44, 31, 20, 0.04);

    transition: all 0.2s ease;
    margin-bottom: 16px;
}

.card:hover {
    transform: translateY(-3px);
    box-shadow:
        0 10px 30px rgba(44, 31, 20, 0.1),
        0 3px 8px rgba(44, 31, 20, 0.05);
}

.book-card {
    display: block;
    text-decoration: none;
    color: inherit;
    background: rgba(255, 253, 247, 0.75);
    backdrop-filter: blur(8px);
    padding: 20px 24px;
    margin: 12px 0;
    border-radius: 0 10px 10px 0;
    border: 1px solid rgba(232, 224, 208, 0.6);
    border-left: 3px solid #8b3a3a;
    box-shadow: 0 2px 10px rgba(44, 31, 20, 0.05);
    transition: all 0.2s ease;
}

.book-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(44, 31, 20, 0.1);
}

/* ===== TYPOGRAPHY ===== */
h1 {
    font-family: 'Playfair Display', serif;
    line-height: 1.3;
    color: #7d4b3b;
}

h2 {
    font-family: 'Lora', serif;
    font-size: 1.2rem;
    margin-bottom: 10px;
    color: #7d4b3b;
}

.book-title {
    font-family: 'Lora', Georgia, serif;
    font-size: 20px;
    font-weight: 600;
    color: #7d4b3b;
}

.author {
    font-style: italic;
    color: #7a6652;
    margin-bottom: 16px;
}

.divider {
    border: none;
    border-top: 1px solid rgba(232, 224, 208, 0.8);
    margin: 0 0 20px 0;
}

.review-label {
    font-family: 'Lora', Georgia, serif;
    font-size: 12px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #7a6652;
    margin-bottom: 10px;
}

.review {
    line-height: 1.8;
    font-size: 16px;
    white-space: pre-line;
}

.date-read {
    font-family: 'Lora', Georgia, serif;
    font-size: 13px;
    color: #a89880;
    font-style: italic;
    margin-bottom: 8px;
}

.review-preview {
    font-family: 'Lora', serif;
    font-weight: 400;
    color: #5a4a3a;
    line-height: 1.7;
    font-size: 15px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ===== STARS ===== */
.stars-display {
    display: flex;
    gap: 2px;
    margin-bottom: 16px;
}

.stars-display .star {
    font-size: 20px;
    color: #d4c9b5;
    line-height: 1;
}

.stars-display .star.filled {
    color: #c8943a;
}

.star-rating {
    display: flex;
    flex-direction: row-reverse;
    justify-content: flex-end;
    gap: 2px;
    margin-bottom: 4px;
}

.star-rating input[type="radio"] {
    display: none;
    width: auto;
}

.star-rating label {
    font-size: 28px;
    color: #d4c9b5;
    cursor: pointer;
    transition: color 0.1s;
    letter-spacing: 0;
    font-family: serif;
}

.star-rating input:checked ~ label,
.star-rating label:hover,
.star-rating label:hover ~ label {
    color: #c8943a;
}

/* ===== SIDEBAR / STATS ===== */
.main-col {
    min-width: 0;
}

.sidebar {
    position: sticky;
    top: 80px;
    margin-top: 100px;
}

.stat-card {
    background: rgba(255, 253, 247, 0.75);
    border: 1px solid rgba(232, 224, 208, 0.6);
    border-left: 3px solid #8b3a3a;
    border-radius: 0 8px 8px 0;
    padding: 14px 16px;
    box-shadow: 0 2px 10px rgba(44, 31, 20, 0.05);
}

.stat-label {
    font-family: 'Lora', Georgia, serif;
    font-size: 11px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #a89880;
    margin-bottom: 4px;
}

.stat-value {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 1.8rem;
    font-weight: 600;
    color: #2c1f14;
    line-height: 1;
}

/* ===== BUTTONS ===== */
.btn {
    display: inline-block;
    padding: 8px 14px;
    border-radius: 8px;
    font-family: 'Lora', serif;
    font-size: 14px;
    text-decoration: none;
    transition: all 0.15s ease;
}

/* primary */
.btn-primary {
    background: #8b3a3a;
    color: #fff;
}

.btn-primary:hover {
    background: #6e2e2e;
    transform: translateY(-1px);
}

/* secondary */
.btn-secondary {
    background: #e8e0d0;
    color: #2c1f14;
}

.btn-secondary:hover {
    background: #ddd3bf;
}

/* danger */
.btn-danger {
    background: #a94442;
    color: #fff;
}

.btn-danger:hover {
    background: #8b3a3a;
}

/* form submit button */
button {
    width: 100%;
    background: #8b3a3a;
    color: #faf8f3;
    border: none;
    padding: 12px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-family: 'Lora', Georgia, serif;
    letter-spacing: 0.03em;
    transition: background 0.2s;
}

button:hover {
    background: #6e2e2e;
}

.buttons {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}

/* ===== FORMS ===== */
form {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

label {
    display: flex;
    flex-direction: column;
    gap: 5px;
    font-size: 13px;
    font-family: 'Lora', Georgia, serif;
    color: #7a6652;
    letter-spacing: 0.03em;
}

input, textarea {
    width: 100%;
    padding: 10px 12px;
    border-radius: 8px;

    border: 1px solid #d4c9b5;
    background: #faf8f3;

    font-family: 'Source Serif 4', serif;
    font-size: 14px;
    color: #2c1f14;
}

input:focus, textarea:focus {
    outline: none;
    border-color: #8b3a3a;
    box-shadow: 0 0 0 3px rgba(139, 58, 58, 0.1);
}

textarea {
    height: 120px;
    resize: none;
}

/* ===== BACK LINK ===== */
.back {
    display: inline-block;
    margin-bottom: 24px;
    font-size: 13px;
    font-family: 'Lora', Georgia, serif;
    color: #7a6652;
    text-decoration: none;
    letter-spacing: 0.03em;
}

.back:hover {
    color: #8b3a3a;
}

/* ===== EMPTY STATE ===== */
.empty {
    text-align: center;
    padding: 40px 0;
    color: #7a6652;
}

/* ===== ERROR ===== */
.error {
    background: #fdf0f0;
    border: 1px solid #e8c0c0;
    color: #8b3a3a;
    font-size: 13px;
    padding: 10px 12px;
    border-radius: 8px;
    text-align: center;
}

/* ===== LOGIN PAGE ===== */
.login-body {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-card {
    background: rgba(255, 253, 247, 0.85);
    backdrop-filter: blur(8px);
    padding: 48px 44px;
    border-radius: 14px;
    border: 1px solid rgba(232, 224, 208, 0.6);
    box-shadow: 0 4px 20px rgba(44, 31, 20, 0.08);
    width: 100%;
    max-width: 380px;
}

.login-title {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 2rem;
    font-weight: 600;
    color: #2c1f14;
    text-align: center;
    margin: 0 0 6px 0;
    line-height: 1.3;
}

.login-subtitle {
    font-family: 'Lora', Georgia, serif;
    font-style: italic;
    font-size: 14px;
    color: #7a6652;
    text-align: center;
    margin: 0 0 32px 0;
}

/* ===== MARKDOWN TOOLBAR ===== */
.md-toolbar {
    display: flex;
    gap: 4px;
    margin-bottom: 4px;
}

.md-toolbar button {
    width: auto;
    padding: 4px 10px;
    font-size: 13px;
    background: #eddad4;
    color: #7d4b3b;
    border-radius: 6px;
    border: 1px solid #e0cbc4;
    cursor: pointer;
    transition: background 0.15s;
}

.md-toolbar button:hover {
    background: #e0cbc4;
}

/* ===== MODAL ===== */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(44, 31, 20, 0.4);
    backdrop-filter: blur(4px);
    z-index: 500;
    align-items: center;
    justify-content: center;
}

.modal-overlay.modal-open {
    display: flex;
}

.modal {
    background: #fbf5f2;
    border-radius: 14px;
    padding: 32px 36px;
    max-width: 380px;
    width: 90%;
    box-shadow: 0 12px 40px rgba(44, 31, 20, 0.15);
}

.modal-title {
    font-family: 'Playfair Display', serif;
    font-size: 1.3rem;
    color: #7d4b3b;
    margin-bottom: 10px;
}

.modal-text {
    font-family: 'Source Serif 4', serif;
    font-size: 14px;
    color: #7a6652;
    line-height: 1.6;
    margin-bottom: 24px;
}

.modal-buttons {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

/* ===== TOAST ===== */
.toast {
    position: fixed;
    top: 80px;
    right: 32px;
    background: rgba(125, 75, 59, 0.45);
    backdrop-filter: blur(8px);
    color: #fff;
    font-family: 'Lora', serif;
    font-size: 16px;
    padding: 16px 28px;
    border-radius: 12px;
    box-shadow: 0 4px 16px rgba(44, 31, 20, 0.15);
    opacity: 1;
    transform: translateY(0);
    transition: opacity 0.5s ease, transform 0.5s ease;
    pointer-events: none;
    z-index: 999;
}

.toast.toast-hide {
    opacity: 0;
    transform: translateY(-12px);
}
