/**
 * Public Catch Modal - Shared Styles
 * Used by both /log SPA and base site pages
 */

/* CSS Variables (can be overridden) */
:root {
    --pcm-brand: #678594;
    --pcm-accent: #9dce97;
    --pcm-bg-dark: #0d1117;
    --pcm-surface: #161b22;
    --pcm-border: #30363d;
    --pcm-border-subtle: rgba(255, 255, 255, 0.06);
    --pcm-text-light: #f2f2f2;
    --pcm-text-muted: #8b949e;
    --pcm-danger: #f85149;
}

/* Modal Overlay */
.public-catch-modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    z-index: 10000;
    align-items: center;
    justify-content: center;
    padding: 20px;
    overflow-y: auto;
}

.public-catch-modal-overlay.active {
    display: flex;
}

/* Modal Container */
.public-catch-modal {
    background: var(--pcm-surface);
    border-radius: 16px;
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    border: 1px solid var(--pcm-border);
    /* Firefox scrollbar */
    scrollbar-width: thin;
    scrollbar-color: var(--pcm-border) var(--pcm-bg-dark);
}

/* Custom scrollbar for modals (Webkit/Chrome/Safari) */
.public-catch-modal::-webkit-scrollbar {
    width: 8px;
}

.public-catch-modal::-webkit-scrollbar-track {
    background: var(--pcm-bg-dark);
    border-radius: 4px;
}

.public-catch-modal::-webkit-scrollbar-thumb {
    background: var(--pcm-border);
    border-radius: 4px;
}

.public-catch-modal::-webkit-scrollbar-thumb:hover {
    background: var(--pcm-text-muted);
}

.public-catch-modal-small {
    max-width: 400px;
}

/* Modal Header */
.public-catch-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--pcm-border);
}

.public-catch-modal-header h3 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--pcm-text-light);
}

.public-catch-modal-close {
    background: none;
    border: none;
    font-size: 24px;
    color: var(--pcm-text-muted);
    cursor: pointer;
    padding: 0;
    line-height: 1;
    transition: color 0.2s;
}

.public-catch-modal-close:hover {
    color: var(--pcm-text-light);
}

/* Modal Body */
.public-catch-modal-body {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
    /* Firefox scrollbar */
    scrollbar-width: thin;
    scrollbar-color: var(--pcm-border) var(--pcm-bg-dark);
}

.public-catch-modal-body::-webkit-scrollbar {
    width: 8px;
}

.public-catch-modal-body::-webkit-scrollbar-track {
    background: var(--pcm-bg-dark);
    border-radius: 4px;
}

.public-catch-modal-body::-webkit-scrollbar-thumb {
    background: var(--pcm-border);
    border-radius: 4px;
}

.public-catch-modal-body::-webkit-scrollbar-thumb:hover {
    background: var(--pcm-text-muted);
}

/* Modal Footer */
.public-catch-modal-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--pcm-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.public-catch-modal-footer-right {
    display: flex;
    justify-content: flex-end;
}

/* Buttons */
.public-catch-modal-btn {
    background: #21262d;
    color: var(--pcm-text-light);
    border: 1px solid var(--pcm-border);
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    text-align: center;
    transition: background 0.2s, border-color 0.2s;
}

.public-catch-modal-btn:hover {
    background: var(--pcm-border);
    border-color: #484f58;
}

.public-catch-modal-btn-primary {
    background: var(--pcm-accent);
    color: var(--pcm-bg-dark);
    border-color: var(--pcm-accent);
}

.public-catch-modal-btn-primary:hover {
    background: #6bb563;
    border-color: #6bb563;
}

/* Loading State */
.public-catch-modal-loading {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 60px 20px;
}

.public-catch-modal-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--pcm-border);
    border-top-color: var(--pcm-accent);
    border-radius: 50%;
    animation: publicCatchModalSpin 0.8s linear infinite;
}

@keyframes publicCatchModalSpin {
    to { transform: rotate(360deg); }
}

/* Error State */
.public-catch-modal-error {
    background: rgba(248, 81, 73, 0.1);
    border: 1px solid rgba(248, 81, 73, 0.3);
    color: var(--pcm-danger);
    padding: 16px;
    border-radius: 8px;
    text-align: center;
}

/* User Header */
.public-catch-user {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--pcm-border-subtle);
}

.public-catch-user.clickable-user {
    cursor: pointer;
}

.public-catch-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--pcm-brand);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.2rem;
    overflow: hidden;
    flex-shrink: 0;
}

.public-catch-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.public-catch-avatar ion-icon {
    font-size: 1.2rem;
}

.public-catch-user-info {
    flex: 1;
}

.public-catch-username {
    font-weight: 600;
    color: var(--pcm-text-light);
    display: flex;
    align-items: center;
    gap: 6px;
}

.public-catch-time {
    font-size: 0.85rem;
    color: var(--pcm-text-muted);
}

/* Pro Badge */
.pro-chip {
    background: linear-gradient(135deg, #f8b500 0%, #e09200 100%);
    color: #000;
    font-size: 0.65rem;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 4px;
    text-transform: uppercase;
}

/* Photo */
.view-catch-photo {
    width: 100%;
    max-height: 300px;
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 20px;
    background: var(--pcm-bg-dark);
    display: flex;
    align-items: center;
    justify-content: center;
}

.view-catch-photo img {
    width: 100%;
    max-height: 300px;
    object-fit: contain;
}

.view-catch-photo-placeholder {
    padding: 40px;
    color: var(--pcm-text-muted);
    text-align: center;
}

.view-catch-photo-placeholder ion-icon {
    font-size: 3rem;
    margin-bottom: 8px;
    display: block;
}

/* Species Header */
.view-catch-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.view-catch-species {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--pcm-text-light);
}

/* PB Badge */
.pb-badge {
    background: linear-gradient(135deg, #f8b500 0%, #e09200 100%);
    color: #000;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.pb-badge ion-icon {
    font-size: 0.9rem;
}

/* Meta Info */
.view-catch-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--pcm-border-subtle);
}

.view-catch-meta-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.9rem;
    color: var(--pcm-text-muted);
}

.view-catch-meta-item ion-icon {
    color: var(--pcm-brand);
    font-size: 1rem;
}

.view-catch-meta-item strong {
    color: var(--pcm-text-light);
}

/* Location */
.view-catch-location {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px;
    background: var(--pcm-bg-dark);
    border-radius: 8px;
    margin-bottom: 16px;
    cursor: default;
    transition: background 0.2s;
}

.view-catch-location:hover {
    background: rgba(255, 255, 255, 0.05);
}

.view-catch-location.clickable {
    cursor: pointer;
}

.view-catch-location.clickable:hover {
    background: rgba(157, 206, 151, 0.1);
}

.view-catch-location ion-icon {
    color: var(--pcm-brand);
    font-size: 1.2rem;
    flex-shrink: 0;
}

.view-catch-location-text {
    flex: 1;
}

.view-catch-location-name {
    font-weight: 500;
    color: var(--pcm-text-light);
}

.view-catch-location-date {
    font-size: 0.8rem;
    color: var(--pcm-text-muted);
}

.view-session-link {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.85rem;
    color: var(--pcm-brand);
    white-space: nowrap;
}

.view-session-link ion-icon {
    font-size: 1rem;
    color: var(--pcm-brand);
}

/* Sections */
.view-catch-section {
    margin-bottom: 16px;
}

.view-catch-section-title {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--pcm-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.view-catch-section-content {
    font-size: 0.95rem;
    color: var(--pcm-text-light);
    line-height: 1.5;
}

/* Details Grid */
.view-catch-details-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.view-catch-detail {
    background: var(--pcm-bg-dark);
    border-radius: 8px;
    padding: 12px;
}

.view-catch-detail-label {
    font-size: 0.75rem;
    color: var(--pcm-text-muted);
    margin-bottom: 4px;
}

.view-catch-detail-value {
    font-size: 0.95rem;
    color: var(--pcm-text-light);
}

/* Footer Actions */
.public-catch-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

.btn-like {
    display: flex;
    align-items: center;
    gap: 6px;
    background: transparent;
    border: none;
    color: var(--pcm-text-light);
    font-size: 1rem;
    cursor: pointer;
    padding: 8px 12px;
    border-radius: 20px;
    transition: all 0.2s;
}

.btn-like:hover {
    background: rgba(255, 255, 255, 0.1);
}

.btn-like.liked {
    color: #ff6b6b;
}

.btn-like.liked ion-icon {
    color: #ff6b6b;
}

.btn-like ion-icon {
    font-size: 1.3rem;
}

.comment-count-display {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--pcm-text-muted);
    font-size: 1rem;
}

.comment-count-display ion-icon {
    font-size: 1.2rem;
}

/* Comments Section */
.comments-section {
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--pcm-border-subtle);
}

.comments-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.comments-header h4 {
    margin: 0;
    font-size: 1rem;
    color: var(--pcm-text-light);
}

.comments-list {
    max-height: 250px;
    overflow-y: auto;
    margin-bottom: 16px;
    /* Firefox scrollbar */
    scrollbar-width: thin;
    scrollbar-color: var(--pcm-border) var(--pcm-bg-dark);
}

.comments-list::-webkit-scrollbar {
    width: 6px;
}

.comments-list::-webkit-scrollbar-track {
    background: var(--pcm-bg-dark);
    border-radius: 3px;
}

.comments-list::-webkit-scrollbar-thumb {
    background: var(--pcm-border);
    border-radius: 3px;
}

.comments-list::-webkit-scrollbar-thumb:hover {
    background: var(--pcm-text-muted);
}

.comments-empty {
    text-align: center;
    color: var(--pcm-text-muted);
    padding: 20px;
    font-size: 0.9rem;
}

.comment-item {
    padding: 12px 0;
    border-bottom: 1px solid var(--pcm-border-subtle);
}

.comment-item:last-child {
    border-bottom: none;
}

.comment-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 6px;
}

.comment-author {
    display: flex;
    align-items: center;
    gap: 8px;
}

.comment-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--pcm-brand);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 0.7rem;
    overflow: hidden;
}

.comment-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.comment-username {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--pcm-text-light);
}

.comment-time {
    font-size: 0.75rem;
    color: var(--pcm-text-muted);
}

.comment-text {
    font-size: 0.9rem;
    color: var(--pcm-text-light);
    line-height: 1.4;
    padding-left: 32px;
}

.comment-input-row {
    display: flex;
    gap: 8px;
    align-items: center;
}

.comment-input-row input {
    flex: 1;
    background: var(--pcm-bg-dark);
    border: 1px solid var(--pcm-border);
    border-radius: 20px;
    padding: 10px 16px;
    color: var(--pcm-text-light);
    font-size: 0.9rem;
}

.comment-input-row input:focus {
    outline: none;
    border-color: var(--pcm-brand);
}

.comment-input-row input::placeholder {
    color: var(--pcm-text-muted);
}

.btn-send-comment {
    background: var(--pcm-accent);
    border: none;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--pcm-bg-dark);
    transition: opacity 0.2s;
}

.btn-send-comment:hover {
    opacity: 0.9;
}

.btn-send-comment ion-icon {
    font-size: 1.1rem;
}

/* Members Only Modal */
.members-only-body {
    text-align: center;
    padding: 40px 20px;
}

.members-only-icon {
    color: var(--pcm-accent);
    margin-bottom: 20px;
}

.members-only-icon ion-icon {
    font-size: 64px;
}

.members-only-body h4 {
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--pcm-text-light);
    margin: 0 0 12px;
}

.members-only-body p {
    color: var(--pcm-text-muted);
    font-size: 0.95rem;
    line-height: 1.5;
    margin: 0 0 24px;
}

/* Mobile Responsive */
@media (max-width: 600px) {
    .public-catch-modal-overlay {
        padding: 0;
        align-items: flex-end;
    }

    .public-catch-modal {
        max-width: 100%;
        max-height: 95vh;
        border-radius: 16px 16px 0 0;
    }

    .view-catch-details-grid {
        grid-template-columns: 1fr;
    }
}
