/* CSS Custom Properties for Goodreads Theme */
:root {
    --primary-brown: #382110;
    --secondary-teal: #00635d;
    --accent-gold: #d4af37;
    --text-primary: #181818;
    --text-secondary: #767676;
    --text-light: #999999;
    --text-link: #00635d;
    --bg-primary: #ffffff;
    --bg-secondary: #f9f7f4;
    --bg-tertiary: #f4f1e8;
    --bg-beige: #f6f4e8;
    --border-color: #ddd6cc;
    --border-light: #e8e8e8;
    --hover-color: #f5f5f5;
    --star-color: #ffa500;
    --star-empty: #cccccc;
    --shadow-light: 0 1px 3px rgba(0,0,0,0.1);
    --shadow-medium: 0 2px 8px rgba(0,0,0,0.15);
    --header-bg: #f4f1e8;
    --promo-bg: #f4ddb8;
}

/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    padding: 1px;
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
    scrollbar-width: none; /* Firefox */
}

body {
    margin: auto;
    font-family: "Lato", "Helvetica Neue", Arial, sans-serif;
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--bg-primary);
    overflow-x: hidden;
    -ms-overflow-style: none;  /* IE and Edge */
}
/* Hide scrollbar for all elements but allow scrolling */
/* For Firefox */
html {
  scrollbar-width: none;
}
/* For IE and Edge */
body {
  -ms-overflow-style: none;
}
/* For Chrome, Safari, and Opera */
::-webkit-scrollbar {
  display: none;
}
/* Promo Banner */
.promo-banner {
    background: var(--promo-bg);
    border-bottom: 1px solid #e6d7b3;
    padding: 8px 1rem;
    text-align: center;
    font-size: 14px;
    color: var(--text-primary);
}

.promo-banner a {
    color: var(--text-primary);
    text-decoration: none;
    font-weight: 500;
}

/* Header Styles */
.header {

    background: var(--header-bg);
    border-bottom: 1px solid var(--border-color);
    padding: 15px 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header__content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
}

.header__left {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.logo {
    font-size: clamp(1.5rem, 4vw, 1.75rem);
    font-weight: normal;
    color: var(--primary-brown);
    text-decoration: none;
    font-family: "Merriweather", serif;
    white-space: nowrap;
}

.nav {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.nav__link {
    color: var(--text-primary);
    text-decoration: none;
    font-size: clamp(0.8rem, 2vw, 1rem);
    font-weight: normal;
    padding: 8px 4px;
    position: relative;
    white-space: nowrap;
}

.nav__link:hover {
    color: var(--text-link);
}

.nav__link.active {
    color: var(--text-link);
    font-weight: 500;
}

.header__right {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.search-container {
    position: relative;
    flex-shrink: 0;
}

.search-bar {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 3px;
    padding: 8px 35px 8px 12px;
    width: clamp(200px, 40vw, 300px);
    font-size: 14px;
    color: var(--text-primary);
}

.search-bar:focus {
    outline: none;
    border-color: var(--text-link);
}

.search-bar::placeholder {
    color: var(--text-light);
}

.search-icon {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-light);
    width: 16px;
    height: 16px;
}

.header__icons {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.header__icon {
    width: 28px;
    height: 28px;
    background: var(--text-light);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 14px;
    cursor: pointer;
    transition: background-color 0.3s ease;
    flex-shrink: 0;
}

.header__icon:hover {
    background: var(--text-secondary);
}

/* Main Content Layout */
.main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 3rem;
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 2rem;
    align-items: start;
}

.content {
    background: var(--bg-primary);
    min-width: 0;
}

.sidebar {
    background: var(--bg-primary);
    min-width: 0;
}

/* Profile Section */
.profile {
    display: grid;
    grid-template-columns: auto 1fr;
    grid-template-areas:
        "avatar info"
        "stats info";
    gap: 1.5rem;
    margin-bottom: 2rem;
    align-items: start;
}

.profile__avatar {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    overflow: hidden;
    border: 1px solid var(--border-color);
    grid-area: avatar;
    flex-shrink: 0;
}

.profile__avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.profile__stats {
    grid-area: stats;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    text-align: center;
    color: var(--text-secondary);
}

.profile__stats a {
    color: inherit;
    text-decoration: none;
    display: block;
}

.profile__stats a:hover {
    text-decoration: underline;
}

.profile__info {
    grid-area: info;
    min-width: 0;
}

.profile__name {
    font-size: clamp(1.2rem, 3vw, 1.5rem);
    color: var(--primary-brown);
    margin-bottom: 1rem;
    word-wrap: break-word;
}

.profile__edit {
    color: rgb(99, 55, 55);
    text-decoration: none;
    font-size: 0.75rem;
    margin-left: 8px;
}

.profile__details {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.profile__row {
    display: grid;
    grid-template-columns: minmax(80px, auto) 1fr;
    gap: 1rem;
    align-items: start;
    border-bottom: 1px solid #ddd;
    padding-bottom: 0.5rem;
}

.profile__label {
    color: var(--text-primary);
    text-align: left;
    font-weight: 500;
    font-size: 0.9rem;
    white-space: nowrap;
}

.profile__value {
    font-size: 0.9rem;
    color: var(--text-secondary);
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.profile__value a {
    color: var(--text-link);
    text-decoration: none;
}

.profile__value a:hover {
    text-decoration: underline;
}

.profile__bio {
    white-space: pre-wrap;
    line-height: 1.5;
}

/* Sections */
.section {
    margin-bottom: 2.5rem;
}

.section__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.25rem;
    border-bottom: 1px solid var(--border-light);
    padding-bottom: 8px;
}

.section__title {
    font-size: clamp(1rem, 2.5vw, 1.25rem);
    font-weight: 600;
    color: var(--primary-brown);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.section__action {
    color: var(--text-light);
    font-size: 13px;
    text-decoration: none;
    cursor: pointer;
    white-space: nowrap;
}

.section__action:hover {
    color: var(--text-link);
}

/* Poems Grid */
.favorites-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

.poem-cover {
    width: 100%;
    aspect-ratio: 2/3;
    display: flex;
    flex-direction: column;
    border-radius: 6px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.3s ease;
    background: linear-gradient(135deg, var(--bg-tertiary), var(--bg-secondary));
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border-color);
    position: relative;
}

.poem-cover:hover {
    transform: scale(1.05);
}

.poem-cover__thumbnail {
    width: 100%;
    height: 100%;
    object-fit: cover;
    position: absolute;
    top: 0;
    left: 0;
}

.poem-cover__title {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0,0,0,0.7);
    color: white;
    font-size: clamp(0.7rem, 1.5vw, 0.75rem);
    padding: 4px;
    text-align: center;
    line-height: 1.2;
}

.poem-cover__category {
    position: absolute;
    top: 0;
    right: 0;
    background: rgba(0,0,0,0.7);
    color: white;
    font-size: 0.6rem;
    padding: 2px 6px;
    border-radius: 0 4px 0 4px;
}

.poems-loadmore {
    text-align: center;
    margin-top: 1rem;
}

#loadMorePoems {
    padding: 8px 16px;
    font-size: 14px;
    background-color: rgb(120, 88, 88);
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

#loadMorePoems:hover {
    background-color: rgb(120, 88, 88);
}

#showLessPoems {
    padding: 8px 16px;
    font-size: 14px;
    background-color: rgb(120, 88, 88);
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

#showLessPoems:hover {
    background-color: rgb(120, 88, 88);
}

/* Quote List Section */
.quote-list {
    display: flex;
    flex-direction: column;
    gap: 1rem; /* Adds space between each quote */
}

.quote-item {
    font-family: "Georgia", serif;
    font-style: italic;
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.6;
    padding-left: 1.5rem;
    border-left: 4px solid var(--border-color);
    background-color: var(--bg-secondary);
    padding: 1rem 1.5rem;
    border-radius: 4px;
}

/* Bookshelves Section */
.bookshelves {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.25rem;
    font-size: 14px;
}

.shelf-column {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.shelf-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    word-wrap: break-word;
}

.shelf-item a {
    color: var(--text-link);
    text-decoration: none;
    flex: 1;
    margin-right: 8px;
}

.shelf-item a:hover {
    text-decoration: underline;
}

.shelf-count {
    color: var(--text-secondary);
    font-size: 13px;
    white-space: nowrap;
}

.shelf-actions-bottom {
    margin-top: 1.25rem;
    font-size: 13px;
}

.shelf-actions-bottom a {
    color: var(--text-link);
    text-decoration: none;
    margin-right: 15px;
}

.shelf-actions-bottom a:hover {
    text-decoration: underline;
}

/* Sidebar Widgets */
.widget {
    background: var(--bg-primary);
    border: 1px solid var(--border-light);
    border-radius: 4px;
    margin-bottom: 1.25rem;
    overflow: hidden;
}

.widget__header {
    background: var(--bg-secondary);
    padding: 12px 15px;
    border-bottom: 1px solid var(--border-light);
    font-size: 14px;
    font-weight: 600;
    color: var(--primary-brown);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.widget__content {
    padding: 15px;
}

/* Year Widget */
.year-widget {
    display: flex;
    gap: 15px;
    align-items: center;
}

.year-widget__image {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #ff9a8b, #fecfef, #fecfef);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: white;
    position: relative;
    overflow: hidden;
    flex-shrink: 0;
}

.year-widget__image::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, transparent 30%, rgba(255,255,255,0.2) 50%, transparent 70%);
}

.year-widget__content {
    flex: 1;
    min-width: 0;
}

.year-widget__title {
    font-size: 14px;
    font-weight: 600;
    color: var(--primary-brown);
    margin-bottom: 4px;
}

.year-widget__description {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.4;
    margin-bottom: 8px;
}

.year-widget__link {
    color: var(--text-link);
    text-decoration: none;
    font-size: 12px;
    word-wrap: break-word;
}

.year-widget__link:hover {
    text-decoration: underline;
}

/* Friends Widget */
.friend-item {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.friend-item:last-child {
    margin-bottom: 0;
}

.friend-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    overflow: hidden;
    border: 1px solid var(--border-light);
    flex-shrink: 0;
}

.friend-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.friend-info {
    flex: 1;
    min-width: 0;
}

.friend-name {
    color: var(--text-link);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    word-wrap: break-word;
}

.friend-name:hover {
    text-decoration: underline;
}

.friend-stats {
    font-size: 12px;
    color: var(--text-secondary);
}

/* Listopia Widget */
.listopia-content {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 10px;
}

.listopia-content a {
    color: var(--text-link);
    text-decoration: none;
    word-wrap: break-word;
}

.listopia-content a:hover {
    text-decoration: underline;
}

.show-more-btn {
    background: rgb(120, 88, 88);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    margin-top: 10px;
    transition: rgb(120, 88, 88);
}

.show-more-btn:hover {
    background-color: rgb(120, 88, 88);
}

/* Social Links Widget (replaces Genres) */
.social-links-widget {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.social-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--text-link);
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 14px;
    padding: 4px;
    border-radius: 4px;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.social-link:hover {
    background-color: var(--bg-secondary);
    color: var(--primary-brown);
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    padding: 1rem;
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal__content {
    background: var(--bg-primary);
    border-radius: 25px;
    max-width: 800px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    margin: auto;
}

.modal__header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-light);
    position: relative;
}

.modal__title {
    font-size: clamp(1.2rem, 3vw, 2rem);
    color: var(--primary-brown);
    margin-bottom: 8px;
    padding-right: 2rem;
    word-wrap: break-word;
}

.modal__close {
    position: absolute;
    top: 10px;
    right: 15px;
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-secondary);
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal__close:hover {
    color: var(--text-primary);
}

.modal__body {
    padding: 1.5rem;
    -ms-overflow-style: none;  /* IE and Edge */
    scrollbar-width: none;  /* Firefox */
}

.modal__body::-webkit-scrollbar {
    display: none; /* Chrome, Safari, and Opera */
}

.modal__cover {
    width: 100%;
    max-height: 300px;
    object-fit: cover;
    border-radius: 28px;
    margin-bottom: 15px;
}

.poem-text {
    font-size: clamp(14px, 2vw, 16px);
    line-height: 1.8;
    color: var(--text-primary);
    white-space: pre-line;
    margin-bottom: 1.5rem;
    font-family: "Georgia", serif;
}

.modal__author {
    color: var(--text-secondary);
    font-size: clamp(14px, 1.5vw, 16px);
    margin-bottom: 0;
    text-align: right;
    margin-right: 10px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.modal__category,
.modal__date {
    font-size: 0.85rem;
    color: #666;
    margin-top: 0px;
    display: inline-block;
}

/* Star Rating */
.star-rating {
    display: flex;
    gap: 2px;
    font-size: 14px;
}

.star {
    color: var(--star-empty);
    cursor: pointer;
    transition: color 0.2s ease;
}

.star.filled {
    color: var(--star-color);
}

.star:hover {
    color: var(--star-color);
}

/* Responsive Design */

/* Large tablets and small desktops */
@media (max-width: 1024px) {
    .main {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .sidebar {
        order: -1;
    }
    
    .search-bar {
        width: clamp(180px, 35vw, 250px);
    }
}

/* Tablets */
@media (max-width: 768px) {
    html {
        font-size: 15px;
    }
    
    .header__content {
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
    }
    
    .header__left {
        justify-content: space-between;
        width: 100%;
    }
    
    .header__right {
        justify-content: space-between;
        width: 100%;
    }
    
    .search-container {
        flex: 1;
        margin-right: 1rem;
    }
    
    .search-bar {
        width: 100%;
        min-width: 0;
    }
    
    .nav {
        gap: 0.75rem;
    }
    
    .main {
        padding: 1rem;
    }
    
    .profile {
        grid-template-columns: 1fr;
        grid-template-areas:
            "avatar"
            "stats"
            "info";
        text-align: center;
        justify-items: center;
        gap: 1rem;
    }
    
    .profile__info {
        text-align: left;
        width: 100%;
    }
    
    .profile__stats {
        width: 100%;
    }
    
    .profile__row {
        grid-template-columns: 1fr;
        gap: 0.25rem;
    }
    
    .profile__label {
        text-align: left;
        font-weight: 600;
    }
    
    .favorites-grid {
        grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
        gap: 0.75rem;
    }
    
    .bookshelves {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
        gap: 1rem;
    }
    
    .genres-grid {
        grid-template-columns: repeat(auto-fit, minmax(70px, 1fr));
    }
    
    .modal__content {
        width: 95%;
        max-height: 95vh;
    }
    
    .modal__header,
    .modal__body {
        padding: 1rem;
    }
    
    .modal__author {
        text-align: center;
        margin: 0 auto;
    }
}

/* Mobile phones */
@media (max-width: 480px) {
    html {
        font-size: 14px;
    }
    
    .promo-banner {
        padding: 6px 0.5rem;
        font-size: 12px;
    }
    
    .header {
        padding: 8px 0;
    }
    
    .header__content {
        padding: 0 0.5rem;
        gap: 0.75rem;
    }
    
    .logo {
        font-size: 1.25rem;
    }
    
    .nav {
        gap: 0.5rem;
    }
    
    .nav__link {
        font-size: 0.75rem;
        padding: 6px 2px;
    }
    
    .search-bar {
        padding: 6px 30px 6px 8px;
        font-size: 12px;
    }
    
    .search-icon {
        width: 14px;
        height: 14px;
        right: 8px;
    }
    
    .header__icons {
        gap: 0.25rem;
    }
    
    .header__icon {
        width: 24px;
        height: 24px;
        font-size: 12px;
    }
    
    .main {
        padding: 0.75rem;
        gap: 1rem;
    }
    
    .profile {
        gap: 0.75rem;
    }
    
    .profile__avatar {
        width: 100px;
        height: 100px;
    }
    
    .profile__name {
        font-size: 1.1rem;
    }
    
    .profile__stats {
        font-size: 11px;
    }
    
    .section {
        margin-bottom: 1.5rem;
    }
    
    .section__title {
        font-size: 1rem;
    }
    
    .favorites-grid {
        grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
        gap: 0.5rem;
    }
    
    .poem-cover__title {
        font-size: 0.6rem;
        padding: 2px;
    }
    
    .bookshelves {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }
    
    .shelf-column {
        gap: 6px;
    }
    
    .shelf-item {
        font-size: 13px;
    }
    
    .widget {
        margin-bottom: 1rem;
    }
    
    .widget__header {
        padding: 10px 12px;
        font-size: 12px;
    }
    
    .widget__content {
        padding: 12px;
    }
    
    .year-widget {
        gap: 10px;
    }
    
    .year-widget__image {
        width: 50px;
        height: 50px;
        font-size: 20px;
    }
    
    .year-widget__title {
        font-size: 12px;
    }
    
    .year-widget__description {
        font-size: 11px;
    }
    
    .year-widget__link {
        font-size: 11px;
    }
    
    .friend-item {
        gap: 8px;
    }
    
    .friend-avatar {
        width: 32px;
        height: 32px;
    }
    
    .friend-name {
        font-size: 12px;
    }
    
    .friend-stats {
        font-size: 11px;
    }
    
    .listopia-content {
        font-size: 12px;
    }
    
    .genres-grid {
        grid-template-columns: repeat(auto-fit, minmax(60px, 1fr));
        gap: 6px;
    }
    
    .genre-item {
        font-size: 11px;
    }
    
    .modal {
        padding: 0.5rem;
    }
    
    .modal__content {
        width: 98%;
        max-height: 98vh;
    }
    
    .modal__header,
    .modal__body {
        padding: 0.75rem;
    }
    
    .modal__title {
        font-size: 1.1rem;
        padding-right: 1.5rem;
    }
    
    .modal__close {
        font-size: 20px;
        width: 26px;
        height: 26px;
        top: 8px;
        right: 10px;
    }
    
    .poem-text {
        font-size: 13px;
        line-height: 1.6;
    }
    
    .modal__author {
        font-size: 12px;
        text-align: center;
        margin: 0;
    }
    
    .modal__category,
    .modal__date {
        font-size: 11px;
    }
}

/* Extra small devices */
@media (max-width: 320px) {
    html {
        font-size: 13px;
    }
    
    .header__content {
        padding: 0 0.25rem;
    }
    
    .logo {
        font-size: 1.1rem;
    }
    
    .nav__link {
        font-size: 0.7rem;
    }
    
    .main {
        padding: 0.5rem;
    }
    
    .favorites-grid {
        grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
    }
    
    .poem-cover__title {
        font-size: 0.55rem;
    }
    /* Completing the modal styles and responsive design */

.modal__content {
    background: var(--bg-primary);
    border-radius: 6px;
    max-width: 800px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    margin: auto;
    box-shadow: var(--shadow-medium);
}

.modal__header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-light);
    position: relative;
}

.modal__title {
    font-size: clamp(1.2rem, 3vw, 2rem);
    color: var(--primary-brown);
    margin-bottom: 8px;
    padding-right: 2rem;
    word-wrap: break-word;
}

.modal__close {
    position: absolute;
    top: 10px;
    right: 15px;
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-secondary);
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.modal__close:hover {
    color: var(--text-primary);
    background: var(--hover-color);
}

.modal__body {
    padding: 1.5rem;
    -ms-overflow-style: none;  /* IE and Edge */
    scrollbar-width: none;  /* Firefox */
}

.modal__body::-webkit-scrollbar {
    display: none; /* Chrome, Safari, and Opera */
}

.modal__cover {
    width: 100%;
    max-height: 300px;
    object-fit: cover;
    border-radius: 4px;
    margin-bottom: 15px;
}

.poem-text {
    font-size: clamp(14px, 2vw, 16px);
    line-height: 1.8;
    color: var(--text-primary);
    white-space: pre-line;
    margin-bottom: 1.5rem;
    font-family: "Georgia", serif;
}

.modal__author {
    color: var(--text-secondary);
    font-size: clamp(14px, 1.5vw, 16px);
    margin-bottom: 0;
    text-align: right;
    margin-right: 10px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.modal__category,
.modal__date {
    font-size: 0.85rem;
    color: #666;
    margin-top: 0px;
    display: inline-block;
}

/* Star Rating */
.star-rating {
    display: flex;
    gap: 2px;
    font-size: 14px;
    margin-top: 10px;
}

.star {
    color: var(--star-empty);
    cursor: pointer;
    transition: color 0.2s ease;
}

.star.filled {
    color: var(--star-color);
}

.star:hover {
    color: var(--star-color);
}

/* Loading Animation */
.loading {
    text-align: center;
    padding: 2rem;
    color: var(--text-secondary);
}

.loading::after {
    content: '';
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-color);
    border-top: 2px solid var(--text-link);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-left: 10px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Scrollbar Styling */
::-webkit-scrollbar { display: none; } /* Chrome, Safari, Opera */

/* Focus Styles for Accessibility */
button:focus,
input:focus,
a:focus {
    outline: 2px solid var(--text-link);
    outline-offset: 2px;
}
}
/* Print Styles */
@media print {
    .header,
    .sidebar,
    .modal {
        display: none;
    }
    
    .main {
        grid-template-columns: 1fr;
        max-width: 100%;
        margin: 0;
        padding: 0;
    }
    
    .poem-cover {
        break-inside: avoid;
    }
}

/* Responsive Design Breakpoints */

/* Large screens and up */
@media (min-width: 1200px) {
    .main {
        max-width: 1400px;
        grid-template-columns: 1fr 350px;
    }
    
    .favorites-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    }
    
    .bookshelves {
        grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    }
}

/* Large tablets and small desktops */
@media (max-width: 1024px) {
    .main {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .sidebar {
        order: 1;
    }
    
    .search-bar {
        width: clamp(180px, 35vw, 250px);
    }
    
    .header__content {
        padding: 0 1.5rem;
    }
    
    .widget {
        display: inline-block;
        width: calc(50% - 0.75rem);
        margin-right: 1.5rem;
        margin-bottom: 1.5rem;
        vertical-align: top;
    }
    
    .widget:nth-child(2n) {
        margin-right: 0;
    }
}

/* Medium tablets */
@media (max-width: 768px) {
    html {
        font-size: 15px;
    }
    
    .header__content {
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
        padding: 0 1rem;
    }
    
    .header__left {
        justify-content: space-between;
        width: 100%;
    }
    
    .header__right {
        justify-content: space-between;
        width: 100%;
    }
    
    .search-container {
        flex: 1;
        margin-right: 1rem;
    }
    
    .search-bar {
        width: 100%;
        min-width: 0;
    }
    
    .nav {
        gap: 0.75rem;
        flex-wrap: wrap;
    }
    
    .nav__link {
        padding: 6px 8px;
        font-size: 0.9rem;
    }
    
    .main {
        padding: 1rem;
    }
    
    .profile {
        grid-template-columns: 1fr;
        grid-template-areas:
            "avatar"
            "stats"
            "info";
        text-align: center;
        justify-items: center;
        gap: 1rem;
    }
    
    .profile__info {
        text-align: left;
        width: 100%;
    }
    
    .profile__stats {
        width: 100%;
    }
    
    .profile__row {
        grid-template-columns: 1fr;
        gap: 0.25rem;
    }
    
    .profile__label {
        text-align: left;
        font-weight: 600;
    }
    
    .favorites-grid {
        grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
        gap: 0.75rem;
    }
    
    .bookshelves {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
        gap: 1rem;
    }
    
    .genres-grid {
        grid-template-columns: repeat(auto-fit, minmax(70px, 1fr));
    }
    
    .widget {
        width: 100%;
        margin-right: 0;
        display: block;
    }
    
    .modal__content {
        width: 95%;
        max-height: 95vh;
    }
    
    .modal__header,
    .modal__body {
        padding: 1rem;
    }
    
    .modal__author {
        text-align: center;
        margin: 0 auto;
    }
}

/* Mobile-specific friend list styling */
@media (max-width: 768px) {
    .header__left {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    .logo {
        align-self: center;
    }
    
    .nav {
        width: 100%;
        justify-content: center;
    }
    .profile__avatar {
        width: 100px;
        height: 100px;
    }
    .favorites-grid {
        grid-template-columns: repeat(auto-fill, minmax(85px, 1fr));
    }
    .year-widget {
        flex-direction: column;
        text-align: center;
    }
    .year-widget__image {
        align-self: center;
    }
    .friend-item {
        flex-direction: row; /* Change from column to row */
        align-items: center; /* Re-center items vertically */
    }
    .friend-avatar {
        /* No longer needed as align-items on parent handles it */
    }

    .social-links-widget {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
        gap: 0.5rem;
    }

    .social-link {
        padding: 0.5rem;
        font-size: 1.5rem; /* Make icon bigger */
        border-radius: 50%;
        width: 44px;
        height: 44px;
        justify-content: center;
    }
    .social-link span {
        display: none; /* Hide text on mobile */
    }
}

/* Small tablets and large phones */
@media (max-width: 640px) {
}

/* Mobile phones */
@media (max-width: 480px) {
    html {
        font-size: 14px;
    }
    
    .promo-banner {
        padding: 6px 0.5rem;
        font-size: 12px;
    }
    
    .header {
        padding: 8px 0;
    }
    
    .header__content {
        padding: 0 0.5rem;
        gap: 0.75rem;
    }
    
    .logo {
        font-size: 1.25rem;
    }
    
    .nav {
        gap: 0.5rem;
    }
    
    .nav__link {
        font-size: 0.75rem;
        padding: 6px 2px;
    }
    
    .search-bar {
        padding: 6px 30px 6px 8px;
        font-size: 12px;
    }
    
    .search-icon {
        width: 14px;
        height: 14px;
        right: 8px;
    }
    
    .header__icons {
        gap: 0.25rem;
    }
    
    .header__icon {
        width: 24px;
        height: 24px;
        font-size: 12px;
    }
    
    .main {
        padding: 0.75rem;
        gap: 1rem;
    }
    
    .profile {
        gap: 0.75rem;
    }
    
    .profile__avatar {
        width: 80px;
        height: 80px;
    }
    
    .profile__name {
        font-size: 1.1rem;
    }
    
    .profile__stats {
        font-size: 11px;
    }
    
    .section {
        margin-bottom: 1.5rem;
    }
    
    .section__title {
        font-size: 1rem;
    }
    
    .favorites-grid {
        grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
        gap: 0.5rem;
    }
    
    .poem-cover__title {
        font-size: 0.6rem;
        padding: 2px;
    }
    
    .poem-cover__category {
        font-size: 0.5rem;
        padding: 1px 4px;
    }
    
    .bookshelves {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }
    
    .shelf-column {
        gap: 6px;
    }
    
    .shelf-item {
        font-size: 13px;
    }
    
    .widget {
        margin-bottom: 1rem;
    }
    
    .widget__header {
        padding: 10px 12px;
        font-size: 12px;
    }
    
    .widget__content {
        padding: 12px;
    }
    
    .year-widget {
        gap: 10px;
    }
    
    .year-widget__image {
        width: 50px;
        height: 50px;
        font-size: 20px;
    }
    
    .year-widget__title {
        font-size: 12px;
    }
    
    .year-widget__description {
        font-size: 11px;
    }
    
    .year-widget__link {
        font-size: 11px;
    }
    
    .friend-item {
        gap: 8px;
    }
    
    .friend-avatar {
        width: 32px;
        height: 32px;
    }
    
    .friend-name {
        font-size: 12px;
    }
    
    .friend-stats {
        font-size: 11px;
    }
    
    .listopia-content {
        font-size: 12px;
    }
    
    .show-more-btn {
        font-size: 11px;
        padding: 6px 12px;
    }
    
    .genres-grid {
        grid-template-columns: repeat(auto-fit, minmax(60px, 1fr));
        gap: 6px;
    }
    
    .genre-item {
        font-size: 11px;
    }
    
    .modal {
        padding: 0.5rem;
    }
    
    .modal__content {
        width: 98%;
        max-height: 98vh;
    }
    
    .modal__header,
    .modal__body {
        padding: 0.75rem;
    }
    
    .modal__title {
        font-size: 1.1rem;
        padding-right: 1.5rem;
    }
    
    .modal__close {
        font-size: 20px;
        width: 26px;
        height: 26px;
        top: 8px;
        right: 10px;
    }
    
    .poem-text {
        font-size: 13px;
        line-height: 1.6;
    }
    
    .modal__author {
        font-size: 12px;
        text-align: center;
        margin: 0;
    }
    
    .modal__category,
    .modal__date {
        font-size: 11px;
    }
    
    .star-rating {
        font-size: 12px;
        justify-content: center;
    }
    
    #loadMorePoems {
        padding: 6px 12px;
        font-size: 12px;
    }
}

/* Extra small devices */
@media (max-width: 320px) {
    html {
        font-size: 13px;
    }
    
    .header__content {
        padding: 0 0.25rem;
    }
    
    .logo {
        font-size: 1.1rem;
    }
    
    .nav__link {
        font-size: 0.7rem;
        padding: 4px 2px;
    }
    
    .header__icon {
        width: 20px;
        height: 20px;
        font-size: 10px;
    }
    
    .main {
        padding: 0.5rem;
    }
    
    .profile__avatar {
        width: 70px;
        height: 70px;
    }
    
    .favorites-grid {
        grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
        gap: 0.4rem;
    }
    
    .poem-cover__title {
        font-size: 0.55rem;
        padding: 1px;
    }
    
    .poem-cover__category {
        font-size: 0.45rem;
        padding: 1px 3px;
    }
    
    .modal__content {
        width: 100%;
        max-height: 100vh;
        border-radius: 6px;
    }
    
    .modal__header,
    .modal__body {
        padding: 0.5rem;
    }
    
    .modal__title {
        font-size: 1rem;
    }
    
    .modal__close {
        font-size: 18px;
        width: 24px;
        height: 24px;
        top: 6px;
        right: 8px;
    }
    
    .poem-text {
        font-size: 12px;
        line-height: 1.5;
    }
    
    .modal__author {
        font-size: 11px;
    }
    
    .widget__content {
        padding: 8px;
    }
    
    .year-widget__image {
        width: 40px;
        height: 40px;
        font-size: 16px;
    }
    
    .friend-avatar {
        width: 28px;
        height: 28px;
    }
    
    .show-more-btn {
        font-size: 10px;
        padding: 5px 10px;
    }
}

/* High DPI displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 2dppx) {
    .search-icon {
        image-rendering: -webkit-optimize-contrast;
    }
}

/* Landscape orientation on mobile */
@media (max-width: 768px) and (orientation: landscape) {
    .header__content {
        flex-direction: row;
        flex-wrap: wrap;
    }
    
    .header__left,
    .header__right {
        width: auto;
    }
    
    .profile {
        grid-template-columns: auto 1fr;
        grid-template-areas:
            "avatar info"
            "stats info";
        text-align: left;
    }
    
    .profile__info {
        text-align: left;
    }
    
    .modal__content {
        max-height: 95vh;
    }
}

/* Reduced motion preferences */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .poem-cover:hover {
        transform: none;
    }
    
    .loading::after {
        animation: none;
    }
}

/* High contrast mode */
@media (prefers-contrast: high) {
    :root {
        --text-primary: #000000;
        --text-secondary: #000000;
        --text-light: #000000;
        --text-link: #0000ff;
        --bg-primary: #ffffff;
        --bg-secondary: #ffffff;
        --border-color: #000000;
        --border-light: #000000;
    }
    
    .poem-cover,
    .widget,
    .modal__content {
        border: 2px solid var(--border-color);
    }
    
    button:focus,
    input:focus,
    a:focus {
        outline: 3px solid #000000;
    }
}