@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,400;9..144,600;9..144,700&family=Inter:wght@400;500;600&display=swap');

:root {
    --paper: #FAF7F0;
    --ink: #1F2A24;
    --mustard: #D9A441;
    --teal: #2F6F63;
    --line: #E4DCC8;
    --card-bg: #FFFFFF;
    --error: #B3432B;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--paper);
    color: var(--ink);
    font-family: 'Inter', system-ui, sans-serif;
    line-height: 1.5;
}

h1, h2 {
    font-family: 'Fraunces', serif;
    font-weight: 600;
    margin: 0;
}

.wrap {
    max-width: 1080px;
    margin: 0 auto;
    padding: 48px 24px 80px;
}

.site-header {
    margin-bottom: 32px;
    border-bottom: 2px solid var(--line);
    padding-bottom: 24px;
}

.site-header h1 {
    font-size: clamp(28px, 4vw, 42px);
}

.subtitle {
    margin-top: 8px;
    color: #5A6459;
    font-size: 16px;
}

/* Filtre bar */
.filter-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: end;
    gap: 20px;
    background: var(--card-bg);
    border: 1px solid var(--line);
    padding: 20px;
    margin-bottom: 32px;
}

.filter-bar label {
    display: flex;
    flex-direction: column;
    font-size: 13px;
    color: #5A6459;
    gap: 6px;
}

select, input[type="text"], input[type="number"], input[type="password"], textarea {
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 15px;
    padding: 9px 10px;
    border: 1px solid #C9C0A5;
    background: #fff;
    color: var(--ink);
}

select:focus, input:focus, textarea:focus {
    outline: 2px solid var(--teal);
    outline-offset: 1px;
}

.btn {
    display: inline-block;
    background: var(--teal);
    color: #fff;
    border: none;
    padding: 10px 20px;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
}
.btn:hover { background: #245A50; }

.btn-ghost {
    display: inline-block;
    padding: 10px 16px;
    color: var(--ink);
    text-decoration: none;
    border: 1px solid var(--line);
}
.btn-ghost:hover { background: #F0EBDC; }

.clear-link {
    align-self: center;
    color: var(--error);
    font-size: 14px;
    text-decoration: none;
}
.clear-link:hover { text-decoration: underline; }

/* Kitap grid */
.book-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 24px;
}

.book-card {
    background: var(--card-bg);
    border: 1px solid var(--line);
    display: flex;
    flex-direction: column;
    text-decoration: none;
    color: inherit;
    transition: border-color .15s ease, transform .15s ease;
}
.book-card:hover {
    border-color: var(--teal);
    transform: translateY(-2px);
}
.book-card:hover h2 {
    color: var(--teal);
}

.cover {
    aspect-ratio: 3 / 4;
    background: #F0EBDC;
    overflow: hidden;
}

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

.cover-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Fraunces', serif;
    font-size: 56px;
    color: var(--mustard);
    background: #F0EBDC;
}

.card-body {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.card-body h2 {
    font-size: 19px;
}

.author {
    margin: 0;
    font-size: 14px;
    color: #5A6459;
}

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

.tag {
    font-size: 12px;
    padding: 3px 9px;
    background: #F0EBDC;
    color: var(--ink);
    border: 1px solid var(--line);
}

.desc {
    font-size: 14px;
    color: #3C453E;
    margin: 4px 0 0;
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.empty-state {
    padding: 40px;
    text-align: center;
    color: #5A6459;
    border: 1px dashed var(--line);
}

/* Kitap detay sayfası */
.back-link {
    display: inline-block;
    margin-bottom: 24px;
    color: var(--teal);
    text-decoration: none;
    font-size: 14px;
}
.back-link:hover { text-decoration: underline; }

.book-detail {
    display: grid;
    grid-template-columns: 260px 1fr;
    gap: 36px;
    background: var(--card-bg);
    border: 1px solid var(--line);
    padding: 32px;
}

.detail-cover {
    aspect-ratio: 3 / 4;
    background: #F0EBDC;
    overflow: hidden;
}
.detail-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }

.detail-body h1 {
    font-size: clamp(24px, 3vw, 34px);
    margin-bottom: 8px;
}

.detail-heading {
    font-size: 18px;
    margin-top: 28px;
    margin-bottom: 10px;
}

.detail-desc {
    font-size: 16px;
    color: #3C453E;
}

@media (max-width: 640px) {
    .book-detail { grid-template-columns: 1fr; }
    .detail-cover { max-width: 220px; }
}

/* Ayarlar sayfası */
.settings-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 28px;
}

.settings-panel h2 {
    font-size: 18px;
    margin-bottom: 14px;
}

.add-inline-form {
    display: flex;
    gap: 10px;
    margin-top: 14px;
}
.add-inline-form input { flex: 1; }

.inline-edit-form {
    display: flex;
    gap: 8px;
    align-items: center;
}
.inline-edit-form input { flex: 1; }

.inline-delete {
    display: inline;
}

.link-btn {
    background: none;
    border: none;
    padding: 0;
    font: inherit;
    cursor: pointer;
}

.btn-sm, .btn-ghost-sm {
    font-size: 13px;
    padding: 6px 12px;
    text-decoration: none;
}
.btn-sm {
    background: var(--teal);
    color: #fff;
    border: none;
    cursor: pointer;
}
.btn-ghost-sm {
    border: 1px solid var(--line);
    color: var(--ink);
}

@media (max-width: 720px) {
    .settings-grid { grid-template-columns: 1fr; }
}

/* Admin */
.admin-body {
    background: var(--paper);
}

.admin-wrap {
    max-width: 960px;
    margin: 0 auto;
    padding: 40px 24px 80px;
}

.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    border-bottom: 2px solid var(--line);
    padding-bottom: 20px;
    margin-bottom: 28px;
}

.admin-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.book-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--card-bg);
}

.book-table th, .book-table td {
    padding: 12px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    font-size: 14px;
    vertical-align: middle;
}

.book-table th {
    font-size: 12px;
    color: #5A6459;
    font-weight: 600;
}

.thumb {
    width: 44px;
    height: 58px;
    object-fit: cover;
    display: block;
}

.thumb-placeholder {
    font-size: 11px;
    color: #9A9484;
}

.row-actions a {
    margin-right: 12px;
    color: var(--teal);
    text-decoration: none;
    font-size: 14px;
}
.row-actions .delete-link {
    color: var(--error);
}
.row-actions a:hover { text-decoration: underline; }

.book-form {
    display: flex;
    flex-direction: column;
    gap: 18px;
    background: var(--card-bg);
    border: 1px solid var(--line);
    padding: 24px;
    max-width: 640px;
}

.book-form label {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 14px;
    color: #5A6459;
}

.form-row {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}
.form-row label { flex: 1; min-width: 160px; }

.hint {
    color: #9A9484;
    font-size: 12px;
}

/* Login */
.login-box {
    max-width: 380px;
    margin: 100px auto;
    background: var(--card-bg);
    border: 1px solid var(--line);
    padding: 32px;
    text-align: center;
}

.login-box h1 {
    font-size: 24px;
    margin-bottom: 20px;
}

.login-box form {
    display: flex;
    flex-direction: column;
    gap: 14px;
    text-align: left;
}

.login-box label {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 14px;
    color: #5A6459;
}

.back-link {
    display: inline-block;
    margin-top: 18px;
    font-size: 14px;
    color: var(--teal);
    text-decoration: none;
}

.error, .error-list li {
    color: var(--error);
    font-size: 14px;
}

.error-list {
    margin: 0 0 16px;
    padding-left: 18px;
}

.success {
    color: var(--teal);
    font-size: 14px;
}
