/* 
 * CSS para Sistema de Classificados
 * Portal Agregador Brasil
 */

/* ==============================================
   HERO DA CATEGORIA
   ============================================== */
.category-hero {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    position: relative;
    overflow: hidden;
}

.category-hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: 
        radial-gradient(circle at 25% 75%, rgba(255, 255, 255, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 75% 25%, rgba(255, 255, 255, 0.1) 0%, transparent 50%);
}

.category-info {
    position: relative;
    z-index: 2;
}

.category-icon i {
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.2));
}

.category-title {
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.category-description {
    font-size: 1.125rem;
    line-height: 1.6;
    opacity: 0.95;
}

.category-stats .stat-item {
    text-align: center;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 1rem;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.stat-number {
    font-size: 1.75rem;
    font-weight: 700;
    display: block;
    line-height: 1;
    margin-bottom: 0.5rem;
}

.stat-label {
    font-size: 0.875rem;
    opacity: 0.9;
}

.category-cta {
    background: rgba(255, 255, 255, 0.1);
    padding: 2rem;
    border-radius: 1.5rem;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

/* ==============================================
   SUBCATEGORIAS
   ============================================== */
.subcategories-section {
    border-bottom: 1px solid #e9ecef;
}

.subcategories-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.subcategory-card {
    display: flex;
    align-items: center;
    padding: 1rem;
    background: white;
    border-radius: 0.75rem;
    text-decoration: none;
    color: inherit;
    transition: all 0.3s ease;
    border: 1px solid #e9ecef;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.subcategory-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
    color: inherit;
    text-decoration: none;
}

.subcategory-icon {
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary);
    color: white;
    border-radius: 0.75rem;
    margin-right: 1rem;
    font-size: 1.25rem;
}

.subcategory-name {
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.subcategory-count {
    font-size: 0.875rem;
    color: #6c757d;
}

/* ==============================================
   FILTROS
   ============================================== */
.filters-sidebar {
    position: sticky;
    top: 100px;
}

.filter-card {
    background: white;
    border-radius: 1rem;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    border: 1px solid #e9ecef;
}

.filter-title {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid #f8f9fa;
}

.filter-group {
    margin-bottom: 1.5rem;
}

.filter-group:last-child {
    margin-bottom: 0;
}

.filter-label {
    font-size: 0.875rem;
    font-weight: 600;
    color: #495057;
    margin-bottom: 0.5rem;
    display: block;
}

.filter-actions {
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid #e9ecef;
}

.popular-cities {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.city-link {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem;
    background: #f8f9fa;
    border-radius: 0.5rem;
    text-decoration: none;
    color: inherit;
    transition: all 0.3s ease;
    font-size: 0.875rem;
}

.city-link:hover {
    background: var(--primary);
    color: white;
    text-decoration: none;
}

.city-count {
    background: rgba(0, 0, 0, 0.1);
    padding: 0.25rem 0.5rem;
    border-radius: 1rem;
    font-size: 0.75rem;
    font-weight: 600;
}

/* ==============================================
   RESULTADOS
   ============================================== */
.results-header {
    background: white;
    padding: 1.5rem;
    border-radius: 1rem;
    margin-bottom: 2rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    border: 1px solid #e9ecef;
}

.results-title {
    color: #212529;
    margin-bottom: 0.5rem;
}

.results-count {
    font-size: 0.875rem;
}

.view-toggle .btn {
    border-color: #dee2e6;
}

.view-toggle .btn.active {
    background-color: var(--primary);
    border-color: var(--primary);
    color: white;
}

/* ==============================================
   CARDS DOS CLASSIFICADOS
   ============================================== */
.classified-card {
    background: white;
    border-radius: 1rem;
    overflow: hidden;
    transition: all 0.3s ease;
    border: 1px solid #e9ecef;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    position: relative;
}

.classified-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.12);
}

.card-badge {
    position: absolute;
    top: 1rem;
    left: 1rem;
    z-index: 10;
}

.card-badge .badge {
    font-size: 0.75rem;
    padding: 0.5rem 0.75rem;
    border-radius: 0.5rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.card-image {
    position: relative;
    height: 200px;
    overflow: hidden;
}

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

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

.image-count {
    position: absolute;
    bottom: 0.75rem;
    right: 0.75rem;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 1rem;
    font-size: 0.75rem;
    font-weight: 500;
}

.btn-favorite {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.9);
    color: #6c757d;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    backdrop-filter: blur(5px);
}

.btn-favorite:hover {
    background: white;
    color: #dc3545;
    transform: scale(1.1);
}

.card-body {
    padding: 1.25rem;
}

.card-price {
    margin-bottom: 1rem;
}

.price-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--success);
}

.price-free {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--info);
}

.price-contact {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--warning);
}

.price-type {
    color: #6c757d;
    font-size: 0.75rem;
    display: block;
    margin-top: 0.25rem;
}

.card-title {
    margin-bottom: 0.75rem;
    line-height: 1.4;
}

.card-title a {
    color: #212529;
    text-decoration: none;
    font-weight: 600;
}

.card-title a:hover {
    color: var(--primary);
}

.card-description {
    color: #6c757d;
    font-size: 0.875rem;
    line-height: 1.5;
    margin-bottom: 1rem;
}

.card-location,
.card-date {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: #6c757d;
    margin-bottom: 0.5rem;
}

.card-footer {
    padding: 1rem 1.25rem;
    background: #f8f9fa;
    border-top: 1px solid #e9ecef;
}

.card-user {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

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

.user-name {
    font-size: 0.875rem;
    font-weight: 500;
    color: #495057;
}

.card-stats {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.stat-views {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.75rem;
    color: #6c757d;
}

/* ==============================================
   VISUALIZAÇÃO EM LISTA
   ============================================== */
.list-view {
    display: flex !important;
    flex-direction: column;
    gap: 1.5rem;
}

.list-view .classified-card {
    display: flex;
    flex-direction: row;
    height: auto;
}

.list-view .card-image {
    width: 200px;
    height: 150px;
    flex-shrink: 0;
}

.list-view .card-body {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.list-view .card-footer {
    background: transparent;
    border-top: none;
    padding: 0;
    margin-top: auto;
}

/* ==============================================
   CATEGORIAS RELACIONADAS
   ============================================== */
.categories-carousel {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
}

.category-item {
    display: flex;
    align-items: center;
    padding: 1.25rem;
    background: white;
    border-radius: 1rem;
    text-decoration: none;
    color: inherit;
    transition: all 0.3s ease;
    border: 1px solid #e9ecef;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.category-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
    color: inherit;
    text-decoration: none;
}

.category-item .category-icon {
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    border-radius: 1rem;
    margin-right: 1rem;
    font-size: 1.5rem;
}

.category-item .category-name {
    font-weight: 600;
    margin-bottom: 0.25rem;
    font-size: 1rem;
}

.category-item .category-count {
    font-size: 0.875rem;
    color: #6c757d;
}

/* ==============================================
   ESTADO VAZIO
   ============================================== */
.empty-state {
    padding: 4rem 2rem;
}

.empty-icon {
    opacity: 0.3;
}

.empty-title {
    color: #495057;
    margin-bottom: 1rem;
}

.empty-message {
    max-width: 500px;
    margin: 0 auto 2rem;
    line-height: 1.6;
}

.empty-actions {
    display: flex;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
}

/* ==============================================
   PAGINAÇÃO
   ============================================== */
.pagination {
    margin: 2rem 0;
}

.pagination .page-link {
    color: var(--primary);
    border-color: #e9ecef;
    padding: 0.75rem 1rem;
    margin: 0 0.25rem;
    border-radius: 0.5rem;
    transition: all 0.3s ease;
}

.pagination .page-link:hover {
    color: white;
    background-color: var(--primary);
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.pagination .page-item.active .page-link {
    background-color: var(--primary);
    border-color: var(--primary);
    color: white;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.pagination .page-item.disabled .page-link {
    color: #6c757d;
    background-color: #f8f9fa;
    border-color: #e9ecef;
}

/* ==============================================
   RESPONSIVIDADE
   ============================================== */
@media (max-width: 1199px) {
    .filters-sidebar {
        position: relative;
        top: auto;
    }
}

@media (max-width: 991px) {
    .category-hero .row {
        text-align: center;
    }
    
    .category-stats {
        margin-top: 2rem;
    }
    
    .subcategories-grid {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
        gap: 0.75rem;
    }
    
    .subcategory-card {
        padding: 0.75rem;
    }
    
    .subcategory-icon {
        width: 40px;
        height: 40px;
        font-size: 1rem;
    }
    
    .results-header {
        padding: 1rem;
    }
    
    .results-controls .row {
        flex-direction: column;
        gap: 1rem;
    }
    
    .list-view .classified-card {
        flex-direction: column;
    }
    
    .list-view .card-image {
        width: 100%;
        height: 200px;
    }
    
    .categories-carousel {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    }
}

@media (max-width: 768px) {
    .category-hero {
        padding: 3rem 0;
    }
    
    .category-stats .row {
        justify-content: center;
    }
    
    .filter-card {
        padding: 1rem;
        margin-bottom: 1rem;
    }
    
    .subcategories-grid {
        grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    }
    
    .card-image {
        height: 180px;
    }
    
    .card-body {
        padding: 1rem;
    }
    
    .card-footer {
        padding: 0.75rem 1rem;
    }
    
    .empty-state {
        padding: 2rem 1rem;
    }
}

@media (max-width: 576px) {
    .category-cta {
        padding: 1.5rem;
    }
    
    .stat-number {
        font-size: 1.5rem;
    }
    
    .subcategory-card {
        flex-direction: column;
        text-align: center;
        padding: 1rem;
    }
    
    .subcategory-icon {
        margin-right: 0;
        margin-bottom: 0.5rem;
    }
    
    .filter-actions {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .results-controls .col-4,
    .results-controls .col-8 {
        flex: 0 0 100%;
        max-width: 100%;
    }
    
    .view-toggle {
        margin-top: 0.75rem;
    }
    
    .card-image {
        height: 160px;
    }
    
    .price-value {
        font-size: 1.25rem;
    }
    
    .categories-carousel {
        grid-template-columns: 1fr;
    }
    
    .category-item {
        padding: 1rem;
    }
    
    .category-item .category-icon {
        width: 50px;
        height: 50px;
        font-size: 1.25rem;
    }
}

/* ==============================================
   ANIMAÇÕES
   ============================================== */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.classified-card {
    animation: fadeInUp 0.6s ease-out;
}

.filter-card {
    animation: slideInRight 0.6s ease-out;
}

/* Animação de loading */
.loading-skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
}

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

/* ==============================================
   DARK MODE (FUTURO)
   ============================================== */
@media (prefers-color-scheme: dark) {
    .category-hero {
        background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    }
    
    .classified-card {
        background: #2d3748;
        border-color: #4a5568;
        color: #e2e8f0;
    }
    
    .card-title a {
        color: #e2e8f0;
    }
    
    .card-title a:hover {
        color: #63b3ed;
    }
    
    .filter-card {
        background: #2d3748;
        border-color: #4a5568;
        color: #e2e8f0;
    }
}