/**
 * Trek Cards Enhanced CSS
 * Ensures consistent card appearance regardless of content
 * Created: June 22, 2025
 */

/* Trek Grid Container */
.trek-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.5rem;
    padding: 1rem 0;
}

/* Enhanced Trek Card - Base Structure */
.trek-card-enhanced {
    position: relative;
    background: #ffffff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.trek-card-enhanced:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

/* Card Link - Full Card Clickable */
.trek-card-link {
    display: flex;
    flex-direction: column;
    height: 100%;
    text-decoration: none;
    color: inherit;
}

/* Verified Badge */
.verified-badge {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: #059669;
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 700;
    z-index: 10;
    letter-spacing: 0.05em;
}

/* Card Header - Fixed Height Section */
.trek-card-header {
    padding: 1.5rem;
    background: #ffffff;
    flex: 0 0 auto;
    min-height: 140px; /* Ensures consistent header height */
}

/* Activity Badge */
.activity-badge {
    display: inline-block;
    padding: 0.375rem 0.75rem;
    border-radius: 20px;
    color: white;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.75rem;
}

/* Card Title */
.trek-card-title {
    font-size: 1.25rem;
    font-weight: 700;
    line-height: 1.4;
    margin: 0 0 0.5rem 0;
    color: #1a202c;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 2.8em; /* Ensures consistent title space */
}

/* Location Info */
.location-info {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    color: #6b7280;
    font-size: 0.875rem;
    margin-top: 0.5rem;
}

.location-icon {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

/* Meta Tags Container - Fixed Height */
.meta-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 1rem;
    min-height: 32px; /* Ensures consistent space even with no tags */
}

/* Individual Meta Tag */
.meta-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.625rem;
    border-radius: 16px;
    font-size: 0.75rem;
    font-weight: 500;
    background: #f3f4f6;
    color: #4b5563;
    white-space: nowrap;
}

.meta-icon {
    width: 14px;
    height: 14px;
}

/* Difficulty Tags */
.meta-tag.difficulty-easy {
    background: #d1fae5;
    color: #065f46;
}

.meta-tag.difficulty-moderate {
    background: #fed7aa;
    color: #9a3412;
}

.meta-tag.difficulty-challenging {
    background: #fecaca;
    color: #991b1b;
}

.meta-tag.difficulty-difficult,
.meta-tag.difficulty-very-difficult {
    background: #e0e7ff;
    color: #3730a3;
}

/* Special Tags */
.meta-tag.dogs-allowed {
    background: #dbeafe;
    color: #1e40af;
}

.meta-tag.family-friendly {
    background: #fce7f3;
    color: #9d174d;
}

/* Card Main Content - Growing Section */
.trek-card-content {
    padding: 0 1.5rem;
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    background: #ffffff;
}

/* Info Grid - Consistent Layout */
.trek-info-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    margin-bottom: 1rem;
}

.info-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: #4b5563;
}

.info-icon {
    width: 20px;
    height: 20px;
    color: #9ca3af;
    flex-shrink: 0;
}

.info-label {
    font-weight: 500;
    color: #6b7280;
}

.info-value {
    font-weight: 600;
    color: #1f2937;
}

/* Description Preview */
.trek-description {
    margin: 1rem 0;
    font-size: 0.875rem;
    line-height: 1.6;
    color: #4b5563;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 4em; /* Ensures consistent space */
}

/* Trail Highlights */
.trail-highlights {
    margin-top: auto; /* Pushes to bottom */
    padding-top: 1rem;
}

.trail-highlights h3 {
    font-size: 0.875rem;
    font-weight: 600;
    color: #374151;
    margin-bottom: 0.5rem;
}

.highlight-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.highlight-item {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.75rem;
    color: #6b7280;
}

.highlight-icon {
    width: 16px;
    height: 16px;
    color: #10b981;
}

/* Card Footer - Always at Bottom */
.trek-card-footer {
    padding: 1.5rem;
    background: #f9fafb;
    border-top: 1px solid #e5e7eb;
    margin-top: auto;
}

.card-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.view-trek-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: #059669;
    color: white;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 600;
    text-decoration: none;
    transition: background-color 0.2s;
}

.view-trek-btn:hover {
    background: #047857;
}

.arrow-icon {
    width: 16px;
    height: 16px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .trek-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .trek-info-grid {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }
    
    .trek-card-header {
        padding: 1rem;
        min-height: auto;
    }
    
    .trek-card-content,
    .trek-card-footer {
        padding: 1rem;
    }
}

/* Loading State */
.trek-card-loading {
    background: #f3f4f6;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* No Results Message */
.no-treks-found {
    grid-column: 1 / -1;
    text-align: center;
    padding: 4rem 2rem;
    background: #f9fafb;
    border-radius: 12px;
}

.no-treks-found h3 {
    font-size: 1.5rem;
    color: #374151;
    margin-bottom: 0.5rem;
}

.no-treks-found p {
    color: #6b7280;
    margin-bottom: 1.5rem;
}

/* Fix for Green Background Issues */
.trek-card-enhanced,
.trek-card-enhanced * {
    background-color: transparent !important;
}

.trek-card-enhanced {
    background: #ffffff !important;
}

.trek-card-header {
    background: #ffffff !important;
}

.trek-card-footer {
    background: #f9fafb !important;
}

/* Remove any theme-specific green backgrounds */
.entry-content .trek-card-enhanced,
.site-main .trek-card-enhanced,
#primary .trek-card-enhanced {
    background: #ffffff !important;
    border: none !important;
}

/* Ensure proper card spacing and appearance */
.trek-card-enhanced .trek-card-link {
    background: transparent !important;
    color: inherit !important;
}

.trek-card-enhanced:hover .trek-card-link {
    background: transparent !important;
}