/**
 * FishComp View Profile Enhanced Styles
 *
 * Comprehensive styling for user profile page including:
 * - Enhanced catch gallery grid
 * - Catch detail modal with social features
 * - Cheer/comment animations
 * - Dark mode support
 * - Mobile responsive design
 *
 * Following: /docs/STYLE-GUIDE.md
 * Version: 1.0
 * Date: 2025-12-30
 */

/* ========================================
   CSS Custom Properties (inherited from design system)
   ======================================== */
:root {
    /* Profile-specific colors */
    --vp-cheer-color: #e91e63;
    --vp-cheer-active: #c2185b;
    --vp-comment-bg: #f8f9fa;
    --vp-released-color: #28a745;
    --vp-overlay-bg: rgba(0, 0, 0, 0.85);
}

html.dark-mode {
    --vp-comment-bg: #2a2a2a;
    --vp-overlay-bg: rgba(30, 30, 46, 0.92);
}

/* Dark mode - Catch Detail Modal */
html.dark-mode #catchDetailModal .modal-content {
    background: #1e1e2d;
    color: #e9ecef;
}

html.dark-mode #catchDetailModal .modal-header {
    background: #252536;
    border-color: rgba(255, 255, 255, 0.1);
}

html.dark-mode #catchDetailModal .modal-body {
    background: #1e1e2d;
}

html.dark-mode .modal-catch-details {
    background: #252536;
}

/* Dark mode - lighter backdrop for all modals */
html.dark-mode .modal-backdrop {
    background-color: #1a1a2e;
}

html.dark-mode .modal-backdrop.show {
    opacity: 0.85;
}

/* ========================================
   Profile Header Enhancements
   ======================================== */
.profile-header-card {
    background: var(--fc-card-bg);
    border: 1px solid var(--fc-card-border);
    border-radius: var(--fc-radius-xl);
    transition: var(--fc-transition);
}

.profile-avatar-wrapper {
    position: relative;
}

.profile-avatar {
    width: 120px;
    height: 120px;
    object-fit: cover;
    border-radius: var(--fc-radius-circle);
    border: 4px solid var(--fc-card-bg);
    box-shadow: var(--fc-shadow-md);
    transition: var(--fc-transition);
}

.profile-avatar:hover {
    transform: scale(1.05);
}

/* ========================================
   Stats Cards
   ======================================== */
.profile-stat-card {
    background: var(--fc-card-bg);
    border: 1px solid var(--fc-card-border);
    border-radius: var(--fc-radius-xl);
    transition: var(--fc-transition);
    text-align: center;
}

.profile-stat-card:hover {
    box-shadow: var(--fc-shadow-md);
    transform: translateY(-2px);
}

.profile-stat-card .stat-icon {
    font-size: 1.5rem;
    color: var(--fc-primary);
    margin-bottom: 0.5rem;
}

.profile-stat-card .stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--fc-primary);
}

.profile-stat-card .stat-label {
    font-size: 0.8rem;
    color: var(--fc-text-muted);
    text-transform: uppercase;
    font-weight: 500;
}

/* ========================================
   Catch Gallery Grid
   ======================================== */
.catch-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
}

.catch-card {
    background: var(--fc-card-bg);
    border: 1px solid var(--fc-card-border);
    border-radius: var(--fc-radius-xl);
    overflow: hidden;
    transition: var(--fc-transition);
    cursor: pointer;
    position: relative;
}

.catch-card:hover {
    box-shadow: var(--fc-shadow-lg);
    transform: translateY(-4px);
}

.catch-card:focus {
    outline: 2px solid var(--fc-accent);
    outline-offset: 2px;
}

.catch-card-image-wrapper {
    position: relative;
    overflow: hidden;
    aspect-ratio: 4/3;
}

.catch-card-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.catch-card:hover .catch-card-image {
    transform: scale(1.05);
}

.catch-card-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.7) 0%, transparent 50%);
    opacity: 0;
    transition: var(--fc-transition);
    display: flex;
    align-items: flex-end;
    padding: 1rem;
}

.catch-card:hover .catch-card-overlay {
    opacity: 1;
}

.catch-card-overlay-text {
    color: white;
    font-size: 0.9rem;
    font-weight: 500;
}

.catch-card-body {
    padding: 1rem;
}

.catch-card-species {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--fc-text-dark);
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.catch-card-species .species-icon {
    color: var(--fc-primary);
}

.catch-card-details {
    font-size: 0.85rem;
    color: var(--fc-text-muted);
    line-height: 1.6;
}

.catch-card-details .detail-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.catch-card-details .detail-item i {
    width: 16px;
    text-align: center;
    color: var(--fc-primary);
}

.catch-card-footer {
    padding: 0.75rem 1rem;
    border-top: 1px solid var(--fc-card-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--fc-card-bg);
}

/* Released Badge */
.released-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.25rem 0.6rem;
    border-radius: var(--fc-radius-pill);
    font-size: 0.75rem;
    font-weight: 600;
    background: linear-gradient(135deg, #E8F5E9 0%, #C8E6C9 100%);
    color: #2E7D32;
}

html.dark-mode .released-badge {
    background: linear-gradient(135deg, #1B5E20 0%, #2E7D32 100%);
    color: #A5D6A7;
}

/* Social Stats on Card */
.catch-card-social {
    display: flex;
    gap: 1rem;
    font-size: 0.85rem;
    color: var(--fc-text-muted);
}

.catch-card-social .social-item {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.catch-card-social .social-item i {
    font-size: 0.9rem;
}

.catch-card-social .social-item.has-cheered i {
    color: var(--vp-cheer-color);
}

/* ========================================
   Empty State
   ======================================== */
.catch-gallery-empty {
    text-align: center;
    padding: 4rem 2rem;
    background: var(--fc-card-bg);
    border: 2px dashed var(--fc-card-border);
    border-radius: var(--fc-radius-xl);
}

.catch-gallery-empty-icon {
    font-size: 4rem;
    color: var(--fc-text-muted);
    margin-bottom: 1rem;
    opacity: 0.5;
}

.catch-gallery-empty-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--fc-text-dark);
    margin-bottom: 0.5rem;
}

.catch-gallery-empty-text {
    color: var(--fc-text-muted);
    font-size: 0.95rem;
}

/* ========================================
   Catch Detail Modal
   ======================================== */
#catchDetailModal .modal-content {
    border-radius: var(--fc-radius-xxl);
    border: none;
    overflow: hidden;
    max-height: 95vh;
}

#catchDetailModal .modal-header {
    border-bottom: 1px solid var(--fc-card-border);
    padding: 1rem 1.5rem;
    background: var(--fc-card-bg);
}

#catchDetailModal .modal-title {
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

#catchDetailModal .modal-body {
    padding: 0;
    background: var(--fc-card-bg);
}

.modal-catch-content {
    display: grid;
    grid-template-columns: 1fr 400px;
    min-height: 500px;
}

@media (max-width: 991px) {
    .modal-catch-content {
        grid-template-columns: 1fr;
    }
}

/* Modal Image Section */
.modal-catch-image-section {
    position: relative;
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 400px;
    max-height: 70vh;
    overflow: hidden;
}

.modal-catch-image {
    max-width: 100%;
    max-height: 70vh;
    object-fit: contain;
    cursor: default;
    transition: transform 0.3s ease;
}

.modal-catch-image:hover {
    transform: scale(1.02);
}

.modal-catch-image.zoomed {
    cursor: default;
    transform: scale(1.5);
}

/* Modal Details Section */
.modal-catch-details {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    overflow-y: auto;
    max-height: 70vh;
}

@media (max-width: 991px) {
    .modal-catch-details {
        max-height: none;
    }
}

.modal-catch-species {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.modal-catch-species-icon {
    width: 50px;
    height: 50px;
    border-radius: var(--fc-radius-lg);
    object-fit: cover;
    background: var(--fc-accent-light);
}

.modal-catch-species-info h4 {
    font-weight: 700;
    font-size: 1.25rem;
    color: var(--fc-text-dark);
    margin: 0;
}

.modal-catch-species-info .scientific-name {
    font-size: 0.85rem;
    font-style: italic;
    color: var(--fc-text-muted);
}

/* Modal Stats Grid */
.modal-catch-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

.modal-stat-item {
    background: var(--fc-accent-light);
    padding: 1rem;
    border-radius: var(--fc-radius-lg);
    text-align: center;
}

.modal-stat-item .stat-icon {
    font-size: 1.25rem;
    color: var(--fc-primary);
    margin-bottom: 0.5rem;
}

.modal-stat-item .stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--fc-text-dark);
}

.modal-stat-item .stat-label {
    font-size: 0.75rem;
    color: var(--fc-text-muted);
    text-transform: uppercase;
}

html.dark-mode .modal-stat-item {
    background: rgba(0, 195, 255, 0.1);
}

/* Modal Info List */
.modal-catch-info-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.modal-catch-info-list li {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--fc-card-border);
}

.modal-catch-info-list li:last-child {
    border-bottom: none;
}

.modal-catch-info-list li i {
    width: 24px;
    text-align: center;
    color: var(--fc-primary);
    font-size: 1rem;
}

.modal-catch-info-list li .info-label {
    font-weight: 500;
    color: var(--fc-text-muted);
    min-width: 80px;
}

.modal-catch-info-list li .info-value {
    color: var(--fc-text-dark);
}

/* Modal Notes */
.modal-catch-notes {
    background: var(--vp-comment-bg);
    padding: 1rem;
    border-radius: var(--fc-radius-lg);
    border-left: 4px solid var(--fc-primary);
}

.modal-catch-notes-title {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--fc-text-muted);
    text-transform: uppercase;
    margin-bottom: 0.5rem;
}

.modal-catch-notes-content {
    color: var(--fc-text-dark);
    font-size: 0.95rem;
    line-height: 1.6;
}

/* ========================================
   Social Actions (Cheer & Comment)
   ======================================== */
.social-actions {
    display: flex;
    gap: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--fc-card-border);
}

.social-action-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    border: 1px solid var(--fc-card-border);
    border-radius: var(--fc-radius-md);
    background: var(--fc-card-bg);
    color: var(--fc-text-muted);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--fc-transition);
}

.social-action-btn:hover {
    border-color: var(--fc-primary);
    color: var(--fc-primary);
}

.social-action-btn:focus {
    outline: 2px solid var(--fc-accent);
    outline-offset: 2px;
}

.social-action-btn.cheer-btn:hover,
.social-action-btn.cheer-btn.cheered {
    border-color: var(--vp-cheer-color);
    color: var(--vp-cheer-color);
    background: rgba(233, 30, 99, 0.08);
}

.social-action-btn.cheer-btn.cheered i {
    animation: cheerPulse 0.4s ease;
}

@keyframes cheerPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.3); }
    100% { transform: scale(1); }
}

/* Cheer animation burst */
.cheer-burst {
    position: absolute;
    pointer-events: none;
}

.cheer-burst::before,
.cheer-burst::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    animation: burstOut 0.6s ease-out forwards;
}

@keyframes burstOut {
    0% {
        transform: scale(0);
        opacity: 1;
        box-shadow: 0 0 0 0 var(--vp-cheer-color);
    }
    100% {
        transform: scale(2);
        opacity: 0;
        box-shadow: 0 0 20px 10px transparent;
    }
}

/* ========================================
   Comments Section
   ======================================== */
.comments-section {
    border-top: 1px solid var(--fc-card-border);
    padding-top: 1rem;
}

.comments-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.comments-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--fc-text-muted);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.comments-count {
    background: var(--fc-primary);
    color: white;
    font-size: 0.7rem;
    padding: 0.15rem 0.5rem;
    border-radius: var(--fc-radius-pill);
}

.comments-list {
    max-height: 300px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding-right: 0.5rem;
}

/* Custom scrollbar for comments */
.comments-list::-webkit-scrollbar {
    width: 6px;
}

.comments-list::-webkit-scrollbar-track {
    background: var(--fc-card-border);
    border-radius: 3px;
}

.comments-list::-webkit-scrollbar-thumb {
    background: var(--fc-text-muted);
    border-radius: 3px;
}

.comments-list::-webkit-scrollbar-thumb:hover {
    background: var(--fc-primary);
}

/* Single Comment */
.comment-item {
    display: flex;
    gap: 0.75rem;
}

.comment-avatar {
    width: 36px;
    height: 36px;
    border-radius: var(--fc-radius-circle);
    object-fit: cover;
    flex-shrink: 0;
}

.comment-content {
    flex: 1;
    background: var(--vp-comment-bg);
    padding: 0.75rem 1rem;
    border-radius: var(--fc-radius-lg);
    position: relative;
}

.comment-author {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--fc-text-dark);
    margin-bottom: 0.25rem;
}

.comment-text {
    font-size: 0.9rem;
    color: var(--fc-text-dark);
    line-height: 1.5;
    word-break: break-word;
}

.comment-time {
    font-size: 0.75rem;
    color: var(--fc-text-muted);
    margin-top: 0.35rem;
}

/* Comment Form */
.comment-form {
    display: flex;
    gap: 0.75rem;
    margin-top: 1rem;
}

.comment-form .comment-input-wrapper {
    flex: 1;
    position: relative;
}

.comment-form textarea {
    width: 100%;
    min-height: 44px;
    max-height: 120px;
    padding: 0.75rem 1rem;
    border: 1px solid var(--fc-card-border);
    border-radius: var(--fc-radius-lg);
    background: var(--fc-card-bg);
    color: var(--fc-text-dark);
    font-size: 0.9rem;
    resize: vertical;
    transition: var(--fc-transition);
}

.comment-form textarea:focus {
    outline: none;
    border-color: var(--fc-primary);
    box-shadow: 0 0 0 3px rgba(2, 103, 161, 0.15);
}

.comment-form textarea::placeholder {
    color: var(--fc-text-muted);
}

.comment-form .submit-btn {
    padding: 0.75rem 1rem;
    background: var(--fc-primary);
    color: white;
    border: none;
    border-radius: var(--fc-radius-md);
    cursor: pointer;
    transition: var(--fc-transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.comment-form .submit-btn:hover {
    background: var(--fc-primary-dark);
}

.comment-form .submit-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Login prompt for comments */
.comment-login-prompt {
    text-align: center;
    padding: 1.5rem;
    background: var(--vp-comment-bg);
    border-radius: var(--fc-radius-lg);
}

.comment-login-prompt p {
    color: var(--fc-text-muted);
    margin-bottom: 0.75rem;
}

.comment-login-prompt a {
    color: var(--fc-primary);
    font-weight: 500;
}

/* ========================================
   Cheers List (Modal Popup)
   ======================================== */
.cheers-list {
    max-height: 300px;
    overflow-y: auto;
}

.cheer-user-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    border-radius: var(--fc-radius-md);
    transition: var(--fc-transition);
}

.cheer-user-item:hover {
    background: var(--fc-accent-light);
}

.cheer-user-avatar {
    width: 40px;
    height: 40px;
    border-radius: var(--fc-radius-circle);
    object-fit: cover;
}

.cheer-user-info {
    flex: 1;
}

.cheer-user-name {
    font-weight: 600;
    color: var(--fc-text-dark);
}

.cheer-user-time {
    font-size: 0.75rem;
    color: var(--fc-text-muted);
}

/* ========================================
   Loading States
   ======================================== */
.loading-skeleton {
    background: linear-gradient(90deg,
        var(--fc-card-border) 25%,
        var(--fc-card-bg) 50%,
        var(--fc-card-border) 75%
    );
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--fc-radius-md);
}

@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

.loading-overlay {
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

html.dark-mode .loading-overlay {
    background: rgba(0, 0, 0, 0.8);
}

.spinner-icon {
    animation: spin 1s linear infinite;
    font-size: 1.5rem;
    color: var(--fc-primary);
}

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

/* ========================================
   Image Full View Modal (Zoom)
   ======================================== */
#imageZoomModal {
    z-index: 1070 !important;
}

#imageZoomModal .modal-dialog {
    max-width: 100vw;
    margin: 0;
}

#imageZoomModal .modal-content {
    background: rgba(0, 0, 0, 0.95);
    border: none;
    min-height: 100vh;
}

#imageZoomModal .modal-body {
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    cursor: pointer;
}

#imageZoomModal .zoom-image {
    max-width: 95vw;
    max-height: 90vh;
    object-fit: contain;
    border-radius: var(--fc-radius-lg);
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.5);
    cursor: default;
}

#imageZoomModal .btn-close {
    position: fixed;
    top: 1.5rem;
    right: 1.5rem;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    padding: 0.75rem;
    opacity: 1;
    z-index: 1080;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, transform 0.2s;
}

#imageZoomModal .btn-close:hover {
    background: white;
    transform: scale(1.1);
}

/* ========================================
   Section Headers
   ======================================== */
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 0.75rem;
    margin-bottom: 1.5rem;
    border-bottom: 2px solid var(--fc-card-border);
}

.section-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--fc-text-dark);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.section-title i {
    color: var(--fc-primary);
}

/* ========================================
   Responsive Styles
   ======================================== */
@media (max-width: 767px) {
    .catch-gallery {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }

    .catch-card-body {
        padding: 0.75rem;
    }

    .catch-card-species {
        font-size: 0.95rem;
    }

    .catch-card-details {
        font-size: 0.8rem;
    }

    .catch-card-footer {
        padding: 0.5rem 0.75rem;
        flex-direction: column;
        gap: 0.5rem;
    }

    .modal-catch-content {
        grid-template-columns: 1fr;
    }

    .modal-catch-image-section {
        min-height: 250px;
        max-height: 40vh;
    }

    .modal-catch-details {
        padding: 1rem;
    }

    .modal-catch-stats {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }

    .social-actions {
        flex-direction: row;
        gap: 0.75rem;
    }

    .comments-list {
        max-height: 200px;
    }

    .profile-avatar {
        width: 80px;
        height: 80px;
    }
}

@media (max-width: 480px) {
    .catch-gallery {
        grid-template-columns: 1fr;
    }
}

/* ========================================
   Accessibility
   ======================================== */
@media (prefers-reduced-motion: reduce) {
    .catch-card,
    .catch-card-image,
    .social-action-btn,
    .modal-catch-image,
    .cheer-btn.cheered i {
        transition: none;
        animation: none;
    }

    .catch-card:hover .catch-card-image {
        transform: none;
    }

    .loading-skeleton {
        animation: none;
        background: var(--fc-card-border);
    }
}

/* Focus visible for keyboard navigation */
.catch-card:focus-visible,
.social-action-btn:focus-visible,
.comment-form textarea:focus-visible,
.comment-form .submit-btn:focus-visible {
    outline: 3px solid var(--fc-accent);
    outline-offset: 2px;
}

/* High contrast mode */
@media (prefers-contrast: high) {
    .catch-card,
    .profile-stat-card,
    .modal-stat-item,
    .comment-content {
        border-width: 2px;
    }

    .released-badge {
        border: 2px solid currentColor;
    }
}

/* Smooth loading animations */
.catch-card {
    transition: opacity 0.3s ease-out, transform 0.3s ease-out;
}

.catch-card-loading {
    opacity: 0;
    transform: translateY(20px);
}

/* Loading indicator */
#loadMoreBtn:disabled {
    pointer-events: none;
}

/* Skeleton loading placeholder (optional future enhancement) */
.catch-card-skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Dark mode adjustments */
body.dark-mode .catch-card-skeleton {
    background: linear-gradient(90deg, #2d2d2d 25%, #3d3d3d 50%, #2d2d2d 75%);
    background-size: 200% 100%;
}
