/* style.css — יומן קריאה */

/* ============================
   Reset & Base
   ============================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --white:      #ffffff;
    --bg:         #f8f8f6;
    --border:     #e8e8e4;
    --border-mid: #d4d4cc;
    --text:       #1a1a18;
    --text-mid:   #4a4a46;
    --text-light: #8a8a84;
    --accent:     #2d6a4f;      /* ירוק ספריה */
    --accent-light: #e8f4ee;
    --accent-hover: #235c42;
    --danger:     #c0392b;
    --star:       #c9973a;
    --radius:     10px;
    --radius-sm:  6px;
    --shadow:     0 1px 4px rgba(0,0,0,.06), 0 4px 16px rgba(0,0,0,.04);
    --shadow-card: 0 2px 8px rgba(0,0,0,.07), 0 1px 3px rgba(0,0,0,.04);
    --font: 'Open Sans', sans-serif;
    --header-h: 60px;
}

html { font-size: 16px; }

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    direction: rtl;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
textarea, input, select, button { font-family: var(--font); }

/* ============================
   Header
   ============================ */
.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--white);
    border-bottom: 1px solid var(--border);
    height: var(--header-h);
}

.header-inner {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 24px;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.site-logo {
    font-size: .95rem;
    font-weight: 600;
    color: var(--accent);
    letter-spacing: -.01em;
    flex-shrink: 0;
}

.header-nav {
    display: flex;
    align-items: center;
    gap: 20px;
}

.header-nav a {
    font-size: .875rem;
    font-weight: 500;
    color: var(--text-mid);
    transition: color .15s;
}

.header-nav a:hover { color: var(--text); }
.header-nav a.active { color: var(--accent); }

.header-nav .btn-primary {
    color: white !important;
    padding: 9px 22px;
    font-size: .9rem;
}

.nav-logout, .nav-settings {
    color: var(--text-light) !important;
    font-weight: 400 !important;
    font-size: .8rem !important;
}

/* Settings page */
.settings-section {
    border-bottom: 1px solid var(--border);
    padding-bottom: 28px;
    margin-bottom: 28px;
}

.settings-section:last-child {
    border-bottom: none;
}

.settings-heading {
    font-size: .95rem;
    font-weight: 600;
    margin-bottom: 6px;
}

.settings-sub {
    font-size: .82rem;
    color: var(--text-light);
    margin-bottom: 14px;
}

.settings-meta {
    font-size: .875rem;
    color: var(--text-mid);
    margin-bottom: 4px;
}

.settings-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
    max-width: 380px;
}

/* ============================
   Stats bar
   ============================ */
.stats-bar {
    background: var(--white);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    padding: 0;
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 16px 36px;
    gap: 2px;
}

.stat-num {
    font-size: 1.6rem;
    font-weight: 300;
    color: var(--accent);
    line-height: 1;
}

.stat-label {
    font-size: .72rem;
    color: var(--text-light);
    letter-spacing: .03em;
    text-transform: uppercase;
}

.stat-divider {
    width: 1px;
    height: 36px;
    background: var(--border);
}

/* ============================
   Main layout
   ============================ */
.main-content {
    max-width: 1100px;
    margin: 0 auto;
    padding: 28px 24px 60px;
}

.main-content.narrow {
    max-width: 680px;
}

.page-title {
    font-size: 1.3rem;
    font-weight: 600;
    margin-bottom: 24px;
    color: var(--text);
}

/* ============================
   Filters row
   ============================ */
.filters-section {
    margin-bottom: 24px;
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    gap: 20px;
    flex-wrap: wrap;
}

.filter-row {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.filter-row-label {
    font-size: .72rem;
    font-weight: 600;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: .04em;
}

.filter-group {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.filter-chip {
    padding: 5px 14px;
    border-radius: 20px;
    font-size: .8rem;
    font-weight: 500;
    background: var(--white);
    border: 1px solid var(--border);
    color: var(--text-mid);
    transition: all .15s;
    cursor: pointer;
}

.filter-chip:hover { border-color: var(--border-mid); color: var(--text); }
.filter-chip.active { background: var(--accent); border-color: var(--accent); color: white; }

.filter-chip-sm {
    padding: 3px 10px;
    font-size: .74rem;
}

.filter-divider {
    color: var(--border-mid);
    font-size: .9rem;
    align-self: center;
    user-select: none;
    padding: 0 2px;
}

/* ============================
   Books grid
   ============================ */
.books-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 20px;
}

.book-card {
    display: flex;
    flex-direction: column;
    gap: 10px;
    cursor: pointer;
    transition: transform .2s;
}

.book-card:hover { transform: translateY(-3px); }

.book-cover {
    position: relative;
    aspect-ratio: 2/3;
    border-radius: var(--radius-sm);
    overflow: hidden;
    box-shadow: var(--shadow-card);
    background: var(--border);
}

.book-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.cover-placeholder {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #2d6a4f 0%, #1b4332 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255,255,255,.6);
    font-size: 2rem;
    font-weight: 300;
}

.cover-placeholder.large {
    width: 180px;
    height: 270px;
    border-radius: var(--radius);
    flex-shrink: 0;
    font-size: 3rem;
}

.format-badge {
    position: absolute;
    bottom: 6px;
    right: 6px;
    background: rgba(0,0,0,.6);
    color: white;
    font-size: .65rem;
    padding: 2px 6px;
    border-radius: 10px;
    font-weight: 500;
}

.book-info { padding: 0 2px; }

.book-title {
    font-size: .85rem;
    font-weight: 600;
    line-height: 1.3;
    color: var(--text);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.book-author {
    font-size: .75rem;
    color: var(--text-light);
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.book-rating {
    font-size: .75rem;
    color: var(--star);
    margin-top: 3px;
    letter-spacing: .05em;
}

.book-date {
    font-size: .7rem;
    color: var(--text-light);
    margin-top: 2px;
}

.results-count {
    margin-top: 28px;
    font-size: .8rem;
    color: var(--text-light);
    text-align: center;
}

/* ============================
   Empty state
   ============================ */
.empty-state {
    text-align: center;
    padding: 80px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.empty-icon { font-size: 3rem; }
.empty-title { font-size: 1.1rem; font-weight: 600; }
.empty-sub { font-size: .875rem; color: var(--text-light); margin-bottom: 6px; }

/* ============================
   Login
   ============================ */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: var(--bg);
}

.login-wrap {
    width: 100%;
    max-width: 380px;
    padding: 40px 32px;
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.login-logo {
    text-align: center;
    margin-bottom: 28px;
}

.logo-icon { font-size: 2.5rem; }

.login-logo h1 {
    font-size: 1.3rem;
    font-weight: 600;
    margin-top: 8px;
}

.login-form { display: flex; flex-direction: column; gap: 16px; }

/* ============================
   Forms
   ============================ */
.field { display: flex; flex-direction: column; gap: 6px; }
.field-label, label { font-size: .8rem; font-weight: 600; color: var(--text-mid); }

input[type="text"],
input[type="password"],
input[type="date"],
input[type="email"],
textarea,
select {
    width: 100%;
    padding: 9px 13px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: .9rem;
    color: var(--text);
    background: var(--white);
    transition: border-color .15s;
    line-height: 1.5;
}

input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-light);
}

textarea { resize: vertical; min-height: 80px; }

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 16px;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}

.radio-group {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    padding-top: 4px;
}

.radio-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: .875rem;
    font-weight: 400;
    color: var(--text);
    cursor: pointer;
}

.radio-label input[type="radio"] { accent-color: var(--accent); width: 16px; height: 16px; }

/* Star rating */
.star-input { display: flex; gap: 4px; font-size: 1.4rem; cursor: pointer; }
.star { color: var(--border-mid); transition: color .1s; user-select: none; }
.star:hover, .star.filled { color: var(--star); }

/* Quotes */
.quote-row {
    display: flex;
    gap: 8px;
    align-items: flex-start;
    margin-bottom: 10px;
}

.quote-row textarea { flex: 1; min-height: 64px; }

/* Cover preview + manual input row */
.cover-input-row {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 16px;
}

.cover-preview {
    position: relative;
    flex-shrink: 0;
}

.cover-preview img {
    width: 80px;
    height: 120px;
    object-fit: cover;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-card);
    display: block;
}

.cover-preview.hidden { display: none; }

.btn-clear-cover {
    position: absolute;
    top: -8px;
    left: -8px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--text);
    color: white;
    border: none;
    cursor: pointer;
    font-size: .7rem;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.cover-url-field { flex: 1; }

.field-hint {
    font-size: .74rem;
    color: var(--text-light);
    margin-top: 3px;
}

/* ============================
   Google Books Search
   ============================ */
.search-block {
    background: var(--accent-light);
    border: 1px solid #c8e6d8;
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 24px;
}

.search-row {
    display: flex;
    gap: 8px;
    margin-top: 6px;
}

.search-row input { flex: 1; }

.search-results {
    margin-top: 12px;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    max-height: 320px;
    overflow-y: auto;
}

.search-results.hidden { display: none; }

.result-item {
    display: flex;
    gap: 12px;
    padding: 12px;
    cursor: pointer;
    border-bottom: 1px solid var(--border);
    transition: background .1s;
}

.result-item:last-child { border-bottom: none; }
.result-item:hover { background: var(--accent-light); }

.result-item img {
    width: 40px;
    height: 60px;
    object-fit: cover;
    border-radius: 3px;
    flex-shrink: 0;
}

.result-no-cover {
    width: 40px;
    height: 60px;
    background: var(--border);
    border-radius: 3px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    flex-shrink: 0;
}

.result-info { display: flex; flex-direction: column; gap: 3px; }
.result-info strong { font-size: .85rem; line-height: 1.3; }
.result-info span { font-size: .75rem; color: var(--text-light); }

.searching, .no-results, .search-error {
    padding: 16px;
    text-align: center;
    font-size: .85rem;
    color: var(--text-light);
}

/* ============================
   Book detail page
   ============================ */
.book-detail {
    display: flex;
    gap: 32px;
    margin-bottom: 36px;
    align-items: flex-start;
}

.book-detail-cover img {
    width: 180px;
    height: 270px;
    object-fit: cover;
    border-radius: var(--radius);
    box-shadow: 0 4px 20px rgba(0,0,0,.12);
    flex-shrink: 0;
}

.book-detail-info { flex: 1; padding-top: 4px; }

.detail-title {
    font-size: 1.5rem;
    font-weight: 600;
    line-height: 1.3;
    margin-bottom: 6px;
}

.detail-author {
    font-size: 1rem;
    color: var(--text-mid);
    margin-bottom: 12px;
}

.detail-rating {
    font-size: 1.2rem;
    color: var(--star);
    letter-spacing: .08em;
    margin-bottom: 14px;
}

.detail-meta {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.meta-tag {
    padding: 4px 12px;
    background: var(--accent-light);
    border: 1px solid #c8e6d8;
    border-radius: 20px;
    font-size: .78rem;
    font-weight: 500;
    color: var(--accent);
}

.tag-want { background: #fff8e7; border-color: #f0d98a; color: #8a6d00; }

.detail-dates {
    display: flex;
    flex-direction: column;
    gap: 3px;
    font-size: .82rem;
    color: var(--text-light);
    margin-bottom: 20px;
}

.detail-actions { display: flex; gap: 8px; }

.detail-section {
    border-top: 1px solid var(--border);
    padding-top: 24px;
    margin-bottom: 28px;
}

.detail-section h3 {
    font-size: .85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--text-light);
    margin-bottom: 14px;
}

.notes-body {
    font-size: .9rem;
    line-height: 1.7;
    color: var(--text-mid);
}

.quotes-list { display: flex; flex-direction: column; gap: 14px; }

blockquote.quote-item {
    border-right: 3px solid var(--accent);
    padding: 10px 16px;
    background: var(--accent-light);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    font-size: .9rem;
    line-height: 1.6;
    color: var(--text-mid);
    font-style: italic;
}

/* ============================
   Buttons
   ============================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 9px 20px;
    border-radius: var(--radius-sm);
    font-size: .875rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all .15s;
    text-decoration: none;
    line-height: 1;
}

.btn-primary {
    background: var(--accent);
    color: white;
}
.btn-primary:hover { background: var(--accent-hover); }

.btn-secondary {
    background: var(--white);
    color: var(--text);
    border: 1px solid var(--border-mid);
}
.btn-secondary:hover { border-color: var(--text-mid); }

.btn-ghost {
    background: transparent;
    color: var(--text-mid);
    border: 1px solid transparent;
}
.btn-ghost:hover { border-color: var(--border); background: var(--white); }

.btn-danger {
    background: transparent;
    color: var(--danger);
    border: 1px solid #f0bcb7;
}
.btn-danger:hover { background: #fdf0ef; }

.btn-sm { padding: 6px 14px; font-size: .8rem; }
.btn-full { width: 100%; }

.btn-icon {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-light);
    font-size: .9rem;
    padding: 4px 6px;
    border-radius: 4px;
    transition: all .15s;
    flex-shrink: 0;
}
.btn-icon:hover { color: var(--danger); background: #fdf0ef; }

/* ============================
   Alerts
   ============================ */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: .875rem;
    margin-bottom: 20px;
    line-height: 1.5;
}

.alert-error { background: #fdf0ef; border: 1px solid #f0bcb7; color: var(--danger); }
.alert-success { background: var(--accent-light); border: 1px solid #c8e6d8; color: var(--accent); }

/* ============================
   Responsive
   ============================ */
@media (max-width: 700px) {
    .stats-bar { gap: 0; }
    .stat-item { padding: 12px 16px; }
    .stat-num { font-size: 1.3rem; }

    .books-grid { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 14px; }

    .form-grid { grid-template-columns: 1fr; }

    .book-detail { flex-direction: column; gap: 20px; }
    .book-detail-cover img { width: 140px; height: 210px; }
    .cover-placeholder.large { width: 140px; height: 210px; }

    .filter-row { flex-direction: column; align-items: flex-start; }
    .filter-row-label { min-width: unset; }
    .filter-months { margin-right: 0; }

    .header-nav { gap: 12px; }

    .detail-title { font-size: 1.25rem; }
}

@media (max-width: 480px) {
    .header-inner { padding: 0 14px; }
    .main-content { padding: 18px 14px 40px; }
    .login-wrap { padding: 28px 20px; margin: 16px; }
}
