/* ========================================================================
   Tome-raider Design System
   Palette inspired by GuardedGoods.com — cream, sage, warm neutrals
   Typography: Inter (body) + DM Serif Display (headings)
   ======================================================================== */

@import url('https://fonts.googleapis.com/css2?family=DM+Serif+Display&family=Inter:wght@400;500;600&display=swap');

:root {
    /* 60/30/10 — cream bg, sage primary, teal accent */
    --bg:          #EDE9DD;
    --bg-card:     #FFFFFF;
    --bg-input:    #F5F2EA;
    --bg-hover:    #E8E3D3;

    --text:        #1a1a1a;
    --text-muted:  #6B6B60;
    --text-dim:    #999990;

    --primary:     #77796C;
    --primary-dark:#5C5E52;
    --accent:      #108474;
    --accent-hover:#0D6B5E;
    --danger:      #AD0000;
    --success:     #2D8659;
    --warning:     #B8860B;
    --star:        #D4A017;

    --border:      #D5D0C4;
    --border-light:#E8E3D3;
    --radius:      8px;
    --radius-lg:   12px;
    --shadow:      0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md:   0 4px 12px rgba(0,0,0,0.08);

    --font-body:   'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-heading:'DM Serif Display', Georgia, serif;
}

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

body {
    font-family: var(--font-body);
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    font-size: 16px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; transition: color 0.15s; }
a:hover { color: var(--accent-hover); }

h1, h2, h3 { font-family: var(--font-heading); font-weight: 400; line-height: 1.15; color: var(--text); }

/* --- Navbar --- */
.navbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
    height: 64px;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow);
}

.nav-brand a {
    font-family: var(--font-heading);
    font-size: 1.35rem;
    color: var(--text);
    letter-spacing: 0.01em;
}

.nav-links { display: flex; gap: 4px; align-items: center; }
.nav-links a {
    padding: 8px 16px;
    border-radius: var(--radius);
    color: var(--text-muted);
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.15s;
}
.nav-links a:hover { background: var(--bg-hover); color: var(--text); }
.nav-links a.active { background: var(--primary); color: #fff; }
.nav-logout { opacity: 0.5; font-size: 0.8rem !important; }
.nav-logout:hover { opacity: 1; }

/* --- Container --- */
.container { max-width: 1040px; margin: 0 auto; padding: 32px 24px; }

/* --- Flash messages --- */
.flash {
    padding: 12px 16px;
    border-radius: var(--radius);
    margin-bottom: 16px;
    font-size: 0.875rem;
    border-left: 4px solid;
}
.flash-danger { background: #FEF2F2; color: var(--danger); border-color: var(--danger); }
.flash-info { background: #F0F9F6; color: var(--accent); border-color: var(--accent); }
.flash-success { background: #F0FDF4; color: var(--success); border-color: var(--success); }

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

.login-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 48px 40px;
    width: 100%;
    max-width: 400px;
    box-shadow: var(--shadow-md);
    text-align: center;
}

.login-card h1 { font-size: 2rem; margin-bottom: 4px; }
.login-subtitle { color: var(--text-muted); margin-bottom: 32px; font-size: 0.9rem; }

.form-group { margin-bottom: 20px; text-align: left; }
.form-group label {
    display: block;
    margin-bottom: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.form-group input, .form-group select {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-family: var(--font-body);
    font-size: 0.95rem;
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.form-group input:focus, .form-group select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(16, 132, 116, 0.1);
}

/* --- Buttons --- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 22px;
    border: none;
    border-radius: var(--radius);
    font-family: var(--font-body);
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
    min-height: 44px;
    min-width: 44px;
}
.btn:active { transform: scale(0.98); }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #24714A; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #8B0000; }
.btn-sm { padding: 6px 14px; font-size: 0.8rem; min-height: 36px; }
.btn-full { width: 100%; }
.btn-outline {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-muted);
}
.btn-outline:hover { border-color: var(--accent); color: var(--accent); }

/* --- Search page --- */
.search-header { margin-bottom: 32px; }
.search-header h1 { font-size: 2.25rem; margin-bottom: 6px; }
.search-header p { color: var(--text-muted); font-size: 0.95rem; max-width: 500px; }

.search-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: stretch;
    margin-bottom: 24px;
}

.search-bar input[type="text"] {
    flex: 1;
    min-width: 240px;
    padding: 14px 20px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-family: var(--font-body);
    font-size: 1rem;
    outline: none;
    box-shadow: var(--shadow);
}
.search-bar input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(16,132,116,0.1); }

.search-filters { display: flex; gap: 8px; }
.search-filters select {
    padding: 12px 14px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-family: var(--font-body);
    font-size: 0.875rem;
    outline: none;
    cursor: pointer;
    box-shadow: var(--shadow);
}

/* --- Status --- */
.search-status {
    text-align: center;
    padding: 12px 0;
    color: var(--text-muted);
    font-size: 0.875rem;
    font-weight: 500;
}
.search-status.loading::after {
    content: '';
    display: inline-block;
    width: 14px; height: 14px;
    border: 2px solid var(--accent);
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    margin-left: 8px;
    vertical-align: middle;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* --- Results grid --- */
.results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 16px;
}

.result-card {
    display: flex;
    flex-direction: column;
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: 16px;
    transition: all 0.2s;
    box-shadow: var(--shadow);
}
.result-card:hover { border-color: var(--accent); box-shadow: var(--shadow-md); transform: translateY(-1px); }

.result-cover {
    width: 72px;
    min-width: 72px;
    height: 108px;
    border-radius: 4px;
    object-fit: cover;
    background: var(--bg-hover);
}
.result-cover-placeholder {
    width: 72px;
    min-width: 72px;
    height: 108px;
    border-radius: 4px;
    background: var(--bg-hover);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-dim);
    font-size: 0.65rem;
}

.result-info { flex: 1; min-width: 0; }

.result-title {
    font-family: var(--font-heading);
    font-size: 1.05rem;
    line-height: 1.25;
    margin-bottom: 2px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.result-author {
    color: var(--text-muted);
    font-size: 0.8rem;
    margin-bottom: 6px;
}

.result-rating {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-bottom: 8px;
    font-size: 0.75rem;
    color: var(--text-muted);
}
.result-stars { color: var(--star); font-size: 0.8rem; letter-spacing: -1px; }
.rating-source { opacity: 0.6; font-size: 0.65rem; }

.result-meta { display: flex; flex-wrap: wrap; gap: 4px; }
.result-tag {
    display: inline-block;
    padding: 2px 8px;
    background: var(--bg-input);
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 500;
    color: var(--text-muted);
}
.result-tag.format { color: var(--accent); background: rgba(16,132,116,0.08); }
.result-tag.source { color: var(--warning); background: rgba(184,134,11,0.08); }
.result-tag.audiobook { color: var(--success); background: rgba(45,134,89,0.08); }
.result-tag.downloaded { color: var(--success); background: rgba(45,134,89,0.1); font-weight: 600; }

/* --- Modal --- */
.modal { position: fixed; inset: 0; z-index: 200; display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal.hidden { display: none; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,0.3); backdrop-filter: blur(2px); }
.modal-content {
    position: relative;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 32px;
    max-width: 560px;
    width: 100%;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: var(--shadow-md);
}
.modal-close {
    position: absolute;
    top: 16px;
    right: 20px;
    background: none;
    border: none;
    color: var(--text-dim);
    font-size: 1.5rem;
    cursor: pointer;
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.modal-close:hover { color: var(--text); }

.modal-header { display: flex; gap: 20px; margin-bottom: 20px; }
.modal-cover { width: 100px; height: 150px; border-radius: 6px; object-fit: cover; background: var(--bg-hover); flex-shrink: 0; }
.modal-cover-placeholder { width: 100px; height: 150px; border-radius: 6px; background: var(--bg-hover); flex-shrink: 0; display: flex; align-items: center; justify-content: center; color: var(--text-dim); font-size: 0.7rem; }
.modal-header-info { flex: 1; }
.modal-title { font-family: var(--font-heading); font-size: 1.4rem; margin-bottom: 4px; padding-right: 32px; }
.modal-author { color: var(--text-muted); margin-bottom: 8px; font-size: 0.9rem; }
.modal-rating { display: flex; align-items: center; gap: 6px; font-size: 0.85rem; color: var(--text-muted); margin-bottom: 8px; }
.modal-rating .result-stars { font-size: 0.9rem; }
.modal-meta { display: flex; flex-wrap: wrap; gap: 6px; }
.modal-description { font-size: 0.85rem; color: var(--text-muted); line-height: 1.6; margin-bottom: 16px; padding-bottom: 16px; border-bottom: 1px solid var(--border-light); }
.modal-subjects { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 16px; }
.modal-subjects .result-tag { background: var(--bg); font-size: 0.7rem; }

.modal-section { margin-bottom: 20px; }
.modal-section h3 {
    font-family: var(--font-body);
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 10px;
}

.download-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    background: var(--bg-input);
    border-radius: var(--radius);
    margin-bottom: 6px;
    font-size: 0.85rem;
    transition: background 0.15s;
}
.download-link:hover { background: var(--bg-hover); }
.download-link-label { color: var(--text); flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.download-link-actions { display: flex; gap: 6px; margin-left: 8px; flex-shrink: 0; }

.kindle-section {
    background: rgba(16,132,116,0.04);
    border: 1px solid rgba(16,132,116,0.15);
    border-radius: var(--radius-lg);
    padding: 20px;
}
.kindle-section p { font-size: 0.85rem; color: var(--text-muted); margin-bottom: 12px; }
.kindle-email { font-family: monospace; color: var(--accent); font-weight: 600; }

.status-msg { padding: 10px 12px; border-radius: var(--radius); font-size: 0.85rem; margin-top: 10px; }
.status-msg.success { background: #F0FDF4; color: var(--success); }
.status-msg.error { background: #FEF2F2; color: var(--danger); }
.status-msg.loading { color: var(--text-muted); }

/* --- Download History --- */
.history-page { max-width: 960px; margin: 0 auto; }

.history-table-wrap {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow);
}

.history-table {
    width: 100%;
    border-collapse: collapse;
}
.history-table thead {
    background: var(--bg-input);
}
.history-table th {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    text-align: left;
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
.history-table td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--border-light);
    font-size: 0.85rem;
    vertical-align: middle;
}
.history-table tbody tr:last-child td { border-bottom: none; }
.history-table tbody tr:hover { background: var(--bg-hover); }

.history-title {
    font-weight: 600;
    max-width: 260px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.history-author {
    color: var(--text-muted);
    max-width: 160px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.history-size { white-space: nowrap; color: var(--text-muted); font-size: 0.8rem; }
.history-date { white-space: nowrap; color: var(--text-muted); font-size: 0.8rem; }

.history-status {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
    white-space: nowrap;
}
.history-status-sent { background: rgba(45,134,89,0.1); color: var(--success); }
.history-status-local { background: var(--bg-input); color: var(--text-muted); }

.result-tag.method-rd { background: rgba(16,132,116,0.1); color: var(--accent); }
.result-tag.method-direct { background: var(--bg-input); color: var(--text-muted); }

.history-file { max-width: 200px; }
.file-path {
    font-family: monospace;
    font-size: 0.7rem;
    color: var(--text-muted);
    display: inline-block;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    cursor: default;
}

/* --- Goodreads --- */
.goodreads-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 20px;
}

.goodreads-card {
    display: flex;
    flex-direction: column;
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: all 0.2s;
    text-decoration: none;
    color: var(--text);
    box-shadow: var(--shadow);
}
.goodreads-card:hover { border-color: var(--accent); box-shadow: var(--shadow-md); transform: translateY(-2px); }

.goodreads-cover {
    width: 100%;
    height: 240px;
    object-fit: cover;
    background: var(--bg-hover);
}
.goodreads-cover-placeholder {
    width: 100%;
    height: 240px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-hover);
    color: var(--text-dim);
    font-size: 0.75rem;
}

.goodreads-info { padding: 14px; }
.goodreads-info h3 {
    font-family: var(--font-heading);
    font-size: 0.95rem;
    line-height: 1.25;
    margin-bottom: 4px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.goodreads-author { font-size: 0.75rem; color: var(--text-muted); margin-bottom: 6px; }
.goodreads-rating { font-size: 0.7rem; color: var(--text-muted); display: flex; align-items: center; gap: 4px; }
.goodreads-rating .result-stars { font-size: 0.75rem; }

.empty-state { text-align: center; padding: 64px 16px; color: var(--text-muted); }
.empty-state p { margin-bottom: 8px; line-height: 1.6; }

/* --- Settings --- */
.settings-page { max-width: 720px; margin: 0 auto; }

.settings-section {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: 28px;
    margin-bottom: 24px;
    box-shadow: var(--shadow);
}

.settings-section h2 {
    font-size: 1.3rem;
    margin-bottom: 4px;
}
.settings-section-desc {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-bottom: 12px;
}

.settings-help {
    background: var(--bg-input);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    padding: 12px 16px;
    margin-bottom: 20px;
    font-size: 0.8rem;
    color: var(--text-muted);
    line-height: 1.6;
}
.settings-help strong { color: var(--text); }
.settings-help ol {
    margin: 6px 0 0 16px;
    padding: 0;
}
.settings-help ol li { margin-bottom: 4px; }
.settings-help a { color: var(--accent); text-decoration: underline; }
.settings-help code {
    background: var(--bg-hover);
    padding: 1px 5px;
    border-radius: 3px;
    font-size: 0.75rem;
}

.form-hint {
    display: block;
    font-size: 0.7rem;
    color: var(--text-dim);
    margin-top: 4px;
}
.form-hint a { color: var(--accent); text-decoration: underline; }

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

.settings-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--border-light);
}

/* Users table */
.users-table { width: 100%; border-collapse: collapse; }
.users-table th {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    text-align: left;
    padding: 8px 12px;
    border-bottom: 1px solid var(--border);
}
.users-table td {
    padding: 12px;
    border-bottom: 1px solid var(--border-light);
    font-size: 0.875rem;
}
.users-table tr:last-child td { border-bottom: none; }
.user-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
}
.user-badge.admin { background: rgba(16,132,116,0.1); color: var(--accent); }
.user-badge.user { background: var(--bg-input); color: var(--text-muted); }

/* New user form */
.new-user-form {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr auto;
    gap: 8px;
    align-items: end;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border-light);
}
.new-user-form .form-group { margin-bottom: 0; }

/* --- Result card layout for inline Kindle button --- */
.result-card-main {
    display: flex;
    gap: 16px;
    cursor: pointer;
    flex: 1;
}

/* --- Inline Kindle button on search cards --- */
.btn-kindle-inline {
    display: block;
    width: 100%;
    margin-top: 8px;
    padding: 7px 12px;
    background: rgba(16,132,116,0.06);
    color: var(--accent);
    border: 1px solid rgba(16,132,116,0.18);
    border-radius: var(--radius);
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}
.btn-kindle-inline:hover { background: rgba(16,132,116,0.14); }
.btn-kindle-inline:disabled { opacity: 0.7; cursor: default; }
.btn-kindle-inline.loading { color: var(--text-muted); border-color: var(--border); background: var(--bg-input); }
.btn-kindle-inline.success { color: var(--success); border-color: rgba(45,134,89,0.3); background: rgba(45,134,89,0.06); }
.btn-kindle-inline.error { color: var(--danger); border-color: rgba(220,38,38,0.3); background: rgba(220,38,38,0.06); }

/* --- Goodreads card with actions --- */
.goodreads-card-link {
    display: block;
    text-decoration: none;
    color: var(--text);
    flex: 1;
}
.goodreads-card-actions {
    padding: 0 14px 14px;
}
.btn-kindle-card {
    display: block;
    width: 100%;
    padding: 8px 12px;
    background: rgba(16,132,116,0.06);
    color: var(--accent);
    border: 1px solid rgba(16,132,116,0.18);
    border-radius: var(--radius);
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}
.btn-kindle-card:hover { background: rgba(16,132,116,0.14); }
.btn-kindle-card:disabled { opacity: 0.7; cursor: default; }
.btn-kindle-card.loading { color: var(--text-muted); border-color: var(--border); }
.btn-kindle-card.success { color: var(--success); border-color: rgba(45,134,89,0.3); background: rgba(45,134,89,0.06); }
.btn-kindle-card.error { color: var(--danger); border-color: rgba(220,38,38,0.3); background: rgba(220,38,38,0.06); font-size: 0.7rem; }

.goodreads-status.done {
    display: block;
    text-align: center;
    color: var(--success);
    font-size: 0.75rem;
    font-weight: 600;
    padding: 6px 0;
}

.goodreads-actions {
    margin-top: 12px;
}

/* --- Kindle Queue Panel --- */
.kindle-queue {
    position: fixed;
    bottom: 0;
    right: 24px;
    width: 360px;
    min-height: 120px;
    max-height: 60vh;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-bottom: none;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    box-shadow: var(--shadow-md);
    z-index: 300;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
.kindle-queue.hidden { display: none; }

.kindle-queue-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-light);
    flex-shrink: 0;
}
.kindle-queue-header h3 {
    font-size: 0.9rem;
    font-weight: 600;
    margin: 0;
}
.kindle-queue-close {
    background: none;
    border: none;
    color: var(--text-dim);
    font-size: 1.1rem;
    cursor: pointer;
    padding: 4px;
    min-width: 32px;
    min-height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.kindle-queue-close:hover { color: var(--text); }

#kindle-queue-items {
    overflow-y: auto;
    flex: 1 1 auto;
    padding: 8px 0;
    min-height: 60px;
}

.kindle-queue-loading {
    text-align: center;
    padding: 16px;
    color: var(--text-muted);
    font-size: 0.8rem;
}

.kindle-queue-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 16px;
    border-bottom: 1px solid var(--border-light);
}
.kindle-queue-item:last-child { border-bottom: none; }

.kindle-queue-icon {
    font-size: 0.65rem;
    font-weight: 700;
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--bg-input);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 2px;
    text-transform: uppercase;
}
.kindle-queue-info { flex: 1; min-width: 0; }
.kindle-queue-title {
    font-size: 0.8rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.kindle-queue-summary {
    text-align: center;
    font-size: 0.7rem;
    color: var(--text-muted);
    padding: 6px 16px;
    border-bottom: 1px solid var(--border-light);
    font-weight: 600;
}
.kindle-queue-status {
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 2px;
}
.kindle-queue-detail {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-top: 2px;
}
.status-searching { color: var(--warning); }
.status-downloading { color: var(--accent); }
.status-sending { color: var(--accent); }
.status-done { color: var(--success); }
.status-failed { color: var(--danger); }
.kindle-queue-icon.status-searching { background: rgba(184,134,11,0.12); }
.kindle-queue-icon.status-downloading { background: rgba(16,132,116,0.12); }
.kindle-queue-icon.status-sending { background: rgba(16,132,116,0.12); }
.kindle-queue-icon.status-done { background: rgba(45,134,89,0.12); }
.kindle-queue-icon.status-failed { background: rgba(173,0,0,0.1); }

.hidden { display: none !important; }

/* --- Responsive --- */
@media (max-width: 640px) {
    .navbar { padding: 0 16px; height: 56px; }
    .nav-brand a { font-size: 1.15rem; }
    .nav-links a { padding: 6px 10px; font-size: 0.8rem; }
    .container { padding: 20px 16px; }
    .search-header h1 { font-size: 1.75rem; }
    .search-bar { flex-direction: column; }
    .search-bar input[type="text"] { min-width: 0; width: 100%; }
    .search-filters { width: 100%; }
    .search-filters select { flex: 1; }
    .results-grid { grid-template-columns: 1fr; }
    .result-card { gap: 12px; }
    .goodreads-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
    .modal-content { padding: 24px 20px; }
    .modal-header { flex-direction: column; align-items: center; text-align: center; }
    .settings-row { grid-template-columns: 1fr; }
    .new-user-form { grid-template-columns: 1fr; }
    .history-table-wrap { overflow-x: auto; }
    .history-table { min-width: 600px; }
    .kindle-queue { width: calc(100% - 32px); right: 16px; }
}
