/*
==================================================
AGREGADOR BRASIL - CSS RESPONSIVO MODERNO
==================================================
*/

/* ==================================================
   BREAKPOINTS MODERNOS
   xs: 0-575px (Mobile Portrait)
   sm: 576-767px (Mobile Landscape) 
   md: 768-991px (Tablet)
   lg: 992-1199px (Desktop)
   xl: 1200-1399px (Large Desktop)
   xxl: 1400px+ (Extra Large Desktop)
================================================== */

/* ==================================================
   BASE MOBILE FIRST
================================================== */

/* Container responsivo */
.container {
    max-width: 100%;
    padding-left: var(--spacing-md);
    padding-right: var(--spacing-md);
}

/* ==================================================
   HEADER RESPONSIVO
================================================== */

/* Top bar - oculto em mobile */
.top-bar {
    display: none;
}

/* Logo responsivo */
.navbar-brand {
    font-size: 1.25rem;
}

.logo-img {
    max-height: 40px;
    margin-right: var(--spacing-sm);
}

.logo-text {
    display: none;
}

/* Search - oculto no header mobile */
.search-container {
    display: none;
}

/* Mobile search */
.mobile-search {
    padding: var(--spacing-md) 0;
    border-top: 1px solid var(--light);
}

/* Auth buttons mobile */
.auth-buttons {
    flex-direction: column;
    gap: var(--spacing-xs);
}

.auth-buttons .btn {
    font-size: 0.875rem;
    padding: var(--spacing-xs) var(--spacing-md);
}

/* User dropdown mobile */
.user-dropdown {
    min-width: 250px;
    margin-top: var(--spacing-sm);
}

/* Categories menu mobile */
.categories-menu {
    display: none;
}

/* Navbar toggle */
.navbar-toggler {
    border: none;
    padding: var(--spacing-sm);
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
}

.navbar-toggler:focus {
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.navbar-toggler-icon {
    width: 1.5rem;
    height: 1.5rem;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba%2833, 37, 41, 0.75%29' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
}

/* ==================================================
   BREADCRUMB RESPONSIVO
================================================== */
.breadcrumb-section {
    padding: var(--spacing-sm) 0;
}

.modern-breadcrumb {
    font-size: 0.75rem;
    flex-wrap: wrap;
}

.modern-breadcrumb .breadcrumb-item {
    margin-bottom: var(--spacing-xs);
}

/* ==================================================
   HERO SECTION RESPONSIVO
================================================== */
.hero-modern {
    min-height: 100vh;
    padding: var(--spacing-2xl) 0;
}

.hero-title {
    font-size: 2rem;
    text-align: center;
    margin-bottom: var(--spacing-lg);
}

.hero-subtitle {
    font-size: 1rem;
    text-align: center;
    margin-bottom: var(--spacing-xl);
}

.hero-cta {
    justify-content: center;
    margin-bottom: var(--spacing-xl);
}

.hero-cta .btn {
    font-size: 1rem;
    padding: var(--spacing-md) var(--spacing-xl);
    width: 100%;
    margin-bottom: var(--spacing-sm);
}

/* Hero stats mobile */
.hero-stats-container {
    margin-top: var(--spacing-xl);
}

.stat-card {
    margin-bottom: var(--spacing-md);
}

.stat-number {
    font-size: 1.5rem;
}

.stat-label {
    font-size: 0.75rem;
}

/* Hero visual mobile */
.hero-visual {
    margin-top: var(--spacing-2xl);
    text-align: center;
}

.hero-phone-mockup {
    max-width: 200px;
    transform: none;
}

.phone-screen {
    height: 300px;
}

.feature-badges {
    margin-top: var(--spacing-lg);
    gap: var(--spacing-sm);
}

.feature-badge {
    font-size: 0.75rem;
    padding: var(--spacing-xs) var(--spacing-sm);
}

/* Breaking news mobile */
.breaking-news-alert .alert {
    font-size: 0.875rem;
    padding: var(--spacing-sm);
}

/* ==================================================
   FLASH MESSAGES RESPONSIVO
================================================== */
.flash-messages-container {
    top: 80px;
    right: var(--spacing-sm);
    left: var(--spacing-sm);
    max-width: none;
}

.modern-alert {
    padding: var(--spacing-md);
    font-size: 0.875rem;
}

/* ==================================================
   CARDS E SECTIONS RESPONSIVO
================================================== */

/* Quick access cards */
.quick-access-card {
    background: white;
    border-radius: var(--radius-lg);
    padding: var(--spacing-xl);
    box-shadow: var(--shadow-md);
    transition: all var(--transition-normal);
    text-align: center;
    margin-bottom: var(--spacing-lg);
}

.quick-access-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-xl);
}

.quick-access-card .card-icon {
    width: 60px;
    height: 60px;
    margin: 0 auto var(--spacing-lg);
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.quick-access-card .card-title {
    font-size: 1.25rem;
    font-weight: var(--font-weight-bold);
    margin-bottom: var(--spacing-md);
    color: var(--dark);
}

.quick-access-card .card-text {
    color: var(--secondary);
    margin-bottom: var(--spacing-lg);
    line-height: 1.6;
}

.quick-access-card .card-stats {
    margin-top: var(--spacing-md);
    padding-top: var(--spacing-md);
    border-top: 1px solid var(--light);
}

/* Content cards */
.content-card {
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    overflow: hidden;
    margin-bottom: var(--spacing-lg);
}

.content-card .card-header {
    padding: var(--spacing-lg);
    border-bottom: 1px solid var(--light);
    font-weight: var(--font-weight-semibold);
}

.content-card .card-body {
    padding: 0;
}

.content-card .card-footer {
    padding: var(--spacing-lg);
    border-top: 1px solid var(--light);
    background: var(--light);
}

/* ==================================================
   NEWS RESPONSIVE
================================================== */

/* Featured main news */
.featured-main-news {
    background: white;
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-md);
    margin-bottom: var(--spacing-lg);
}

.news-image-container {
    position: relative;
    overflow: hidden;
}

.news-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
    transition: transform var(--transition-slow);
}

.featured-main-news:hover .news-image {
    transform: scale(1.05);
}

.news-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(to bottom, transparent 0%, rgba(0,0,0,0.3) 100%);
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: var(--spacing-md);
}

.news-category {
    background: var(--primary);
    color: white;
    padding: var(--spacing-xs) var(--spacing-sm);
    border-radius: var(--radius-md);
    font-size: 0.75rem;
    font-weight: var(--font-weight-semibold);
    text-transform: uppercase;
}

.news-actions {
    display: flex;
    gap: var(--spacing-xs);
}

.news-actions .btn {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    transition: all var(--transition-fast);
}

.news-actions .btn:hover {
    background: white;
    transform: scale(1.1);
}

.news-content {
    padding: var(--spacing-lg);
}

.news-title {
    font-size: 1.25rem;
    font-weight: var(--font-weight-bold);
    line-height: 1.3;
    margin-bottom: var(--spacing-md);
}

.news-title a {
    color: var(--dark);
    text-decoration: none;
    transition: color var(--transition-fast);
}

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

.news-summary {
    color: var(--secondary);
    line-height: 1.6;
    margin-bottom: var(--spacing-md);
}

.news-meta {
    display: flex;
    gap: var(--spacing-lg);
    font-size: 0.875rem;
    color: var(--secondary);
}

.meta-item {
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
}

/* Side news */
.featured-side-news {
    background: white;
    border-radius: var(--radius-lg);
    padding: var(--spacing-lg);
    box-shadow: var(--shadow-md);
}

.side-news-title {
    font-weight: var(--font-weight-bold);
    color: var(--dark);
    margin-bottom: var(--spacing-lg);
    padding-bottom: var(--spacing-md);
    border-bottom: 2px solid var(--light);
}

.side-news-item {
    padding: var(--spacing-md) 0;
    border-bottom: 1px solid var(--light);
    transition: all var(--transition-fast);
}

.side-news-item:last-child {
    border-bottom: none;
}

.side-news-item:hover {
    background: var(--light);
    margin: 0 calc(-1 * var(--spacing-md));
    padding-left: var(--spacing-md);
    padding-right: var(--spacing-md);
    border-radius: var(--radius-md);
}

.news-thumb img {
    width: 100%;
    height: 60px;
    object-fit: cover;
    border-radius: var(--radius-md);
}

.side-news-item .news-title {
    font-size: 0.95rem;
    font-weight: var(--font-weight-semibold);
    line-height: 1.4;
    margin-bottom: var(--spacing-xs);
}

.side-news-item .news-meta {
    gap: var(--spacing-sm);
    font-size: 0.75rem;
}

/* News lists */
.news-list {
    max-height: 400px;
    overflow-y: auto;
}

.news-list-item {
    padding: var(--spacing-md);
    border-bottom: 1px solid var(--light);
    transition: all var(--transition-fast);
}

.news-list-item:last-child {
    border-bottom: none;
}

.news-list-item:hover {
    background: var(--light);
}

.news-list-item .news-thumb {
    width: 60px;
    height: 45px;
    flex-shrink: 0;
}

.news-list-item .news-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: var(--radius-sm);
}

.news-list-item .news-title {
    font-size: 0.9rem;
    font-weight: var(--font-weight-medium);
    line-height: 1.3;
    margin-bottom: var(--spacing-xs);
}

.news-list-item .news-meta {
    font-size: 0.75rem;
    gap: var(--spacing-xs);
}

/* ==================================================
   CLASSIFIEDS RESPONSIVE
================================================== */
.classifieds-list {
    max-height: 400px;
    overflow-y: auto;
}

.classified-list-item {
    padding: var(--spacing-md);
    border-bottom: 1px solid var(--light);
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: all var(--transition-fast);
}

.classified-list-item:last-child {
    border-bottom: none;
}

.classified-list-item:hover {
    background: var(--light);
}

.classified-content {
    flex-grow: 1;
}

.classified-title {
    font-size: 0.9rem;
    font-weight: var(--font-weight-medium);
    line-height: 1.3;
    margin-bottom: var(--spacing-xs);
}

.classified-title a {
    color: var(--dark);
    text-decoration: none;
    transition: color var(--transition-fast);
}

.classified-title a:hover {
    color: var(--success);
}

.classified-meta {
    font-size: 0.875rem;
    margin-bottom: var(--spacing-xs);
}

.price {
    color: var(--success);
    font-weight: var(--font-weight-bold);
}

.classified-category {
    font-size: 0.75rem;
}

.classified-actions {
    margin-left: var(--spacing-md);
}

.btn-contact {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

.btn-contact:hover {
    transform: scale(1.1);
}

/* ==================================================
   COMPANIES RESPONSIVE
================================================== */
.companies-list {
    max-height: 400px;
    overflow-y: auto;
}

.company-list-item {
    padding: var(--spacing-md);
    border-bottom: 1px solid var(--light);
    transition: all var(--transition-fast);
}

.company-list-item:last-child {
    border-bottom: none;
}

.company-list-item:hover {
    background: var(--light);
}

.company-logo {
    width: 48px;
    height: 48px;
    flex-shrink: 0;
}

.company-logo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: var(--radius-md);
    border: 1px solid var(--light);
}

.company-name {
    font-size: 0.95rem;
    font-weight: var(--font-weight-semibold);
    line-height: 1.3;
    margin-bottom: var(--spacing-xs);
}

.company-name a {
    color: var(--dark);
    text-decoration: none;
    transition: color var(--transition-fast);
}

.company-name a:hover {
    color: var(--warning);
}

.company-meta {
    font-size: 0.75rem;
    color: var(--secondary);
}

.rating {
    display: inline-flex;
    align-items: center;
    gap: 1px;
}

.company-actions {
    margin-left: var(--spacing-md);
}

/* ==================================================
   FLOATING ELEMENTS
================================================== */
.floating-actions {
    position: fixed;
    bottom: var(--spacing-lg);
    right: var(--spacing-lg);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
}

/* WhatsApp Float */
.whatsapp-float {
    position: relative;
}

.whatsapp-btn {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    background: #25d366;
    color: white;
    padding: var(--spacing-md);
    border-radius: var(--radius-full);
    text-decoration: none;
    box-shadow: var(--shadow-lg);
    transition: all var(--transition-normal);
    animation: pulse 2s infinite;
    max-width: 60px;
    overflow: hidden;
}

.whatsapp-btn:hover {
    background: #128c7e;
    color: white;
    max-width: 200px;
    transform: scale(1.05);
}

.whatsapp-text {
    white-space: nowrap;
    font-weight: var(--font-weight-medium);
    opacity: 0;
    transition: opacity var(--transition-fast);
}

.whatsapp-btn:hover .whatsapp-text {
    opacity: 1;
}

/* Back to Top */
.btn-back-to-top {
    width: 50px;
    height: 50px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-lg);
    transition: all var(--transition-normal);
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
}

.btn-back-to-top.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.btn-back-to-top:hover {
    background: var(--primary-dark);
    transform: translateY(-3px);
}

/* Dark Mode Toggle */
.btn-dark-mode {
    width: 50px;
    height: 50px;
    background: var(--dark);
    color: white;
    border: none;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-lg);
    transition: all var(--transition-normal);
}

.btn-dark-mode:hover {
    background: #374151;
    transform: translateY(-3px);
}

/* ==================================================
   SMALL DEVICES - SM (576px+)
================================================== */
@media (min-width: 576px) {
    /* Container */
    .container {
        max-width: 540px;
        margin: 0 auto;
    }
    
    /* Hero */
    .hero-title {
        font-size: 2.5rem;
    }
    
    .hero-subtitle {
        font-size: 1.125rem;
    }
    
    .hero-cta .btn {
        width: auto;
        margin-bottom: 0;
    }
    
    .hero-phone-mockup {
        max-width: 250px;
    }
    
    .phone-screen {
        height: 350px;
    }
    
    /* Stats */
    .stat-number {
        font-size: 1.75rem;
    }
    
    /* Flash messages */
    .flash-messages-container {
        right: var(--spacing-lg);
        left: auto;
        max-width: 400px;
    }
    
    /* Floating actions */
    .floating-actions {
        bottom: var(--spacing-xl);
        right: var(--spacing-xl);
    }
}

/* ==================================================
   MEDIUM DEVICES - MD (768px+)
================================================== */
@media (min-width: 768px) {
    /* Container */
    .container {
        max-width: 720px;
    }
    
    /* Header */
    .logo-text {
        display: inline-block;
    }
    
    .search-container {
        display: block;
        max-width: 400px;
    }
    
    .mobile-search {
        display: none;
    }
    
    /* Hero */
    .hero-title {
        font-size: 3rem;
        text-align: left;
    }
    
    .hero-subtitle {
        text-align: left;
    }
    
    .hero-cta {
        justify-content: flex-start;
    }
    
    .hero-phone-mockup {
        max-width: 300px;
        transform: rotateY(-10deg) rotateX(5deg);
    }
    
    .phone-screen {
        height: 400px;
    }
    
    /* News */
    .news-image {
        height: 250px;
    }
    
    .side-news-item .news-thumb img {
        height: 70px;
    }
    
    /* Auth buttons */
    .auth-buttons {
        flex-direction: row;
    }
}

/* ==================================================
   LARGE DEVICES - LG (992px+)
================================================== */
@media (min-width: 992px) {
    /* Container */
    .container {
        max-width: 960px;
    }
    
    /* Header */
    .top-bar {
        display: block;
    }
    
    .categories-menu {
        display: block;
    }
    
    .navbar-toggler {
        display: none;
    }
    
    .search-container {
        max-width: 500px;
    }
    
    /* Hero */
    .hero-title {
        font-size: 3.5rem;
    }
    
    .hero-phone-mockup {
        transform: rotateY(-15deg) rotateX(5deg);
    }
    
    /* Stats em linha */
    .hero-stats-container .row {
        align-items: center;
    }
    
    .stat-number {
        font-size: 2rem;
    }
    
    /* Cards em grid */
    .quick-access-card,
    .content-card {
        margin-bottom: 0;
    }
    
    /* News */
    .news-image {
        height: 300px;
    }
    
    .featured-main-news {
        margin-bottom: 0;
    }
}

/* ==================================================
   EXTRA LARGE DEVICES - XL (1200px+)
================================================== */
@media (min-width: 1200px) {
    /* Container */
    .container {
        max-width: var(--container-max-width);
    }
    
    /* Hero */
    .hero-title {
        font-size: 4rem;
    }
    
    .hero-subtitle {
        font-size: 1.25rem;
    }
    
    /* Padding aumentado */
    .hero-modern {
        padding: var(--spacing-3xl) 0;
    }
    
    .quick-access-card {
        padding: var(--spacing-2xl);
    }
}

/* ==================================================
   EXTRA EXTRA LARGE DEVICES - XXL (1400px+)
================================================== */
@media (min-width: 1400px) {
    .container {
        max-width: 1320px;
    }
    
    .hero-title {
        font-size: 4.5rem;
    }
}

/* ==================================================
   LANDSCAPE ORIENTATION
================================================== */
@media (orientation: landscape) and (max-height: 500px) {
    .hero-modern {
        min-height: auto;
        padding: var(--spacing-xl) 0;
    }
    
    .hero-title {
        font-size: 1.75rem;
        margin-bottom: var(--spacing-md);
    }
    
    .hero-subtitle {
        font-size: 0.95rem;
        margin-bottom: var(--spacing-lg);
    }
    
    .hero-visual {
        margin-top: var(--spacing-lg);
    }
    
    .hero-phone-mockup {
        max-width: 150px;
    }
    
    .phone-screen {
        height: 200px;
    }
}

/* ==================================================
   HIGH DENSITY DISPLAYS
================================================== */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .logo-img,
    .news-image,
    .company-logo img {
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
    }
}

/* ==================================================
   PRINT STYLES
================================================== */
@media print {
    .floating-actions,
    .whatsapp-float,
    .btn-back-to-top,
    .btn-dark-mode,
    .top-bar,
    .categories-menu,
    .navbar-toggler,
    .hero-floating-elements,
    .feature-badges {
        display: none !important;
    }
    
    .container {
        max-width: none !important;
        padding: 0 !important;
    }
    
    .hero-modern {
        background: white !important;
        color: black !important;
        min-height: auto;
        padding: var(--spacing-lg) 0;
    }
    
    .hero-title,
    .hero-subtitle {
        color: black !important;
    }
    
    .card {
        break-inside: avoid;
        box-shadow: none !important;
        border: 1px solid #ddd !important;
    }
    
    .news-image {
        max-height: 200px !important;
    }
}

/* ==================================================
   ACCESSIBILITY
================================================== */

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
    
    .floating-shape {
        animation: none;
    }
    
    .hero-bg-pattern {
        animation: none;
    }
    
    .pulse {
        animation: none;
    }
}

/* High Contrast */
@media (prefers-contrast: high) {
    :root {
        --primary: #0056b3;
        --success: #006633;
        --danger: #cc0000;
        --warning: #cc8800;
    }
    
    .card {
        border: 2px solid var(--dark) !important;
    }
    
    .btn {
        border: 2px solid currentColor !important;
    }
}

/* ==================================================
   TOUCH DEVICES
================================================== */
@media (hover: none) and (pointer: coarse) {
    /* Aumenta área de toque */
    .btn,
    .nav-link,
    .dropdown-item {
        min-height: 44px;
        padding: var(--spacing-md);
    }
    
    /* Remove hover effects */
    .quick-access-card:hover,
    .content-card:hover,
    .featured-main-news:hover,
    .btn:hover {
        transform: none;
    }
    
    /* Melhora scroll em listas */
    .news-list,
    .classifieds-list,
    .companies-list {
        -webkit-overflow-scrolling: touch;
    }
}

/* ==================================================
   UTILITY CLASSES RESPONSIVAS
================================================== */

/* Display utilities */
@media (max-width: 575.98px) {
    .d-xs-none { display: none !important; }
    .d-xs-block { display: block !important; }
    .d-xs-flex { display: flex !important; }
}

@media (min-width: 576px) and (max-width: 767.98px) {
    .d-sm-none { display: none !important; }
    .d-sm-block { display: block !important; }
    .d-sm-flex { display: flex !important; }
}

@media (min-width: 768px) and (max-width: 991.98px) {
    .d-md-none { display: none !important; }
    .d-md-block { display: block !important; }
    .d-md-flex { display: flex !important; }
}

/* Text utilities */
@media (max-width: 575.98px) {
    .text-xs-center { text-align: center !important; }
    .text-xs-left { text-align: left !important; }
    .text-xs-right { text-align: right !important; }
}

/* Spacing utilities */
@media (max-width: 575.98px) {
    .p-xs-0 { padding: 0 !important; }
    .p-xs-1 { padding: var(--spacing-xs) !important; }
    .p-xs-2 { padding: var(--spacing-sm) !important; }
    .p-xs-3 { padding: var(--spacing-md) !important; }
    
    .m-xs-0 { margin: 0 !important; }
    .m-xs-1 { margin: var(--spacing-xs) !important; }
    .m-xs-2 { margin: var(--spacing-sm) !important; }
    .m-xs-3 { margin: var(--spacing-md) !important; }
    
    .mb-xs-2 { margin-bottom: var(--spacing-sm) !important; }
    .mb-xs-3 { margin-bottom: var(--spacing-md) !important; }
    .mb-xs-4 { margin-bottom: var(--spacing-lg) !important; }
}