

/* Reset e Base */
* {
    box-sizing: border-box;
}

#franchise-comparator {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* =================================
   HEADER - Original Desktop Style
   ================================= */
.comparator-header {
    text-align: center;
    margin-bottom: 30px;
    padding: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 12px;
}

.comparator-header h1 {
    margin: 0 0 10px 0;
    font-size: 28px;
    font-weight: 700;
    color: #fff;
}

.comparator-header p {
    margin: 0 0 10px 0;
    opacity: 0.9;
    font-size: 16px;
}

/* =================================
   SEARCH FILTERS - Original Desktop
   ================================= */
.search-filters {
    display: flex;
    gap: 15px;
    margin-bottom: 30px;
    flex-wrap: wrap;
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.search-row {
    display: flex;
    gap: 15px;
    flex: 2;
    min-width: 200px;
}

.filter-row {
    flex: 1;
    min-width: 150px;
}

.search-box {
    flex: 1;
    position: relative;
}

.search-box input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.3s;
}

.search-box input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* Search icon - hidden on desktop by default */
.search-icon {
    display: none;
}

.filter-row select {
    width: 100%;
    padding: 1px 16px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.3s;
}

.filter-row select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* =================================
   BUTTONS - Original Desktop Style
   ================================= */
.search-button, .compare-button, .share-button, .clear-button, .load-more-button {
    background: #667eea;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.compare-button {
    background: #1a2a74;
}

.clear-button {
    background: #e53e3e;
}

.search-button:hover, .compare-button:hover:not(:disabled), 
.share-button:hover, .load-more-button:hover {
    background: #5a67d8;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.clear-button:hover {
    background: #c53030;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(229, 62, 62, 0.3);
}

.compare-button:disabled {
    background: #cbd5e0;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Button text/icon - show both on desktop */
.btn-text {
    display: inline;
}

.btn-icon {
    display: inline;
}

.franchise-name-link {
    color: #007bff;
    text-decoration: none;
    transition: all 0.3s ease;
    border-bottom: 1px solid transparent;
}

.franchise-name-link:hover {
    color: #0056b3;
    text-decoration: none;
    border-bottom: 1px solid #0056b3;
}

/* Para mobile cards */
.comparison-card h4 .franchise-name-link {
    color: inherit;
    font-weight: inherit;
}

.comparison-card h4 .franchise-name-link:hover {
    color: #007bff;
}

/* Para tabela desktop */
.comparison-table th .franchise-name-link {
    color: inherit;
    font-weight: bold;
}

.comparison-table th .franchise-name-link:hover {
    color: #007bff;
}

/* Ícone indicativo de link externo (opcional) */
.franchise-name-link::after {
    content: " ↗";
    font-size: 0.8em;
    opacity: 0.6;
    transition: opacity 0.3s ease;
}

.franchise-name-link:hover::after {
    opacity: 1;
}

/* =================================
   SELECTED FRANCHISES - Original
   ================================= */
.selected-franchises {
    background: linear-gradient(135deg, #f7faff 0%, #eef4ff 100%);
    padding: 24px;
    border-radius: 12px;
    margin-bottom: 30px;
    border: 2px solid #e2e8f0;
}

.selected-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.selected-header h3 {
    margin: 0;
    color: #2d3748;
    font-size: 22px;
    font-weight: 700;
}

/* Toggle buttons - hidden on desktop */
.toggle-btn {
    display: none;
}

.selected-content {
    display: block;
}

.selected-content.collapsed {
    display: block; /* Always show on desktop */
}

#selected-count {
    color: #667eea;
    font-weight: 600;
}

#selected-list {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 20px;
}

.selected-item {
    background: #667eea;
    color: white;
    padding: 10px 16px;
    border-radius: 25px;
    font-size: 14px;
    font-weight: 600;
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
}

.selected-name {
    flex: 1;
}

.remove-selected {
    cursor: pointer;
    font-weight: bold;
    font-size: 18px;
    line-height: 1;
    padding: 2px 6px;
    border-radius: 50%;
    background: rgba(255,255,255,0.2);
    transition: background 0.2s;
}

.remove-selected:hover {
    background: rgba(255,255,255,0.3);
}

/* =================================
   FRANCHISE RESULTS - Original Desktop
   ================================= */
.franchise-results {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.franchise-item {
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    padding: 24px;
    background: white;
    cursor: pointer;
    transition: all 0.3s;
    position: relative;
    overflow: hidden;
}

.franchise-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #667eea, #764ba2);
    transform: scaleX(0);
    transition: transform 0.3s;
}

.franchise-item:hover {
    border-color: #667eea;
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.15);
    transform: translateY(-2px);
}

.franchise-item:hover::before {
    transform: scaleX(1);
}

.franchise-item.selected {
    border-color: #667eea;
    background: linear-gradient(135deg, #f7faff 0%, #eef4ff 100%);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.2);
}

.franchise-item.selected::before {
    transform: scaleX(1);
}

/* Desktop franchise layout - original style */
.franchise-header {
    display: block;
}

.franchise-name {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 12px;
    color: #2d3748;
    line-height: 1.3;
}

/* Hide mobile select indicator on desktop */
.select-indicator {
    display: none;
}

.franchise-segment {
    color: #667eea;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 16px;
    padding: 6px 12px;
    background: rgba(102, 126, 234, 0.1);
    border-radius: 20px;
    display: inline-block;
}

.franchise-info {
    font-size: 14px;
    color: #4a5568;
    line-height: 1.5;
}

/* Desktop info layout - original style */
.franchise-info div,
.info-row {
    margin-bottom: 8px;
    display: flex;
    justify-content: space-between;
}

.franchise-info strong,
.info-label {
    color: #2d3748;
    margin-right: 8px;
}

.info-value {
    text-align: right;
}

/* =================================
   LOAD MORE - Original
   ================================= */
.load-more-container {
    text-align: center;
    margin: 20px 0;
    padding: 20px;
}

.results-info {
    margin: 0;
    color: #718096;
    font-size: 14px;
}

/* =================================
   COMPARISON TABLE - Original Desktop
   ================================= */
.comparison-table {
    margin-top: 30px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    overflow: hidden;
}

.comparison-header {
    display: block;
    padding: 20px 24px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.comparison-header h3 {
    margin: 0;
    font-size: 22px;
    font-weight: 700;
}

.best-info {
    font-size: 14px;
    margin-top: 8px;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    display: inline-block;
}

/* Mobile cards - hidden on desktop */
.comparison-cards {
    display: none;
}

/* Desktop table - always visible */
.table-container {
    overflow-x: auto;
    max-height: 600px;
    overflow-y: auto;
    display: block;
}

#comparison-data {
    width: 100%;
    border-collapse: collapse;
}

#comparison-data th,
#comparison-data td {
    border: 1px solid #e2e8f0;
    padding: 16px;
    text-align: left;
    vertical-align: top;
}

#comparison-data th {
    background: #f7fafc;
    font-weight: 700;
    color: #2d3748;
    position: sticky;
    top: 0;
    z-index: 10;
}

#comparison-data th:first-child {
    background: #edf2f7;
    position: sticky;
    left: 0;
    z-index: 11;
}

#comparison-data td:first-child {
    background: #f7fafc;
    font-weight: 600;
    color: #4a5568;
    position: sticky;
    left: 0;
    z-index: 5;
}

#comparison-data tr:nth-child(even) td:not(:first-child) {
    background: #f9fafb;
}

.best-franchise {
    background: linear-gradient(135deg, #ffeaa7 0%, #fdcb6e 100%) !important;
    font-weight: bold;
    position: relative;
}

.crown-icon {
    position: absolute;
    top: -5px;
    right: 5px;
    font-size: 20px;
    z-index: 100;
    animation: bounce 2s infinite;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
}

.table-logo,
.franchise-logo {
    max-width: 100px;
    max-height: 80px;
    margin-top: 8px;
    border-radius: 4px;
    object-fit: cover;
    border: 1px solid #e2e8f0;
}

/* =================================
   COMPARISON ACTIONS - Original
   ================================= */
.comparison-actions {
    padding: 20px 24px;
    background: #f7fafc;
    display: flex;
    gap: 12px;
    justify-content: center;
}

/* =================================
   LOADING STATES - Original
   ================================= */
.loading {
    text-align: center;
    padding: 40px 20px;
    color: #718096;
    font-size: 16px;
}

.loading.error {
    color: #e53e3e;
}

.no-results {
    text-align: center;
    padding: 60px 20px;
    color: #718096;
}

.no-results-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.no-results h4 {
    color: #4a5568;
    margin-bottom: 8px;
}

/* =================================
   MOBILE ALERT - Only for mobile
   ================================= */
.mobile-alert {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: none; /* Hidden on desktop */
    align-items: center;
    justify-content: center;
    z-index: 9999;
    padding: 20px;
}

.mobile-alert-content {
    background: white;
    padding: 24px;
    border-radius: 16px;
    max-width: 320px;
    width: 100%;
    text-align: center;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.mobile-alert-content h4 {
    margin: 0 0 12px 0;
    color: #2d3748;
    font-size: 18px;
    font-weight: 700;
}

.mobile-alert-content p {
    margin: 0 0 20px 0;
    color: #4a5568;
    font-size: 16px;
    line-height: 1.5;
}

.mobile-alert-ok {
    background: #667eea;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.mobile-alert-ok:hover {
    background: #5a67d8;
}

/* =================================
   UTILITY CLASSES
   ================================= */
.mobile-only {
    display: none; /* Hidden on desktop */
}

.desktop-only {
    display: block; /* Visible on desktop */
}

/* =================================
   MOBILE BREAKPOINTS - ONLY MOBILE GETS NEW FEATURES
   ================================= */

/* Mobile Small (max 480px) */
@media (max-width: 480px) {
    #franchise-comparator {
        padding: 12px;
    }
    
    .comparator-header {
        padding: 20px 12px;
        margin-bottom: 20px;
    }
    
    .comparator-header h1 {
        font-size: 22px;
    }
    
    .comparator-header p {
        font-size: 14px;
    }
    
    /* Mobile search layout */
    .search-filters {
        flex-direction: column;
        padding: 16px 12px;
        gap: 12px;
    }
    
    .search-row {
        flex-direction: column;
        gap: 12px;
    }
    
    .search-box {
        position: relative;
    }
    
    .search-box input {
        padding: 12px 14px 12px 40px;
        font-size: 16px;
    }
    
    .search-icon {
        display: block;
        position: absolute;
        left: 14px;
        top: 50%;
        transform: translateY(-50%);
        font-size: 16px;
        color: #718096;
        pointer-events: none;
    }
    
    .filter-row select {
        padding: 12px 14px;
    }
    
    .search-button {
        padding: 12px 16px;
        width: 100%;
    }
    
    /* Mobile button styles */
    .btn-text {
        display: inline;
    }
    
    .btn-icon {
        display: inline;
        font-size: 18px;
    }
    
    /* Mobile franchise grid */
    .franchise-results {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    .franchise-item {
        padding: 16px;
    }
    
    /* Mobile franchise header with select indicator */
    .franchise-header {
        display: flex;
        justify-content: space-between;
        align-items: flex-start;
        margin-bottom: 12px;
    }
    
    .franchise-name {
        font-size: 18px;
        flex: 1;
        margin-right: 12px;
        margin-bottom: 0;
    }
    
    .select-indicator {
        display: flex;
        background: #667eea;
        color: white;
        width: 28px;
        height: 28px;
        border-radius: 50%;
        align-items: center;
        justify-content: center;
        font-size: 16px;
        font-weight: bold;
        transition: all 0.3s ease;
        flex-shrink: 0;
    }
    
    .franchise-item.selected .select-indicator {
        background: #48bb78;
        transform: scale(1.1);
    }
    
    /* Mobile info layout */
    .franchise-info div,
    .info-row {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 8px 0;
        border-bottom: 1px solid #e2e8f0;
        font-size: 14px;
    }
    
    .info-row:last-child {
        border-bottom: none;
        margin-bottom: 0;
    }
    
    .info-label {
        font-weight: 600;
        color: #2d3748;
        flex: 1;
    }
    
    .info-value {
        font-weight: 500;
        text-align: right;
        color: #4a5568;
    }
    
    /* Mobile selected franchises */
    .selected-franchises {
        padding: 16px 12px;
    }
    
    .toggle-btn {
        display: block;
        background: #667eea;
        color: white;
        border: none;
        border-radius: 8px;
        padding: 8px 12px;
        cursor: pointer;
        font-size: 14px;
        transition: all 0.3s ease;
    }
    
    .toggle-btn:hover {
        background: #5a67d8;
    }
    
    .selected-content.collapsed {
        max-height: 0;
        opacity: 0;
        overflow: hidden;
        margin-top: 0;
    }
    
    #selected-list {
        flex-direction: column;
        gap: 12px;
    }
    
    .selected-item {
        padding: 12px 16px;
        border-radius: 12px;
        font-size: 16px;
        box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
    }
    
    .remove-selected {
        font-size: 20px;
        padding: 4px 8px;
        margin-left: 8px;
    }
    
    .compare-button {
        width: 100%;
        padding: 16px 24px;
        font-size: 18px;
    }
    
    /* Mobile comparison */
    .comparison-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 20px 16px 16px 16px;
    }
    
    .comparison-header h3 {
        font-size: 18px;
        flex: 1;
    }
    
    .mobile-only {
        display: block !important;
    }
    
    .desktop-only {
        display: none !important;
    }
    
    .comparison-cards {
        display: block;
        padding: 16px 12px;
    }
    
    .table-container {
        display: none;
    }
    
    .comparison-card {
        background: white;
        border: 2px solid #e2e8f0;
        border-radius: 16px;
        margin-bottom: 20px;
        overflow: hidden;
        box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    }
    
    .comparison-card.best-franchise {
        border-color: #f39c12;
        box-shadow: 0 4px 20px rgba(243, 156, 18, 0.2);
    }
    
    .card-header {
        padding: 16px 12px;
        background: #f7fafc;
        position: relative;
    }
    
    .best-badge {
        background: linear-gradient(135deg, #ffeaa7 0%, #fdcb6e 100%);
        color: #8b5a2b;
        padding: 6px 12px;
        border-radius: 20px;
        font-size: 12px;
        font-weight: 700;
        margin-bottom: 12px;
        display: inline-block;
        text-transform: uppercase;
        letter-spacing: 0.5px;
    }
    
    .card-header h4 {
        margin: 0;
        font-size: 18px;
        font-weight: 700;
        color: #2d3748;
    }
    
    .franchise-logo {
        width: 60px;
        height: 45px;
        object-fit: cover;
        border-radius: 8px;
        margin-top: 12px;
        border: 1px solid #e2e8f0;
    }
    
    .card-content {
        padding: 0 12px 16px 12px;
    }
    
    .card-row {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 12px 0;
        border-bottom: 1px solid #e2e8f0;
    }
    
    .card-row:last-child {
        border-bottom: none;
    }
    
    .card-label {
        font-weight: 600;
        color: #2d3748;
        font-size: 15px;
        flex: 1;
    }
    
    .card-value {
        font-weight: 500;
        color: #4a5568;
        text-align: right;
        font-size: 15px;
    }
    
    /* Mobile actions */
    .comparison-actions {
        flex-direction: column;
        gap: 12px;
        padding: 16px 12px;
    }
    
    .share-button, .clear-button {
        width: 100%;
        padding: 14px 24px;
    }
    
    /* Mobile alert */
    .mobile-alert {
        display: flex;
    }
    
    /* Mobile loading */
    .loading {
        padding: 60px 20px;
        font-size: 18px;
    }
    
    .no-results {
        padding: 80px 20px;
    }
}

/* Tablet Portrait (481px - 768px) */
@media (min-width: 481px) and (max-width: 768px) {
    .franchise-results {
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
    }
    
    .search-filters {
        flex-direction: column;
        gap: 16px;
    }
    
    .search-row {
        gap: 16px;
    }
    
    /* Show mobile features */
    .select-indicator {
        display: flex;
        background: #667eea;
        color: white;
        width: 30px;
        height: 30px;
        border-radius: 50%;
        align-items: center;
        justify-content: center;
        font-size: 16px;
        font-weight: bold;
        transition: all 0.3s ease;
        flex-shrink: 0;
    }
    
    .franchise-header {
        display: flex;
        justify-content: space-between;
        align-items: flex-start;
        margin-bottom: 12px;
    }
    
    .franchise-name {
        flex: 1;
        margin-right: 12px;
        margin-bottom: 0;
    }
    
    .franchise-item.selected .select-indicator {
        background: #48bb78;
        transform: scale(1.1);
    }
    
    .mobile-only {
        display: block !important;
    }
    
    .desktop-only {
        display: none !important;
    }
    
    .comparison-cards {
        display: block;
        padding: 20px 16px;
    }
    
    .table-container {
        display: none;
    }
    
    .toggle-btn {
        display: block;
        background: #667eea;
        color: white;
        border: none;
        border-radius: 8px;
        padding: 8px 12px;
        cursor: pointer;
        font-size: 14px;
        transition: all 0.3s ease;
    }
    
    .comparison-actions {
        flex-direction: row;
        justify-content: center;
    }
    
    .share-button, .clear-button {
        flex: 0 1 200px;
    }
}

/* =================================
   ACCESSIBILITY & INTERACTIONS
   ================================= */
.franchise-item:focus,
.search-button:focus,
.compare-button:focus,
.share-button:focus,
.clear-button:focus,
.load-more-button:focus {
    outline: 3px solid #667eea;
    outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .crown-icon {
        animation: none;
    }
}

@media (prefers-contrast: high) {
    .franchise-item {
        border-width: 3px;
    }
    
    .franchise-item.selected {
        border-color: #000;
        background: #fff;
    }
    
    .selected-item {
        background: #000;
        color: #fff;
    }
}

/* =================================
   PRINT STYLES
   ================================= */
@media print {
    .search-filters,
    .comparison-actions,
    .load-more-container,
    .toggle-btn,
    .select-indicator {
        display: none !important;
    }
    
    .comparison-cards {
        display: block !important;
    }
    
    .table-container {
        display: none !important;
    }
    
    .franchise-item {
        break-inside: avoid;
        border: 1px solid #000;
    }
}


html {
    scroll-behavior: smooth;
}