/* ===================================
   PETBOOK - Estilos Principales
   =================================== */

/* Reset y Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-size: 15px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Skeleton Loaders */
.skeleton-loader {
    animation: pulse 1.5s ease-in-out infinite;
}

.skeleton-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(90deg, var(--bg-tertiary) 25%, var(--bg-hover) 50%, var(--bg-tertiary) 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s ease-in-out infinite;
}

.skeleton-line {
    height: 12px;
    margin-bottom: 10px;
    border-radius: 4px;
    background: linear-gradient(90deg, var(--bg-tertiary) 25%, var(--bg-hover) 50%, var(--bg-tertiary) 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s ease-in-out infinite;
}

.skeleton-image {
    width: 100%;
    height: 300px;
    border-radius: 8px;
    background: linear-gradient(90deg, var(--bg-tertiary) 25%, var(--bg-hover) 50%, var(--bg-tertiary) 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s ease-in-out infinite;
}

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

/* Navbar */
.navbar {
    min-height: 56px;
    height: auto;
}

.navbar-brand {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.navbar-brand img {
    object-fit: contain;
    max-height: 40px;
}

.navbar .btn {
    width: 40px;
    height: 40px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.navbar .nav-btn {
    position: relative;
}

.navbar .gap-1 {
    gap: 0.25rem !important;
}

.navbar .gap-sm-2 {
    gap: 0.5rem !important;
}

.navbar .flex-nowrap {
    flex-wrap: nowrap !important;
}

/* Search Bar */
.input-group-text {
    background-color: transparent;
}

#searchInput {
    padding-left: 0;
}

#searchInput:focus {
    background-color: var(--bg-primary);
    box-shadow: none;
}

/* Sidebar */
aside {
    scrollbar-width: thin;
}

aside::-webkit-scrollbar {
    width: 6px;
}

aside .nav-link {
    padding: 0.75rem 1rem;
    margin-bottom: 0.25rem;
    font-size: 0.95rem;
}

aside .nav-link i {
    width: 24px;
}

/* Card de Publicación */
.post-card {
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 1rem;
}

.post-header {
    display: flex;
    align-items: center;
    padding: 1rem;
}

.post-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
}

.post-info {
    flex: 1;
    margin-left: 0.75rem;
}

.post-author {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-primary);
    text-decoration: none;
}

.post-author:hover {
    text-decoration: underline;
}

.post-time {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.post-content {
    padding: 0 1rem 1rem;
    font-size: 0.95rem;
    line-height: 1.5;
    word-wrap: break-word;
}

.post-content p {
    margin-bottom: 0.5rem;
}

.post-hashtag {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
}

.post-hashtag:hover {
    text-decoration: underline;
}

.post-media {
    width: 100%;
    max-height: 600px;
    object-fit: cover;
    cursor: pointer;
}

.post-media-grid {
    display: grid;
    gap: 2px;
}

.post-media-grid.grid-2 {
    grid-template-columns: repeat(2, 1fr);
}

.post-media-grid.grid-3 {
    grid-template-columns: repeat(2, 1fr);
}

.post-media-grid.grid-3 > :first-child {
    grid-column: span 2;
}

.post-media-grid.grid-4 {
    grid-template-columns: repeat(2, 1fr);
}

.post-actions {
    padding: 0.5rem 1rem;
    display: flex;
    justify-content: space-around;
    border-top: 1px solid var(--border-color);
}

.post-action-btn {
    flex: 1;
    padding: 0.5rem;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    border-radius: 6px;
}

.post-action-btn:hover {
    background-color: var(--bg-hover);
    color: var(--primary-color);
}

.post-action-btn.active {
    color: var(--primary-color);
    font-weight: 600;
}

.post-action-btn.liked {
    color: var(--danger-color);
}

/* Comments Section */
.comments-section {
    padding: 1rem;
    border-top: 1px solid var(--border-color);
    background-color: var(--bg-secondary);
}

.comment-item {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.comment-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.comment-content {
    flex: 1;
    background-color: var(--bg-tertiary);
    padding: 0.5rem 0.75rem;
    border-radius: 12px;
}

.comment-author {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-primary);
    margin-right: 0.5rem;
}

.comment-text {
    font-size: 0.9rem;
    color: var(--text-primary);
}

.comment-time {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

.comment-actions {
    display: flex;
    gap: 1rem;
    margin-top: 0.25rem;
}

.comment-action {
    font-size: 0.75rem;
    color: var(--text-secondary);
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    font-weight: 600;
}

.comment-action:hover {
    text-decoration: underline;
    color: var(--primary-color);
}

/* Comment Input */
.comment-input-wrapper {
    display: flex;
    gap: 0.75rem;
    padding-top: 0.75rem;
}

.comment-input {
    flex: 1;
    border: none;
    background-color: var(--bg-tertiary);
    border-radius: 20px;
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
}

.comment-input:focus {
    outline: none;
    background-color: var(--bg-hover);
}

/* Comment Bubble Style */
.comment-content {
    flex: 1;
    min-width: 0;
}

.comment-bubble {
    background-color: var(--bg-tertiary);
    padding: 0.5rem 0.75rem;
    border-radius: 12px;
    display: inline-block;
    max-width: 100%;
}

.comment-meta {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
    padding-left: 0.25rem;
}

.comment-meta .btn-link {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 600;
}

.comment-meta .btn-link:hover {
    text-decoration: underline;
    color: var(--primary-color);
}

/* Replies */
.replies-container {
    margin-top: 0.5rem;
    padding-left: 1rem;
    border-left: 2px solid var(--border-color);
}

.replies-container .comment-item {
    margin-bottom: 0.5rem;
}

.replies-container .comment-avatar {
    width: 28px;
    height: 28px;
}

.load-replies-btn {
    font-size: 0.8rem;
    color: var(--primary-color);
    text-decoration: none;
}

.load-replies-btn:hover {
    text-decoration: underline;
}

.reply-input-container {
    margin-top: 0.5rem;
}

.reply-input {
    border-radius: 20px;
    font-size: 0.85rem;
}

/* Comment Like Button */
.comment-like-btn {
    font-size: 0.75rem !important;
    text-decoration: none !important;
}

.comment-like-btn:hover {
    color: var(--danger-color) !important;
}

/* Adoption Card */
.adoption-card {
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.3s ease;
}

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

.adoption-card-img {
    width: 100%;
    height: 200px;
    object-fit: cover;
}

.adoption-card-badge {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
}

.adoption-card-info {
    padding: 1rem;
}

.adoption-card-title {
    font-weight: 700;
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.adoption-card-location {
    font-size: 0.85rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.adoption-card-price {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-top: 0.5rem;
}

/* Product Card */
.product-card {
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.3s ease;
    cursor: pointer;
}

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

.product-card-img {
    width: 100%;
    height: 180px;
    object-fit: cover;
}

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

.product-card-title {
    font-weight: 600;
    font-size: 0.95rem;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.product-card-price {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary-color);
}

.product-card-old-price {
    font-size: 0.9rem;
    color: var(--text-secondary);
    text-decoration: line-through;
    margin-left: 0.5rem;
}

.product-card-rating {
    font-size: 0.85rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 0.25rem;
    margin-top: 0.5rem;
}

/* Pet Profile Card */
.pet-card {
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.3s ease;
}

.pet-card:hover {
    transform: scale(1.02);
    box-shadow: var(--shadow-md);
}

.pet-card-img {
    width: 100%;
    height: 200px;
    object-fit: cover;
}

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

.pet-card-name {
    font-weight: 700;
    font-size: 1.1rem;
    margin-bottom: 0.25rem;
}

.pet-card-species {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* Hashtag Tag */
.hashtag-tag {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    background: var(--gradient-primary);
    color: white;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
    text-decoration: none;
    margin: 0.25rem;
    transition: all 0.2s ease;
}

.hashtag-tag:hover {
    transform: scale(1.05);
    box-shadow: var(--shadow-md);
    color: white;
}

/* Badges */
.badge-custom {
    padding: 0.35rem 0.75rem;
    border-radius: 20px;
    font-weight: 500;
    font-size: 0.8rem;
}

/* Avatar with Status */
.avatar-status {
    position: relative;
}

.avatar-status::after {
    content: '';
    position: absolute;
    bottom: 0;
    right: 0;
    width: 12px;
    height: 12px;
    background-color: var(--success-color);
    border: 2px solid var(--card-bg);
    border-radius: 50%;
}

/* Loading Spinner */
.spinner-custom {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* Empty State */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-secondary);
}

.empty-state i {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.empty-state-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.empty-state-text {
    font-size: 0.95rem;
    color: var(--text-secondary);
}

/* Responsive */
@media (max-width: 991.98px) {
    .navbar-brand span {
        font-size: 1.25rem;
    }

    aside {
        height: auto !important;
        position: relative !important;
    }

    .post-card {
        border-radius: 0;
        margin-bottom: 0.5rem;
    }
}

@media (max-width: 767.98px) {
    .navbar-brand {
        font-size: 1.25rem;
    }

    .navbar-brand img {
        max-height: 35px;
    }
}

@media (max-width: 575.98px) {
    body {
        font-size: 14px;
    }

    .navbar {
        padding-left: 0.5rem;
        padding-right: 0.5rem;
    }

    .navbar-brand {
        font-size: 1.1rem;
    }

    .navbar-brand img {
        max-height: 32px;
    }

    .navbar .btn {
        width: 36px;
        height: 36px;
        font-size: 0.9rem;
    }

    .navbar .gap-sm-2 {
        gap: 0.5rem !important;
    }

    .post-header {
        padding: 0.75rem;
    }

    .post-content {
        padding: 0 0.75rem 0.75rem;
    }

    .post-actions {
        padding: 0.5rem 0.75rem;
    }

    .post-action-btn {
        font-size: 0.85rem;
        padding: 0.4rem;
    }
}

@media (max-width: 374.98px) {
    .navbar {
        padding-left: 0.25rem;
        padding-right: 0.25rem;
    }

    .navbar-brand img {
        max-height: 28px;
    }

    .navbar .btn {
        width: 32px;
        height: 32px;
        font-size: 0.85rem;
    }

    .navbar .gap-1 {
        gap: 0.15rem !important;
    }
}

/* Utilities */
.cursor-pointer {
    cursor: pointer;
}

.transition-all {
    transition: all var(--transition-speed) ease;
}

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

.hover-lift:hover {
    transform: translateY(-2px);
}

.text-truncate-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.text-truncate-3 {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Image Overlay */
.img-overlay {
    position: relative;
    overflow: hidden;
}

.img-overlay::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to bottom, transparent 50%, rgba(0,0,0,0.7) 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.img-overlay:hover::after {
    opacity: 1;
}

/* PWA Install Prompt */
.pwa-install-prompt {
    position: fixed;
    bottom: 1rem;
    left: 50%;
    transform: translateX(-50%);
    width: calc(100% - 2rem);
    max-width: 400px;
    z-index: 1050;
    animation: slideUp 0.4s ease-out;
}

.pwa-install-prompt .card {
    border: none;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
}

.pwa-install-prompt .btn-close {
    padding: 0.25rem;
}

.pwa-install-prompt h6 {
    font-weight: 600;
    color: var(--text-primary);
}

.pwa-install-prompt small {
    color: var(--text-secondary);
}

@keyframes slideUp {
    from {
        transform: translate(-50%, 150%);
        opacity: 0;
    }
    to {
        transform: translate(-50%, 0);
        opacity: 1;
    }
}

@media (max-width: 575.98px) {
    .pwa-install-prompt {
        bottom: 0.5rem;
        width: calc(100% - 1rem);
    }
}

/* Offline Indicator */
.offline-indicator {
    position: fixed;
    top: 56px;
    left: 0;
    right: 0;
    background-color: var(--warning-color);
    color: white;
    text-align: center;
    padding: 0.5rem;
    font-weight: 600;
    z-index: 1040;
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        transform: translateY(-100%);
    }
    to {
        transform: translateY(0);
    }
}

/* ===================================
   Notificaciones Dropdown Responsive
   =================================== */
.notifications-dropdown {
    width: 320px;
    max-width: calc(100vw - 20px);
}

.notification-item {
    cursor: pointer;
}

.notification-item.unread {
    background-color: #f0f7ff;
}

.notification-item .delete-notif:hover {
    color: #dc3545 !important;
}

@media (max-width: 575.98px) {
    .notifications-dropdown {
        width: calc(100vw - 20px);
        position: fixed !important;
        top: 56px !important;
        left: 10px !important;
        right: 10px !important;
        transform: none !important;
    }
}

/* ===================================
   Navegación Móvil (Bottom Nav)
   =================================== */
.mobile-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background-color: var(--navbar-bg);
    border-top: 1px solid var(--border-color);
    padding: 0.5rem 0;
    padding-bottom: calc(0.5rem + env(safe-area-inset-bottom));
    z-index: 1030;
    display: none;
}

@media (max-width: 767.98px) {
    .mobile-nav {
        display: block;
    }

    /* Agregar espacio para que el contenido no quede debajo del nav */
    body {
        padding-bottom: 70px;
    }

    /* PWA install prompt arriba del nav */
    .pwa-install-prompt {
        bottom: calc(70px + 0.5rem);
    }
}

.mobile-nav-items {
    display: flex;
    justify-content: space-around;
    align-items: center;
    margin: 0;
    padding: 0;
    list-style: none;
}

.mobile-nav-item {
    flex: 1;
    text-align: center;
}

.mobile-nav-link {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.15rem;
    padding: 0.25rem;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.65rem;
    transition: color 0.2s ease;
}

.mobile-nav-link i {
    font-size: 1.25rem;
}

.mobile-nav-link.active,
.mobile-nav-link:hover {
    color: var(--primary-color);
}

.mobile-nav-link.active i {
    transform: scale(1.1);
}

/* ===================================
   Empty State - Botones más pequeños
   =================================== */
.empty-state {
    text-align: center;
    padding: 2rem 1rem;
    color: var(--text-secondary);
}

.empty-state i {
    font-size: 3rem;
    margin-bottom: 0.75rem;
    opacity: 0.5;
}

.empty-state-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.empty-state-text {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 0;
}

.empty-state .btn {
    padding: 0.5rem 1.25rem;
    font-size: 0.875rem;
}

/* Print Styles */
@media print {
    .navbar,
    aside,
    .mobile-nav,
    .post-actions,
    .btn,
    button {
        display: none !important;
    }

    .card {
        box-shadow: none !important;
        border: 1px solid #000 !important;
    }
}

/* ===================================
   Verification Code Inputs
   =================================== */
.verification-input {
    width: 45px;
    height: 55px;
    font-size: 24px;
    font-weight: bold;
    text-align: center;
    border-radius: 10px;
    border: 2px solid var(--border-color, #dee2e6);
    transition: border-color 0.2s, box-shadow 0.2s;
}

.verification-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.2);
    outline: none;
}

.verification-input.is-invalid {
    border-color: #dc3545;
    animation: shake 0.5s;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

/* ===================================
   Veterinario Search Dropdown
   =================================== */
#veterinarioResults {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 1050;
    display: none;
    background: var(--bg-primary, #fff);
    border: 1px solid var(--border-color, #dee2e6);
    border-radius: 0.375rem;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
    margin-top: 2px;
}

#veterinarioResults.show {
    display: block;
}

#veterinarioResults .dropdown-item {
    padding: 0.5rem 1rem;
    cursor: pointer;
    border-bottom: 1px solid var(--border-color, #f0f0f0);
}

#veterinarioResults .dropdown-item:last-child {
    border-bottom: none;
}

#veterinarioResults .dropdown-item:hover {
    background-color: var(--bg-hover, #f8f9fa);
}

#veterinarioResults .dropdown-item .fw-medium {
    font-size: 0.9rem;
}

#veterinarioResults .dropdown-item small {
    display: block;
    font-size: 0.75rem;
}
