* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
    color: #333;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
}

header {
    text-align: center;
    color: white;
    margin-bottom: 40px;
    padding: 30px 0;
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.2);
}

.subtitle {
    font-size: 1.1rem;
    opacity: 0.9;
}

.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: white;
    padding: 25px;
    border-radius: 15px;
    text-align: center;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    transition: transform 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-5px);
}

.stat-number {
    font-size: 2.5rem;
    font-weight: bold;
    color: #667eea;
    margin-bottom: 10px;
}

.stat-label {
    color: #666;
    font-size: 0.9rem;
}

.search-bar {
    margin-bottom: 20px;
}

#searchInput {
    width: 100%;
    padding: 15px 20px;
    font-size: 1rem;
    border: none;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    outline: none;
    transition: box-shadow 0.3s ease;
}

#searchInput:focus {
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
}

.filters {
    display: flex;
    gap: 10px;
    margin-bottom: 30px;
    justify-content: center;
    flex-wrap: wrap;
}

.filter-btn {
    padding: 10px 20px;
    border: 2px solid white;
    background: rgba(255,255,255,0.2);
    color: white;
    border-radius: 25px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.filter-btn:hover {
    background: rgba(255,255,255,0.3);
}

.filter-btn.active {
    background: white;
    color: #667eea;
    font-weight: bold;
}

.chats-container {
    display: grid;
    grid-template-columns: repeat(5, minmax(180px, 1fr));
    gap: 15px;
    margin-bottom: 40px;
}

.chat-card-link {
    text-decoration: none;
    color: inherit;
    display: block;
}

.chat-card {
    background: white;
    border-radius: 12px;
    padding: 15px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
    cursor: pointer;
}

.chat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 15px rgba(0,0,0,0.2);
}

.chat-image-container {
    width: 100%;
    height: 140px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 10px;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
}

/* Selo diagonal "comprado" (igual ao exemplo) */
.purchased-ribbon {
    position: absolute;
    right: -55px;
    bottom: 18px;
    width: 180px;
    height: 28px;
    background: #28a745;
    color: #fff;
    font-weight: 800;
    font-size: 14px;
    letter-spacing: 0.5px;
    text-transform: lowercase;
    display: flex;
    align-items: center;
    justify-content: center;
    transform: rotate(-35deg);
    box-shadow: 0 6px 18px rgba(40, 167, 69, 0.35);
    z-index: 5;
    pointer-events: none;
}

.purchased-ribbon::before,
.purchased-ribbon::after {
    content: "";
    position: absolute;
    top: 0;
    width: 0;
    height: 0;
    border-top: 14px solid transparent;
    border-bottom: 14px solid transparent;
}

.purchased-ribbon::before {
    left: -14px;
    border-right: 14px solid #28a745;
}

.purchased-ribbon::after {
    right: -14px;
    border-left: 14px solid #28a745;
}

.chat-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.chat-icon-large {
    font-size: 3rem;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chat-header {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
}

.chat-icon {
    font-size: 1.5rem;
    margin-right: 10px;
}

.chat-title {
    font-size: 1rem;
    font-weight: bold;
    color: #333;
    margin-bottom: 4px;
    line-height: 1.3;
}

.chat-type {
    font-size: 0.75rem;
    color: #666;
    text-transform: capitalize;
}

.chat-username {
    color: #667eea;
    text-decoration: none;
    font-weight: 500;
    display: inline-block;
    margin-top: 10px;
}

.chat-username:hover {
    text-decoration: underline;
}

.chat-date {
    font-size: 0.75rem;
    color: #999;
    margin-top: 8px;
}

.loading {
    text-align: center;
    color: white;
    font-size: 1.2rem;
    padding: 40px;
}

.no-results {
    text-align: center;
    color: white;
    font-size: 1.1rem;
    padding: 40px;
    background: rgba(255,255,255,0.1);
    border-radius: 15px;
    backdrop-filter: blur(10px);
}

footer {
    text-align: center;
    color: white;
    padding: 20px;
    opacity: 0.9;
}

.sort-filters {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    flex-wrap: wrap;
    gap: 20px;
}

.sort-options {
    display: flex;
    align-items: center;
    gap: 10px;
    color: white;
}

.sort-options label {
    font-weight: 500;
}

.sort-options select {
    padding: 10px 15px;
    border: 2px solid white;
    background: rgba(255,255,255,0.2);
    color: white;
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
    backdrop-filter: blur(10px);
}

.sort-options select option {
    background: #667eea;
    color: white;
}

.chat-stats {
    display: flex;
    gap: 10px;
    margin: 10px 0;
    font-size: 0.8rem;
    color: #666;
}

.chat-link-btn {
    display: inline-block;
    padding: 10px 20px;
    background: #667eea;
    color: white;
    text-decoration: none;
    border-radius: 8px;
    margin-top: 10px;
    transition: background 0.3s;
    font-weight: 500;
}

.chat-link-btn:hover {
    background: #5568d3;
}

/* Responsividade completa - Desktop, Tablet, Mobile */
@media (max-width: 1400px) {
    .chats-container {
        grid-template-columns: repeat(5, minmax(160px, 1fr));
    }
}

@media (max-width: 1200px) {
    .chats-container {
        grid-template-columns: repeat(4, 1fr);
    }
    
    .container {
        max-width: 100%;
        padding: 0 15px;
    }
}

@media (max-width: 992px) {
    .chats-container {
        grid-template-columns: repeat(3, 1fr);
    }
    
    header h1 {
        font-size: 2rem;
    }
    
    .subtitle {
        font-size: 1rem;
    }
    
    .stat-number {
        font-size: 2rem;
    }
}

@media (max-width: 768px) {
    body {
        padding: 10px;
    }
    
    header {
        padding: 20px 0;
        margin-bottom: 20px;
    }
    
    header h1 {
        font-size: 1.8rem;
    }
    
    .subtitle {
        font-size: 0.95rem;
    }
    
    .chats-container {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
    
    .chat-card {
        padding: 12px;
    }
    
    .chat-image-container {
        height: 120px;
    }
    
    .chat-title {
        font-size: 0.9rem;
    }
    
    .stats {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .stat-card {
        padding: 20px;
    }
    
    .stat-number {
        font-size: 1.8rem;
    }
    
    .sort-filters {
        flex-direction: column;
        align-items: stretch;
    }
    
    .filters {
        justify-content: center;
    }
    
    .filter-btn {
        padding: 8px 16px;
        font-size: 0.85rem;
    }
    
    .search-bar {
        margin-bottom: 15px;
    }
    
    #searchInput {
        padding: 12px 16px;
        font-size: 0.95rem;
    }
    
    .paid-group-promo-card {
        padding: 20px 15px !important;
        margin: 15px 0 !important;
    }
    
    .paid-group-promo-card h2 {
        font-size: 1.4rem !important;
    }
    
    .paid-group-promo-card p {
        font-size: 1rem !important;
    }
    
    .paid-group-btn {
        padding: 12px 30px !important;
        font-size: 1rem !important;
    }
    
    /* Garantir que todos os elementos apareçam no mobile */
    #addGroupSection {
        padding: 20px 15px !important;
        margin: 20px 0 !important;
    }
    
    #addGroupSection h2 {
        font-size: 1.2rem !important;
    }
    
    #addGroupSection p {
        font-size: 0.95rem !important;
    }
    
    #mainAnuncieBtn {
        font-size: 1rem !important;
        padding: 12px 20px !important;
        width: 100%;
        max-width: 300px;
    }
    
    .sort-options {
        width: 100%;
        margin-top: 15px;
    }
    
    .sort-options label {
        display: block;
        margin-bottom: 8px;
        font-size: 0.9rem;
    }
    
    .sort-options select {
        width: 100%;
        padding: 10px;
        font-size: 0.9rem;
    }
    
    footer {
        padding: 20px 15px !important;
        font-size: 0.85rem !important;
    }
    
    /* Mobile: NÃO fixar filtros (atrapalha a rolagem) */
    .sort-filters {
        position: static;
        top: auto;
        background: transparent;
        z-index: auto;
        padding: 0;
        margin-bottom: 20px;
    }
    
    #paidGroupsSuggestions {
        padding: 20px 10px !important;
    }
    
    #paidGroupsSuggestions h2 {
        font-size: 1.5rem !important;
    }
    
    .paid-group-suggestion-card {
        padding: 20px 15px !important;
    }
    
    .paid-group-suggestion-card button {
        width: 100%;
        margin: 5px 0;
        font-size: 0.9rem !important;
        padding: 12px 15px !important;
    }
}

/* iOS específico */
@supports (-webkit-touch-callout: none) {
    @media (max-width: 768px) {
        body {
            -webkit-font-smoothing: antialiased;
            -webkit-text-size-adjust: 100%;
        }
        
        .chat-card {
            -webkit-tap-highlight-color: transparent;
        }
    }
}

/* Android específico */
@media (max-width: 480px) {
    .chats-container {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    header h1 {
        font-size: 1.5rem;
    }
    
    .chat-image-container {
        height: 150px;
    }
    
    .chat-icon-large {
        font-size: 2.5rem;
    }
    
    .paid-group-promo-card {
        padding: 15px 10px !important;
    }
    
    .paid-group-promo-card h2 {
        font-size: 1.2rem !important;
    }
    
    .paid-group-promo-card p {
        font-size: 0.9rem !important;
        margin-bottom: 15px !important;
    }
    
    .paid-group-btn {
        padding: 10px 25px !important;
        font-size: 0.95rem !important;
    }
}

/* Tablet em landscape */
@media (min-width: 768px) and (max-width: 1024px) and (orientation: landscape) {
    .chats-container {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* Desktop grande */
@media (min-width: 1400px) {
    .container {
        max-width: 1400px;
    }
    
    .chats-container {
        grid-template-columns: repeat(6, minmax(180px, 1fr));
    }
}

