/* Books Page Styles */
.books-main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 3rem 2rem;
}

/* BookGit Calendar Section */
.bookgit-section {
    margin-bottom: 4rem;
}

.bookgit-title {
    font-size: clamp(1.5rem, 3vw, 2rem);
    font-weight: 700;
    margin-bottom: 0.5rem;
    text-transform: lowercase;
}

.bookgit-subtitle {
    font-size: clamp(0.875rem, 1.5vw, 1rem);
    opacity: 0.7;
    margin-bottom: 2rem;
}

.calendar-container {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    padding: 2rem;
    border-radius: 8px;
    overflow: visible; /* Allow tooltips to show outside container */
}

.calendar-legend {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.5rem;
    margin-bottom: 1rem;
    font-size: 0.75rem;
}

.legend-label {
    opacity: 0.7;
}

.legend-squares {
    display: flex;
    gap: 3px;
}

.legend-square {
    width: 10px;
    height: 10px;
    border-radius: 2px;
    background: var(--grid-color);
}

.legend-square[data-level="1"] {
    background: #0e4429;
}

.legend-square[data-level="2"] {
    background: #006d32;
}

.legend-square[data-level="3"] {
    background: #26a641;
}

.legend-square[data-level="4"] {
    background: #39d353;
}

.calendar-wrapper {
    display: flex;
    gap: 0.5rem;
    overflow-x: auto;
    padding-bottom: 1rem;
    align-items: flex-start;
}

.calendar-labels-left {
    display: flex;
    flex-direction: column;
    padding-top: 20px; /* Match month label height */
    align-items: flex-end;
    padding-right: 0.5rem;
    flex-shrink: 0;
}

.calendar-day-labels {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 35px;
    justify-content: flex-start;
}

.calendar-day-label {
    font-size: 0.7rem;
    opacity: 0.7;
    height: 14px; /* Match calendar day height */
    line-height: 14px;
    display: flex;
    align-items: center;
    margin: 0;
    padding: 0;
}

.calendar-content {
    display: flex;
    flex-direction: column;
    gap: 0;
    position: relative;
    flex: 1;
}

.calendar-months {
    position: relative;
    height: 20px;
    margin-bottom: 0.5rem;
    min-height: 20px;
}

.calendar-month-label {
    position: absolute;
    font-size: 0.7rem;
    opacity: 0.7;
    white-space: nowrap;
    top: 0;
}

.calendar-grid {
    display: flex;
    gap: 4px;
    align-items: flex-start;
}

.calendar-week {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.calendar-day {
    width: 14px;
    height: 14px;
    border-radius: 2px;
    background: var(--grid-color);
    cursor: pointer;
    position: relative;
    transition: transform 0.1s ease;
}

.calendar-day:hover {
    transform: scale(1.3);
    z-index: 10;
}

.calendar-day[data-level="0"] {
    background: var(--grid-color);
}

.calendar-day[data-level="1"] {
    background: #0e4429;
}

.calendar-day[data-level="2"] {
    background: #006d32;
}

.calendar-day[data-level="3"] {
    background: #26a641;
}

.calendar-day[data-level="4"] {
    background: #39d353;
}

.calendar-day-tooltip {
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    padding: 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    z-index: 1000;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

/* Ensure tooltip doesn't get cut off - adjust position if near edges */
.calendar-day:hover .calendar-day-tooltip {
    opacity: 1;
}

/* Adjust tooltip position for edge cases */
.calendar-week:first-child .calendar-day:hover .calendar-day-tooltip {
    left: 0;
    transform: translateX(0);
}

.calendar-week:last-child .calendar-day:hover .calendar-day-tooltip {
    left: auto;
    right: 0;
    transform: translateX(0);
}

.calendar-day:hover .calendar-day-tooltip {
    opacity: 1;
}

.calendar-stats {
    display: flex;
    gap: 2rem;
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    flex-wrap: wrap;
    border-top: 1px solid var(--border-color);
}

.stat-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--accent-color);
}

.stat-label {
    font-size: 0.75rem;
    opacity: 0.7;
}

/* Quick Log Section */
.quick-log-section {
    margin-bottom: 4rem;
}

.quick-log-form {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    padding: 1.5rem;
    border-radius: 8px;
}

.form-row {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.form-group {
    flex: 1;
    min-width: 150px;
}

.form-group label {
    display: block;
    font-size: 0.75rem;
    opacity: 0.7;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.form-group input {
    width: 100%;
    padding: 0.75rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    color: var(--text-color);
    font-family: inherit;
    font-size: 0.875rem;
    transition: border-color 0.2s ease;
}

.form-group input:focus {
    outline: none;
    border-color: var(--accent-color);
}

.form-group input::placeholder {
    opacity: 0.5;
}

.log-button {
    padding: 0.75rem 2rem;
    background: var(--accent-color);
    color: var(--text-color);
    border: none;
    border-radius: 4px;
    font-family: inherit;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s ease, transform 0.1s ease;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.log-button:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

.log-button:active {
    transform: translateY(0);
}

.log-message {
    margin-top: 1rem;
    padding: 0.75rem;
    border-radius: 4px;
    font-size: 0.875rem;
    display: none;
}

.log-message.success {
    display: block;
    background: rgba(0, 255, 0, 0.1);
    border: 1px solid rgba(0, 255, 0, 0.3);
    color: #00ff00;
}

.log-message.error {
    display: block;
    background: rgba(255, 0, 0, 0.1);
    border: 1px solid rgba(255, 0, 0, 0.3);
    color: #ff6b6b;
}

/* Current Reading Section */
.current-reading-section {
    margin-bottom: 4rem;
}

.current-book-card {
    display: flex;
    gap: 1rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    padding: 0.75rem;
    border-radius: 4px;
}

.book-cover-placeholder {
    width: 50px;
    height: 75px;
    background: var(--grid-color);
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    flex-shrink: 0;
    border-radius: 2px;
    overflow: hidden;
}

.book-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.book-title {
    font-size: 0.875rem;
    font-weight: 600;
    margin: 0;
}

.book-author {
    font-size: 0.75rem;
    opacity: 0.7;
    margin: 0;
}

.book-progress {
    margin-top: auto;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: var(--grid-color);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.progress-fill {
    height: 100%;
    background: var(--accent-color);
    transition: width 0.3s ease;
}

.progress-text {
    font-size: 0.875rem;
    opacity: 0.8;
}

.progress-percent {
    margin-left: 0.5rem;
    opacity: 0.6;
}

/* Up Next Section */
.up-next-section {
    margin-bottom: 4rem;
}

/* Completed Books Section */
.completed-books-section {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3rem;
    margin-bottom: 4rem;
}

.books-year-section {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.books-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.book-item {
    display: flex;
    gap: 1rem;
    padding: 0.75rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    transition: background 0.2s ease;
}

.book-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.book-item-cover {
    width: 50px;
    height: 75px;
    background: var(--grid-color);
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    flex-shrink: 0;
    border-radius: 2px;
    overflow: hidden;
}

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

.book-item-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.book-item-title {
    font-size: 0.875rem;
    font-weight: 600;
    margin: 0;
}

.book-item-author {
    font-size: 0.75rem;
    opacity: 0.7;
    margin: 0;
}

.book-item-date {
    font-size: 0.7rem;
    opacity: 0.5;
    margin-top: 0.25rem;
}

@media (max-width: 768px) {
    .completed-books-section {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
    
    .calendar-stats {
        flex-direction: column;
        gap: 1rem;
    }
    
    .current-book-card {
        flex-direction: column;
    }
    
    .book-cover-placeholder {
        width: 100%;
        max-width: 200px;
        margin: 0 auto;
    }
}

