/* Site-wide custom styles for GiraLibros */

/* Base layout */
body {
    padding-top: 3.25rem;
}

/* Navbar with adaptive color */
.navbar {
    background-color: var(--bulma-primary-soft);
}

.navbar-item:hover,
.navbar-link:hover {
    background-color: transparent !important;
}

/* Location badges with dark mode support */
.location-badge {
    background-color: var(--bulma-light);
    color: var(--bulma-light-invert);
}

@media (prefers-color-scheme: dark) {
    .location-badge {
        background-color: var(--bulma-dark);
        color: var(--bulma-dark-invert);
    }
}

/* Location tag hover (for profile edit checkboxes) */
.location-tag {
    transition: all 0.15s;
}

.location-tag.is-light:hover:not(.is-info) {
    background-color: hsl(0, 0%, 90%) !important;
}

@media (prefers-color-scheme: dark) {
    .location-tag.is-light:hover:not(.is-info) {
        background-color: hsl(0, 0%, 20%) !important;
    }
}

/* Book cover placeholder with dark mode support */
.book-placeholder {
    background-color: var(--bulma-scheme-main-bis);
    border: 2px dashed var(--bulma-border);
}

/* =============================================================================
   Book Components
   ============================================================================= */

/* Book card user/timestamp row - prevent username overflow */
.book-card-meta-row {
    gap: 0.5rem;
    min-width: 0;
}

.book-card-user {
    min-width: 0;
    flex: 1;
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 0.3rem;
}

.book-card-user a {
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    min-width: 0;
}

.book-card-timestamp {
    flex-shrink: 0;
    white-space: nowrap;
}

/* Avatar in book card header row */
.book-card-avatar {
    width: 32px;
    height: 32px;
    border-radius: 4px;
    object-fit: cover;
    display: block;
    flex-shrink: 0;
}

.book-card-avatar-placeholder {
    width: 32px;
    height: 32px;
    border-radius: 4px;
    flex-shrink: 0;
    background-color: var(--bulma-scheme-main-bis);
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Book cover images - consistent sizing */
.book-cover-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 4px;
}

/* Book cover images in cards - zoomed in */
.card .book-cover-image {
    object-position: center 35%;
    transform: scale(1.2);
}

.book-cover-small {
    max-width: 60px;
    max-height: 90px;
    border-radius: 4px;
}

/* Book cover container - default for forms and profile */
.book-cover-container {
    width: 108px;
    height: 150px;
    overflow: hidden;
    border-radius: 4px;
}

/* Book cover container - large size for book list */
.card .book-cover-container {
    width: 100%;
    height: 240px;
    overflow: hidden;
    border-radius: 4px;
}

/* Card with cover image as full background - tablet and above only */
/* Card with cover image as full background */
.book-card-cover-bg {
    background-color: var(--bulma-scheme-main-bis);
    background-size: cover;
    background-position: center center;
    position: relative;
    min-height: 360px;
}

.book-card-cover-bg::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(
        to bottom,
        rgba(0, 0, 0, 0.72) 0%,
        rgba(0, 0, 0, 0.25) 20%,
        rgba(0, 0, 0, 0) 35%,
        rgba(0, 0, 0, 0) 55%,
        rgba(0, 0, 0, 0.22) 68%,
        rgba(0, 0, 0, 0.58) 82%,
        rgba(0, 0, 0, 0.82) 100%
    );
    border-radius: inherit;
    pointer-events: none;
}

.book-card-cover-bg .card-content {
    position: relative;
    z-index: 1;
}

.book-card-cover-bg .book-card-meta-username {
    color: #93c5fd;
}

.book-card-cover-bg .book-card-timestamp {
    color: rgba(255, 255, 255, 0.65) !important;
}

@media screen and (min-width: 769px) {
    .book-card-cover-bg {
        min-height: 360px;
    }

    .columns.is-multiline > .column > .card {
        max-width: 240px;
        margin-left: auto;
        margin-right: auto;
    }
}

/* Equal height cards in grid */
.columns.is-multiline > .column {
    display: flex;
}

.columns.is-multiline > .column > .card {
    display: flex;
    flex-direction: column;
    flex: 1;
}

.columns.is-multiline > .column > .card .card-content {
    display: flex;
    flex-direction: column;
    flex: 1;
    padding: 0.75rem;
}

/* Mobile cover styling */
.book-cover-container-mobile {
    width: 120px;
    height: 180px;
    overflow: hidden;
    border-radius: 4px;
    flex-shrink: 0;
}

.book-cover-container-small {
    width: 60px;
    height: 90px;
}

/* Book entry form styles */
.book-entry {
    position: relative;
    padding-right: 3rem; /* Make room for delete button */
}

.book-entry .delete {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
}

.book-entry.is-deleted {
    display: none;
}

/* =============================================================================
   Buttons
   ============================================================================= */

.button-fixed-width {
    min-width: 110px;
}

.js-requested-btn:disabled {
    cursor: default;
}

/* Search icon button reset */
.search-icon-button {
    cursor: pointer;
    pointer-events: auto;
    background: none;
    border: none;
    padding: 0;
}

/* =============================================================================
   Forms & Inputs
   ============================================================================= */

/* Location selection grid (profile edit) */
.location-grid {
    display: grid;
    gap: 0.5rem;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
}

@media screen and (min-width: 769px) {
    .location-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

.location-tag-checkbox {
    cursor: pointer;
}

.location-tag-checkbox input[type="checkbox"] {
    margin-right: 0.5rem;
}

/* Full width form controls */
.full-width {
    width: 100%;
}

/* =============================================================================
   Layout Utilities
   ============================================================================= */

/* Centered search form in navbar */
.navbar-search-centered {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    max-width: 500px;
    pointer-events: none;
}

.navbar-search-centered form {
    pointer-events: auto;
}

/* Navbar container with relative positioning */
.navbar-container {
    position: relative;
}

/* Brand icon - fixed width to prevent layout shift during loading */
#brandIcon {
    display: inline-block;
    width: 1.5em;
    text-align: center;
    margin-right: -0.25em;
}

/* Flexbox utilities for book cards */
.flex-column-min-height {
    display: flex;
    flex-direction: column;
    min-height: 150px;
}

.flex-auto-margin-top {
    margin-top: auto;
}

/* =============================================================================
   Mobile Responsive
   ============================================================================= */

@media screen and (max-width: 768px) {
    /* Cap book card width and center it in its column */
    .columns.is-multiline > .column > .card {
        max-width: 240px;
        margin-left: auto;
        margin-right: auto;
    }

    /* Book metadata layout on mobile */
    .book-meta {
        display: flex;
        flex-wrap: wrap;
    }

    .location-tags {
        display: block;
        width: 100%;
        margin-top: 0.25rem;
    }

    /* Reduce padding on mobile for book cards */
    .pb-0-mobile {
        padding-bottom: 0.75rem !important;
    }

    /* Profile page mobile adjustments */
    .box-mobile-flat {
        box-shadow: none;
        border: none;
        border-radius: 0;
        padding: 1rem 0;
    }

    .book-item-mobile {
        flex-direction: column;
        align-items: flex-start !important;
        gap: 0.5rem;
    }

    /* Allow book card columns to shrink for username overflow fix */
    .card-content .columns .column {
        min-width: 0;
    }
}
