/* Internet Archive / Premium Book Style */
:root {
    --bg-color: #fdfaf6;
    /* Warm paper-like background */
    --text-color: #2c2929;
    --primary-color: #d72b2b;
    /* A nice "book cover" red/orange */
    --secondary-color: #3b3b3b;
    --accent-color: #e0dcd3;
    --card-bg: #ffffff;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.05);
    --font-serif: 'Georgia', 'Times New Roman', serif;
    --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: var(--font-sans);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
h4,
.serif {
    font-family: var(--font-serif);
    font-weight: 700;
}

a {
    color: inherit;
    text-decoration: none;
    transition: color 0.2s;
}

a:hover {
    color: var(--primary-color);
}

.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header */
header {
    padding: 40px 0;
    border-bottom: 1px solid var(--accent-color);
    margin-bottom: 40px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.5rem;
    font-weight: bold;
    font-family: var(--font-serif);
    color: var(--text-color);
}

.user-badge {
    font-size: 0.9rem;
    background: var(--accent-color);
    padding: 4px 10px;
    border-radius: 4px;
}

/* Typography */
h1 {
    font-size: 2.5rem;
    margin-bottom: 20px;
    line-height: 1.2;
}

p.lead {
    font-size: 1.2rem;
    color: #555;
    margin-bottom: 30px;
    max-width: 600px;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 10px 20px;
    border-radius: 6px;
    font-weight: 500;
    cursor: pointer;
    border: none;
    font-size: 1rem;
    transition: all 0.2s ease;
}

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

.btn-primary:hover {
    opacity: 0.9;
    transform: translateY(-1px);
    color: white;
}

.btn-outline {
    border: 1px solid #ccc;
    background: transparent;
}

.btn-outline:hover {
    border-color: var(--text-color);
}

/* Forms */
.form-group {
    margin-bottom: 15px;
}

label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    font-size: 0.9rem;
}

input[type="text"],
input[type="password"],
textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 1rem;
    font-family: inherit;
    background: var(--card-bg);
}

input:focus,
textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(215, 43, 43, 0.1);
}

/* Cards */
.card {
    background: var(--card-bg);
    padding: 24px;
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
    margin-bottom: 20px;
    border: 1px solid rgba(0, 0, 0, 0.03);
    transition: box-shadow 0.2s;
}

.card:hover {
    box-shadow: var(--shadow-md);
}

.prompt-tags {
    margin-top: 10px;
}

.tag {
    display: inline-block;
    background: var(--accent-color);
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
    margin-right: 5px;
    color: #444;
}

/* Book List */
.submission-list {
    margin-top: 40px;
}

.submission-item {
    display: flex;
    gap: 20px;
    margin-bottom: 30px;
    padding-bottom: 30px;
    border-bottom: 1px solid var(--accent-color);
}

.book-cover {
    width: 100px;
    height: 150px;
    background: #e0e0e0;
    border-radius: 4px;
    flex-shrink: 0;
    object-fit: cover;
    box-shadow: var(--shadow-md);
}

.book-details {
    flex-grow: 1;
}

.book-title {
    font-size: 1.4rem;
    font-family: var(--font-serif);
    margin-bottom: 5px;
}

.book-author {
    color: #666;
    margin-bottom: 10px;
}

.vote-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    min-width: 50px;
}

.vote-count {
    font-weight: bold;
    font-size: 1.2rem;
}

.vote-btn {
    background: none;
    border: 1px solid #ddd;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #888;
}

.vote-btn:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.voted {
    background: var(--primary-color);
    color: white !important;
    border-color: var(--primary-color);
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
    z-index: 100;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.modal {
    background: white;
    padding: 30px;
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    box-shadow: var(--shadow-lg);
    max-height: 90vh;
    overflow-y: auto;
}

.search-results {
    margin-top: 15px;
    border: 1px solid #eee;
    display: none;
}

.search-results-overlay {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    z-index: 1000;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    border-radius: 0 0 8px 8px;
    margin-top: 5px;
}

/* Favorite Button */
.favorite-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    background: transparent !important;
    border: none !important;
    outline: none !important;
    padding: 0;
    margin: 0;
    appearance: none;
    -webkit-appearance: none;
    font-size: 24px;
    color: #ccc;
    cursor: pointer;
    transition: color 0.2s, transform 0.1s;
    z-index: 10;
    line-height: 1;
    box-shadow: none !important;
}

.favorite-btn:hover {
    transform: scale(1.1);
    color: #aaa;
}

.favorite-btn.active {
    color: #e0245e;
    /* Heart Red */
}

.favorite-btn.active:hover {
    color: #c0144e;
}

.search-results.active {
    display: block;
}

.search-result-item {
    padding: 10px;
    border-bottom: 1px solid #eee;
    cursor: pointer;
    display: flex;
    gap: 10px;
}

.search-result-item:hover {
    background: #f9f9f9;
}

.search-result-cover {
    width: 30px;
    height: 45px;
    background: #ccc;
    object-fit: cover;
}

/* Rank Badges */
.rank-badge {
    position: absolute;
    bottom: -5px;
    right: -5px;
    background: #333;
    color: white;
    font-size: 0.75rem;
    font-weight: bold;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    z-index: 2;
}

.rank-badge.gold {
    background: #FFD700;
    color: #333;
}

.rank-badge.silver {
    background: #C0C0C0;
    color: #333;
}

.rank-badge.bronze {
    background: #CD7F32;
    color: #333;
}

.rank-badge.honorary {
    background: #555;
    color: white;
}

/* Layout Utilities */
.flex-center {
    display: flex;
    align-items: center;
    gap: 10px;
}

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

.u-margin-b-0 {
    margin-bottom: 0 !important;
}

.u-margin-b-5 {
    margin-bottom: 5px !important;
}

.u-margin-b-10 {
    margin-bottom: 10px !important;
}

.u-margin-b-15 {
    margin-bottom: 15px !important;
}

.u-margin-b-20 {
    margin-bottom: 20px !important;
}

.u-margin-b-30 {
    margin-bottom: 30px !important;
}

.u-margin-b-40 {
    margin-bottom: 40px !important;
}

.u-margin-b-50 {
    margin-bottom: 50px !important;
}

.u-margin-t-20 {
    margin-top: 20px !important;
}

.u-margin-t-40 {
    margin-top: 40px !important;
}

/* Hero */
.hero {
    text-align: center;
    margin-bottom: 50px;
    margin-top: 40px;
}

.hero h1 {
    margin-bottom: 10px;
}

.hero .lead {
    margin: 0 auto 30px auto;
    font-size: 1.1rem;
    color: #666;
}

/* Prompt Cards */
.card-relative {
    position: relative;
}

.prompt-title {
    font-size: 1.5rem;
    margin-bottom: 10px;
    margin-right: 30px;
}

.prompt-description {
    color: #666;
    margin-bottom: 15px;
}

.prompt-meta-row {
    font-size: 0.9rem;
    color: #888;
    display: flex;
    gap: 10px;
    align-items: center;
    border-top: 1px solid #f0f0f0;
    padding-top: 15px;
    margin-top: 10px;
    flex-wrap: wrap;
}

.creator-info {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-shrink: 0;
    flex-wrap: nowrap;
}

.creator-info span {
    display: flex;
    align-items: center;
    gap: 5px;
}

.creator-name {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
    display: inline-block;
    max-width: 15ch; 
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.prompt-tags-container {
    display: flex;
    flex: 1;
    gap: 5px;
    flex-wrap: nowrap; 
    align-items: center;
    min-width: 40%;
    overflow-x: auto;
    position: relative;
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 0, 0, 0.35) transparent;
}

.prompt-tags-container a{
    flex-shrink: 0;
}

.stats-group {
    display: flex;
    gap: 10px;
    flex-shrink: 0;
    flex-wrap: wrap;
    white-space: nowrap;
}

/* Book Previews */
.book-preview-row {
    display: flex;
    gap: 15px;
    margin: 20px 0;
    overflow-x: auto;
    padding-bottom: 10px;
}

.book-preview-item {
    position: relative;
    width: 80px;
    flex-shrink: 0;
}

.book-preview-cover {
    width: 100%;
    height: 120px;
    object-fit: cover;
    border-radius: 4px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.book-preview-no-cover {
    width: 100%;
    height: 120px;
    background: #eee;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    text-align: center;
    color: #999;
}

/* Header Search */
.header-search {
    flex-grow: 1;
    margin: 0 40px;
    position: relative;
}

.header-search-input {
    width: 100%;
    padding: 8px 15px;
    border-radius: 20px;
    border: 1px solid #ddd;
    background: #f9f9f9;
    font-size: 0.9rem;
}

.header-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    margin: 10px 0;
}

.header-logo img {
    height: 40px;
    width: auto;
}

/* Icons/Buttons */
.btn-delete-icon {
    position: absolute;
    top: 20px;
    right: 60px;
    background: none;
    border: none;
    font-size: 1.2rem;
    color: #999;
    cursor: pointer;
    line-height: 1;
}

.btn-delete-icon:hover {
    color: var(--primary-color);
}

.separator {
    margin: 0 5px;
    color: #ccc;
}

.u-display-inline {
    display: inline !important;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
}

/* Tabs */
.tabs {
    display: flex;
    gap: 20px;
    border-bottom: 1px solid #eee;
    margin-bottom: 30px;
}

.tab-btn {
    background: none;
    border: none;
    padding: 10px 0;
    font-size: 1.1rem;
    cursor: pointer;
    color: #888;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
    font-weight: 500;
}

.tab-btn:hover {
    color: var(--text-color);
}

.tab-btn.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

/* User Profile */
.profile-header {
    background: white;
    padding: 40px;
    border-radius: 12px;
    margin-bottom: 40px;
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    gap: 20px;
}

.profile-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
}

/* Voters List */
.voters-modal-content {
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    width: 400px;
}

.voter-row {
    padding: 12px 10px;
    border-bottom: 1px solid #f9f9f9;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.login-card {
    max-width: 400px;
    margin: 50px auto;
    padding: 30px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

.alert-error {
    background: #fee;
    color: #c00;
    padding: 10px;
    border-radius: 4px;
    margin-bottom: 20px;
    text-align: center;
}

.u-width-full {
    width: 100% !important;
}

.u-text-center {
    text-align: center !important;
}
