/* Layout Styles */
.layout_1 {
    float: left;
    min-width: 230px;
    padding-right: 20px;
    min-height: 320px; 
}

.layout_2 {
    float: left;
    width: 0;
    min-width: 40%;
    max-width: 100%;
    padding-right: 20px;
}

.main-profile-image-container {
    width: 100%; 
    height: 270px; 
    border-radius: 1em;
    margin-top: 20px;
    margin-bottom: 20px;
    background-size: cover;
    background-position: center center;
}

/* Recommended Badge */
.recommended-badge {
    position: absolute;
    top: -1px;
    right: -25px;
    background: #4CAF50;
    color: white;
    font-size: 9px;
    padding: 1px 4px;
    border-radius: 3px;
    font-weight: bold;
    line-height: 1;
}

/* Filter Info */
.filter-info {
    background: #2a2a2a;
    padding: 15px;
    border-radius: 8px;
    margin: 10px 0;
    border-left: 4px solid #4CAF50;
}

.filter-info h2 {
    margin: 0 0 10px;
    color: #4CAF50;
    font-size: 1.5em;
}

.filter-stats {
    color: #ccc;
    font-size: .9em;
}

/* Book Item */
.book-item {
    display: flex;
    padding: 15px;
    border-bottom: 1px solid #333;
    background: #1a1a1a;
    margin-bottom: 10px;
    border-radius: 8px;
}

.book-thumbnail {
    width: 80px;
    height: 120px;
    flex-shrink: 0;
    margin-right: 15px;
    background: #333;
    border-radius: 4px;
    overflow: hidden;
}

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

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

.book-title {
    font-size: 1.2em;
    font-weight: 700;
    margin-bottom: 8px;
}

.book-title a {
    color: #fff;
    text-decoration: none;
}

.book-title a:hover {
    color: #4CAF50;
}

.book-meta {
    color: #999;
    font-size: .85em;
    line-height: 1.5;
}

.book-meta div {
    margin-bottom: 3px;
}

.book-meta strong {
    color: #ccc;
}

.book-meta a {
    color: #4CAF50;
    text-decoration: none;
}

.book-meta a:hover {
    text-decoration: underline;
}

.book-stats {
    margin-top: 10px;
    color: #666;
    font-size: .8em;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 30px 0;
    gap: 5px;
}

.pagination a, .pagination span {
    padding: 8px 12px;
    text-decoration: none;
    border: 1px solid #444;
    border-radius: 4px;
    color: #ccc;
}

.pagination a:hover {
    background: #333;
    color: #fff;
}

.pagination .current {
    background: #4CAF50;
    color: #fff;
    border-color: #4CAF50;
}

/* Related Section */
.related-section {
    background: #2a2a2a;
    padding: 20px;
    border-radius: 8px;
    margin: 20px 0;
}

.related-authors {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 15px;
}

.related-author-tag {
    background: #333;
    color: #ccc;
    padding: 6px 12px;
    border-radius: 20px;
    text-decoration: none;
    font-size: .9em;
    transition: background .2s;
}

.related-author-tag:hover {
    background: #4CAF50;
    color: #fff;
}

.no-results {
    text-align: center;
    padding: 50px 20px;
    color: #666;
    background: #2a2a2a;
    border-radius: 8px;
    margin: 20px 0;
}

/* Library Container */
.libraries-container {
    max-width: 1200px;
    margin: 0 auto;
}

/* Library Header */
.library-header {
    background-image: url(https://cdn.udanax.org/icons/wood-table4.jpg);
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    padding: 30px;
    border-radius: 12px;
    margin-bottom: 15px;
    color: #fff;
    position: relative;
}

.library-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #0009;
    border-radius: 12px;
}

.library-header .content,
.library-header h1,
.library-header .library-subtitle,
.library-header .library-stats {
    position: relative;
    z-index: 1;
}

.library-header h1,
.library-header .library-subtitle {
    text-shadow: 2px 2px 4px #000000b3;
}

.library-header h1 {
    margin: 0 0 15px;
    font-size: 2.2em;
    font-weight: 700;
}

.library-subtitle {
    font-size: .9em;
    opacity: .9;
    margin-bottom: 20px;
}

.neighbors-link {
    position: absolute;
    top: 20px;
    left: 20px;
    background: #4caf50e6;
    color: #fff;
    padding: 8px 15px;
    border-radius: 20px;
    text-decoration: none;
    font-size: .9em;
    transition: all .3s ease;
}

.neighbors-link:hover {
    background: #4caf50ff;
    transform: translateY(-1px);
}

.visit-count-display {
    position: absolute;
    top: 20px;
    right: 20px;
    background: #00000059;
    padding: 8px 15px;
    border-radius: 20px;
    font-size: .9em;
    border: 1px solid #ffffff4d;
}

/* Library Settings */
.library-settings {
    background: #ffffff1a;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 25px;
    border: 1px solid #fff3;
    backdrop-filter: blur(10px);
    display: none;
}

.library-settings.show {
    display: block;
}

.settings-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 15px;
}

.settings-title {
    color: #fff;
    font-size: 1.1em;
    font-weight: 700;
    margin: 0;
}

.settings-toggle {
    margin-left: 8px;
    cursor: pointer;
    font-size: .9em;
    opacity: .7;
    transition: all .3s ease;
    padding: 4px;
    border-radius: 4px;
}

.settings-toggle:hover {
    opacity: 1;
    background: #ffffff1a;
    transform: scale(1.1);
}

.privacy-toggle-area {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: .85em;
    opacity: .8;
}

.privacy-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}

.privacy-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ffffff4d;
    transition: .3s;
    border-radius: 24px;
    border: 1px solid #fff6;
}

.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 2px;
    bottom: 2px;
    background-color: #fff;
    transition: .3s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: #4caf50cc;
    border-color: #4caf50ff;
}

input:checked + .slider:before {
    transform: translateX(20px);
}

.description-input {
    width: 100%;
    padding: 12px;
    border: 2px solid #ffffff4d;
    border-radius: 8px;
    background: #ffffff1a;
    color: #fff;
    font-size: 1em;
    resize: vertical;
    min-height: 70px;
    box-sizing: border-box;
    font-family: inherit;
}

.description-input::placeholder {
    color: #fff9;
}

.description-input:focus {
    outline: none;
    border-color: #fff9;
    background: #ffffff26;
}

.description-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 8px;
    font-size: .85em;
}

.sharing-hint {
    color: #fffc;
    font-style: italic;
}

.char-counter {
    color: #ffffffb3;
}

.char-counter.warning {
    color: #ffeb3b;
}

.char-counter.error {
    color: #f44336;
}

.save-btn {
    background: #4caf50e6;
    color: #fff;
    border: none;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: .9em;
    cursor: pointer;
    transition: all .3s ease;
    margin-left: 10px;
    opacity: 0;
    transform: translateY(-5px);
}

.save-btn.show {
    opacity: 1;
    transform: translateY(0);
}

.save-btn:hover {
    background: #4caf50ff;
    transform: translateY(-1px);
}

/* Library Stats */
.library-stats {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin-top: 20px;
}

.stat-item {
    text-align: center;
}

.stat-number {
    display: block;
    font-size: 1.8em;
    font-weight: 700;
    margin-bottom: 5px;
}

.stat-label {
    font-size: .8em;
    opacity: .9;
}

/* Status Tabs */
.status-tabs {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

.status-tab {
    padding: 5px;
    background: #2a2a2a;
    color: #ccc;
    text-decoration: none;
    border-radius: 15px;
    transition: all .3s ease;
    border: 2px solid transparent;
    font-size: 11px;
}

.status-tab:hover {
    background: #333;
    color: #fff;
}

.status-tab.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    border-color: #667eea;
}

/* Book Card */
.book-card {
    background: #1a1a1a;
    border-radius: 12px;
    padding: 20px;
    transition: all .3s ease;
    border: 1px solid #333;
    position: relative;
    overflow: hidden;
}

.book-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px #0000004d;
    border-color: #667eea;
}

.book-card-header {
    display: flex;
    gap: 15px;
    margin-bottom: 15px;
}

.book-status {
    position: absolute;
    top: 15px;
    right: 15px;
    padding: 4px 8px;
    border-radius: 15px;
    font-size: .75em;
    font-weight: 700;
}

.status-want {
    background: #4CAF50;
    color: #fff;
}

.status-reading {
    background: #FF9800;
    color: #fff;
}

.status-read {
    background: #2196F3;
    color: #fff;
}

.book-personal {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #333;
}

.book-rating {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.stars {
    color: #FFD700;
    font-size: .9em;
}

.book-memo {
    color: #ccc;
    font-size: .9em;
    font-style: italic;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    background: #667eea1a;
    padding: 10px;
    border-radius: 8px;
    border-left: 3px solid #667eea;
}

.book-date {
    color: #666;
    font-size: .8em;
    margin-top: 8px;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #666;
    background: #2a2a2a;
    border-radius: 12px;
}

.empty-state h3 {
    margin-bottom: 15px;
    color: #999;
}

.empty-state a {
    color: #667eea;
    text-decoration: none;
    font-weight: 700;
}

/* Login Prompt */
.login-prompt {
    text-align: center;
    background: linear-gradient(135deg, #667eea1a 0%, #764ba21a 100%);
    padding: 60px 30px;
    border-radius: 15px;
    border: 2px dashed #667eea;
    margin: 40px 0;
}

.login-prompt h2 {
    color: #667eea;
    margin-bottom: 20px;
    font-size: 1.8em;
}

.login-prompt p {
    color: #ccc;
    margin-bottom: 25px;
    font-size: 1.1em;
    line-height: 1.6;
}

.login-btn {
    display: inline-block;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    padding: 15px 30px;
    border-radius: 25px;
    text-decoration: none;
    font-weight: 700;
    font-size: 1.1em;
    transition: all .3s ease;
    box-shadow: 0 4px 15px #667eea66;
}

.login-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px #667eea99;
}

.more-button {
    text-align: center;
    margin: 30px 0;
}

/* Alert */
.alert {
    position: fixed;
    top: 20px;
    right: 0;
    padding: 12px 20px;
    border-radius: 8px;
    font-weight: 500;
    z-index: 1000;
    transform: translateX(100%);
    transition: transform .3s ease;
}

.alert.show {
    transform: translateX(0);
}

.alert-success {
    background: #4caf50e6;
    color: #fff;
    border: 1px solid #4caf50ff;
}

.alert-error {
    background: #f44336e6;
    color: #fff;
    border: 1px solid #f44336ff;
}

/* Library View Container */
.library-view-container {
    max-width: 1200px;
    margin: 0 auto;
}

/* Library Owner Header */
.library-owner-header {
    background: linear-gradient(135deg, #4CAF50 0%, #45a049 100%);
    padding: 40px;
    border-radius: 15px;
    margin-bottom: 30px;
    color: #fff;
    position: relative;
    overflow: hidden;
}

.library-owner-header::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 100px;
    height: 200%;
    background: #ffffff1a;
    transform: rotate(15deg);
}

.owner-info-main {
    display: flex;
    align-items: center;
    gap: 25px;
    margin-bottom: 25px;
    position: relative;
    z-index: 1;
}

.owner-avatar-large {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: #fff3;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 700;
    font-size: 2em;
    border: 3px solid #ffffff4d;
}

.owner-details h1 {
    margin: 0 0 10px;
    font-size: 2.2em;
    font-weight: 700;
}

.owner-description {
    font-size: 1.1em;
    opacity: .9;
    margin: 0;
    font-style: italic;
}

.visit-badge {
    position: absolute;
    top: 20px;
    right: 20px;
    background: #fff3;
    padding: 8px 15px;
    border-radius: 20px;
    font-size: .9em;
    border: 1px solid #ffffff4d;
}

.library-summary-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 20px;
    position: relative;
    z-index: 1;
}

.summary-stat-item {
    text-align: center;
    background: #ffffff1a;
    padding: 5px;
    border-radius: 12px;
    border: 1px solid #fff3;
}

.summary-stat-number {
    display: block;
    font-size: 1.1em;
    font-weight: 700;
    margin-bottom: 5px;
}

.summary-stat-label {
    font-size: .8em;
    opacity: .9;
}

/* Popular Books Section */
.popular-books-section {
    margin-bottom: 30px;
    background: #1a1a1a;
    border-radius: 15px;
    padding: 25px;
    border: 1px solid #333;
}

.section-title {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
    color: #fff;
    font-size: 1.3em;
    font-weight: 700;
}

.popular-books-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 15px;
}

.popular-book-item {
    text-align: center;
    background: #2a2a2a;
    border-radius: 10px;
    padding: 15px;
    transition: all .3s ease;
    border: 1px solid #333;
}

.popular-book-item:hover {
    transform: translateY(-5px);
    border-color: #667eea;
    box-shadow: 0 8px 25px #667eea33;
}

.popular-book-cover {
    width: 80px;
    height: 120px;
    margin: 0 auto 10px;
    border-radius: 6px;
    overflow: hidden;
    background: #333;
}

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

.popular-book-title {
    font-size: .85em;
    color: #fff;
    margin-bottom: 5px;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.popular-book-rating {
    color: #FFD700;
    font-size: .9em;
    margin-bottom: 8px;
}

.popular-book-memo {
    font-size: .75em;
    color: #999;
    font-style: italic;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Book Grid */
.book-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(500px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

/* Back to Neighbors */
.back-to-neighbors {
    margin-bottom: 20px;
}

.back-button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #2a2a2a;
    color: #ccc;
    padding: 10px 20px;
    border-radius: 20px;
    text-decoration: none;
    transition: all .3s ease;
    border: 1px solid #333;
}

.back-button:hover {
    background: #333;
    color: #fff;
    border-color: #667eea;
}

/* Neighbors Container */
.neighbors-container {
    max-width: 1200px;
    margin: 0 auto;
}

.neighbors-header {
    background: linear-gradient(135deg, #4CAF50 0%, #45a049 100%);
    padding: 40px;
    border-radius: 15px;
    margin-bottom: 30px;
    color: #fff;
}

.neighbors-header h1 {
    margin: 0 0 15px;
    font-size: 2.5em;
    font-weight: 700;
}

.neighbors-header p {
    font-size: .9em;
    opacity: .9;
    margin: 0;
}

/* Tab Navigation */
.tab-navigation {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

.tab-button {
    padding: 5px;
    background: #2a2a2a;
    color: #ccc;
    text-decoration: none;
    border-radius: 20px;
    transition: all .3s ease;
    border: 2px solid transparent;
    font-weight: 500;
    font-size: 12px;
}

.tab-button:hover {
    background: #333;
    color: #fff;
}

.tab-button.active {
    background: linear-gradient(135deg, #4CAF50 0%, #45a049 100%);
    color: #fff;
    border-color: #4CAF50;
}

/* Libraries Grid */
.libraries-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 25px;
    margin-bottom: 40px;
}

.library-card {
    background: linear-gradient(145deg, #1e1e1e 0%, #2a2a2a 100%);
    border-radius: 15px;
    padding: 25px;
    transition: all .3s ease;
    border: 1px solid #333;
    position: relative;
    overflow: hidden;
}

.library-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 15px 35px #4caf5033;
    border-color: #4CAF50;
}

.library-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #4CAF50, #45a049);
    opacity: 0;
    transition: opacity .3s ease;
}

.library-card:hover::before {
    opacity: 1;
}

.library-owner {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 15px;
}

.owner-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: linear-gradient(135deg, #4CAF50, #45a049);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 700;
    font-size: 1.2em;
}

.owner-info h3 {
    margin: 0 0 5px;
    color: #fff;
    font-size: 1.2em;
}

.owner-info p {
    margin: 0;
    color: #999;
    font-size: .9em;
    line-height: 1.4;
}

.recent-books {
    margin: 20px 0;
}

.recent-books h4 {
    margin: 0 0 15px;
    color: #ccc;
    font-size: .9em;
    font-weight: 400;
}

.books-preview {
    display: flex;
    gap: 8px;
    overflow: hidden;
}

.book-thumb {
    width: 45px;
    height: 65px;
    border-radius: 4px;
    overflow: hidden;
    flex-shrink: 0;
    background: #333;
}

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

.library-actions {
    margin-top: 20px;
    text-align: center;
}

.visit-button {
    display: inline-block;
    background: linear-gradient(135deg, #4CAF50 0%, #45a049 100%);
    color: #fff !important;
    padding: 8px 30px;
    border-radius: 25px;
    text-decoration: none;
    font-weight: 700;
    transition: all .3s ease;
    font-size: 13px;
}

.visit-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px #4caf5099;
}

.page-button {
    padding: 10px 15px;
    background: #2a2a2a;
    color: #ccc;
    text-decoration: none;
    border-radius: 8px;
    transition: all .3s ease;
}

.page-button:hover,
.page-button.active {
    background: #4CAF50;
    color: #fff;
}

/* Media Queries */
@media (max-width: 840px) {
    .layout_1 {
        min-width: 170px;
        min-height: 270px;
    }

    .main-profile-image-container {
        height: 200px;
    }

    .layout_2 {
        width: 50%;
    }

    .searchbound {
        width: 180px;
    }
}

@media (max-width: 768px) {
    .book-item {
        flex-direction: column;
    }

    .book-thumbnail {
        width: 120px;
        height: 180px;
        margin: 0 auto 15px;
    }

    .related-authors {
        justify-content: center;
    }

    .library-header {
        padding: 20px;
    }

    .library-header h1 {
        font-size: 1.3em;
    }

    .stat-number {
        font-size: 1.2em;
    }

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

    .status-tabs {
        justify-content: stretch;
    }

    .status-tab {
        flex: 1;
        text-align: center;
        min-width: 0;
    }

    .visit-count-display {
        padding: 5px 7px;
        font-size: .7em;
    }

    .neighbors-link {
        position: static;
        display: inline-block;
        margin: 0;
    }

    .settings-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .description-footer {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .library-owner-header {
        padding: 5px 5px;
    }

    .owner-info-main {
        flex-direction: column;
        text-align: center;
        gap: 15px;
        margin-top: -30px;
    }

    .owner-details h1 {
        font-size: 1.4em;
    }

    .library-summary-stats {
        grid-template-columns: repeat(4, 1fr);
    }

    .popular-books-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .visit-badge {
        position: static;
        display: inline-block;
        margin-top: 15px;
    }

    .neighbors-header {
        padding: 20px;
    }

    .neighbors-header h1 {
        font-size: 1.5em;
    }

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

    .library-stats {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }

    .tab-navigation {
        justify-content: stretch;
    }

    .tab-button {
        flex: 1;
        text-align: center;
    }
}