/* modal overlay and shared styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(12px) saturate(180%);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    overflow-y: auto;
    animation: modalFadeIn 0.3s ease-out;
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.modal-box {
    background: var(--panel-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 480px;
    max-height: calc(100vh - 4rem);
    position: relative;
    box-shadow: var(--shadow-medium);
    display: flex;
    flex-direction: column;
    animation: modalSlideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalSlideUp {
    from {
        transform: translateY(40px) scale(0.92);
        filter: blur(10px);
        opacity: 0;
    }

    to {
        transform: translateY(0) scale(1);
        filter: blur(0);
        opacity: 1;
    }
}

.modal-box.large {
    max-width: 900px;
}

.modal-photo {
    width: 100%;
    max-height: 400px;
    object-fit: contain;
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    margin: 1.5rem 0;
    padding: 1rem;
}

.modal-header {
    padding: 1.5rem 2rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.modal-header h3 {
    font-family: var(--font-mono);
    font-size: 0.9rem;
}

.close-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
}

.modal-body {
    padding: 2.5rem 2rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    overflow-y: auto;
    flex-grow: 1;
}

.modal-body .btn-primary {
    margin-top: 1rem;
}

/* responsive */
@media (max-width: 900px) {
    .form-row {
        grid-template-columns: 1fr;
    }
}



.status-msg {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    margin-top: 1rem;
    color: var(--accent-color);
}

.tips-panel .list-view {
    gap: 1.25rem;
}

.tips-list .tip-card {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    padding: 1rem;
    border: 1px solid rgba(0, 0, 0, 0.05);
    background: #ffffff;
    border-radius: var(--radius-md);
}

.tip-card strong {
    font-size: 0.9rem;
}

.tip-card p {
    font-size: 0.8rem;
    color: var(--muted-text);
    line-height: 1.4;
}

.tip-card span {
    font-family: var(--font-mono);
    font-size: 0.65rem;
    color: var(--accent-color);
    letter-spacing: 0.1em;
}

.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
    color: var(--text-color);
    font-family: var(--font-mono);
    letter-spacing: 0.2em;
    font-size: 0.8rem;
    font-weight: 600;
    z-index: 9999;
    opacity: 1;
    transition: opacity 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.loading-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.spinner {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid rgba(0, 0, 0, 0.05);
    border-top-color: var(--accent-color);
    animation: spin 0.6s linear infinite;
}

.loading-overlay.success-state .spinner {
    display: none;
}

.loading-overlay.success-state #loadingMessage {
    color: var(--accent-color);
}

.loading-overlay.success-state::before {
    content: "\2713";
    font-size: 3rem;
    color: var(--accent-color);
    margin-bottom: 0.5rem;
    animation: scaleIn 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.loading-overlay.error-state .spinner {
    display: none;
}

.loading-overlay.error-state #loadingMessage {
    color: #e53e3e;
}

.loading-overlay.error-state::before {
    content: "\2717";
    font-size: 3rem;
    color: #e53e3e;
    margin-bottom: 0.5rem;
    animation: scaleIn 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes scaleIn {
    from {
        transform: scale(0);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.search-active .filter-ui,
.search-active .fp-visual-bar,
.search-active .fp-topsearch,
.search-active .results-meta {
    display: none !important;
}



/* fullscreen item detail modal */
.item-detail-modal {
    background: var(--modal-bg, var(--panel-bg));
    color: var(--modal-fg, var(--text-color));
    border: 1px solid rgba(0, 0, 0, 0.08);
    transition: background-color 0.3s ease, color 0.3s ease;
    max-height: 85vh !important;
}

.item-modal-content {
    display: flex;
    flex-direction: column;
    height: 100%;
    width: 100%;
    overflow: hidden;
    border-radius: var(--radius-lg);
}

.item-modal-media {
    position: relative;
    width: 100%;
    height: 280px;
    background: rgba(0, 0, 0, 0.03);
    flex-shrink: 0;
}

.item-modal-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.item-modal-media svg,
#modalPlaceholder {
    width: 100%;
    height: 100%;
    display: block;
    position: relative;
}

.item-modal-media .fp-photo-label {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-display);
    font-size: 2.5rem;
    font-weight: 800;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    opacity: 0.15;
    pointer-events: none;
}

.item-modal-details {
    padding: 2rem 1.5rem;
    overflow-y: auto;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.item-modal-category {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    opacity: 0.65;
    margin-bottom: 0.5rem;
    display: inline-block;
}

#modalTitle {
    font-family: var(--font-display);
    font-size: 1.75rem;
    font-weight: 800;
    line-height: 1.25;
    margin: 0 0 1rem 0;
}

.item-modal-divider {
    border: none;
    border-top: 1px solid rgba(0, 0, 0, 0.08);
    margin: 1.25rem 0;
    width: 100%;
}

.item-modal-section {
    margin-bottom: 1.25rem;
}

.section-label {
    font-family: var(--font-mono);
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    opacity: 0.5;
    margin-bottom: 0.25rem;
    display: block;
}

.item-modal-val {
    font-size: 0.95rem;
    font-weight: 500;
    line-height: 1.4;
    margin: 0;
}

.item-modal-val.desc-text {
    font-weight: 400;
    opacity: 0.85;
}

.item-modal-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
    margin-top: 0.5rem;
}

.item-modal-actions {
    display: flex;
    gap: 1rem;
    margin-top: auto;
    padding-top: 1.5rem;
}

.item-modal-actions .btn {
    flex: 1;
    padding: 0.8rem 1.25rem;
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    border-radius: var(--radius-md);
    text-transform: uppercase;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s, filter 0.2s;
}

.item-modal-actions .btn:hover {
    transform: translateY(-2px);
    filter: brightness(0.95);
}

.modal-close-pill {
    position: absolute;
    top: 15px;
    left: 15px;
    width: 36px;
    height: 36px;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    color: var(--text-color) !important;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 50%;
    padding: 0;
    cursor: pointer;
    z-index: 10;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    transition: transform 0.2s, background-color 0.2s, color 0.2s, border-color 0.2s, box-shadow 0.2s;
}

.modal-close-pill:hover {
    background: #ffffff;
    color: var(--accent-color) !important;
    border-color: rgba(0, 0, 0, 0.15);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
    transform: scale(1.08);
}

/* desktop split layout */
@media (min-width: 768px) {
    .modal-box.large.item-detail-modal {
        max-width: 1000px;
        width: 90%;
        height: 580px;
    }

    .item-modal-content {
        flex-direction: row;
    }

    .item-modal-media {
        width: 50%;
        height: 100%;
    }

    .item-modal-details {
        width: 50%;
        height: 100%;
        padding: 3rem;
    }

    #modalTitle {
        font-size: 2.25rem;
    }

    .modal-close-pill {
        top: 20px;
        left: 20px;
    }
}