/* Custom styles */
body {
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.nav-btn {
    padding: 0.5rem;
    transition: transform 0.2s;
    -webkit-tap-highlight-color: transparent;
}

.nav-btn:active {
    transform: scale(0.95);
}

.fact-card {
    background: white;
    border-radius: 1rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    padding: 1.5rem;
    margin: 1rem;
}

.vote-btn {
    width: 3rem;
    height: 3rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    transition: transform 0.2s, background-color 0.2s;
    -webkit-tap-highlight-color: transparent;
}

.vote-btn:active {
    transform: scale(0.9);
}

/* Loading animation */
@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-spinner {
    animation: spin 1s linear infinite;
}

/* Fact fade-in */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.5s ease-out;
}

/* Header sits below the iOS status bar / notch */
#app-header {
    padding-top: env(safe-area-inset-top);
}

/* Bottom bar clears the iOS home indicator */
#bottom-bar {
    padding-bottom: env(safe-area-inset-bottom);
    background: #f9fafb; /* gray-50, so the safe-area gap matches the links row */
}

/* Bottom nav: active (selected) tab */
.nav-btn {
    color: #6b7280; /* gray-500 */
    transition: transform 0.2s, color 0.2s;
}
.nav-btn.active {
    color: #2563eb; /* blue-600 */
}

/* Reaction feedback: pop the tapped vote/save/share button, and dim while
   the next fact is loading so it can't be double-tapped. */
.vote-btn.selected {
    transform: scale(1.18);
}
.vote-btn:disabled {
    opacity: 0.45;
    pointer-events: none;
}

/* "Open article" book button shown right after the fact text */
.read-btn {
    -webkit-tap-highlight-color: transparent;
    transition: transform 0.15s, background-color 0.15s;
}
.read-btn:active {
    transform: scale(0.9);
}

/* Search suggestions dropdown */
#search-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 30;
    margin-top: 0.25rem;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1);
    overflow: hidden;
}

#search-suggestions .suggestion-item {
    display: block;
    width: 100%;
    text-align: left;
    padding: 0.75rem 1rem;
    font-size: 1rem;
    color: #1f2937;
    background: white;
    border: none;
    border-bottom: 1px solid #f3f4f6;
    cursor: pointer;
}

#search-suggestions .suggestion-item:last-child {
    border-bottom: none;
}

#search-suggestions .suggestion-item:hover,
#search-suggestions .suggestion-item:active {
    background: #eff6ff;
}

/* Saved | Votes segmented toggle */
.saved-toggle {
    display: flex;
    background: #e5e7eb;
    border-radius: 0.75rem;
    padding: 0.25rem;
    margin-bottom: 1rem;
}

.saved-toggle .saved-tab {
    flex: 1;
    padding: 0.5rem 0;
    border: none;
    border-radius: 0.5rem;
    background: transparent;
    font-size: 1rem;
    font-weight: 600;
    color: #6b7280;
    cursor: pointer;
}

.saved-toggle .saved-tab.active {
    background: white;
    color: #1f2937;
    box-shadow: 0 1px 3px rgb(0 0 0 / 0.15);
}

/* My Votes cards */
.vote-card .vote-badge {
    font-size: 1.25rem;
    margin-right: 0.5rem;
    float: left;
}

.vote-card .vote-action {
    position: absolute;
    top: 0.5rem;
    background: none;
    border: none;
    cursor: pointer;
    color: #9ca3af;
    font-size: 1.1rem;
    line-height: 1;
}

.vote-card .vote-flip {
    right: 2.25rem;
}

.vote-card .vote-remove {
    right: 0.5rem;
    font-size: 1.4rem;
}

.vote-card .vote-remove:hover {
    color: #ef4444;
}

/* Fact-card images: anchor the object-cover crop to the top so portraits
   never lose the top of the head (default center crop cut faces off). */
.card-img {
    object-position: top;
}
