/* ============================================
   CSS PREMIUM PARA LISTAS SALVAS
   Design moderno e responsivo para mobile
   ============================================ */

/* RESET PARA MOBILE */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: #f8f9fa;
    -webkit-font-smoothing: antialiased;
}

/* CONTAINER PRINCIPAL */
.lista-supermercado-container {
    max-width: 100%;
    min-height: 100vh;
    padding: 20px 15px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.lista-supermercado-container h2 {
    color: white;
    font-size: 24px;
    font-weight: 800;
    text-align: center;
    margin: 0 0 25px 0;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    letter-spacing: -0.5px;
}

/* FILTRO MODERNO */
.filtro-listas-container {
    background: white;
    border-radius: 20px;
    padding: 20px;
    margin-bottom: 25px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.08);
}

.filtro-listas-container h3 {
    font-size: 18px;
    font-weight: 700;
    color: #2d3748;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

#form-filtrar-listas {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 15px;
}

.filtro-field {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.filtro-field label {
    font-size: 14px;
    font-weight: 600;
    color: #4a5568;
}

.filtro-field input {
    padding: 12px 16px;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    font-size: 15px;
    background: #f8fafc;
    transition: all 0.2s ease;
}

.filtro-field input:focus {
    border-color: #667eea;
    background: white;
    outline: none;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.filtro-buttons {
    grid-column: 1 / -1;
    display: flex;
    gap: 12px;
    margin-top: 10px;
}

.filtro-buttons button {
    flex: 1;
    padding: 14px 20px;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.filtro-buttons button:active {
    transform: scale(0.97);
}

#btn-filtrar {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.2);
}

#btn-limpar-filtros {
    background: #edf2f7;
    color: #4a5568;
}

#status-filtro {
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.5;
    display: none;
    margin-top: 15px;
}

#status-filtro.success {
    background: #d1fae5;
    border: 1px solid #10b981;
    color: #065f46;
}

#status-filtro.error {
    background: #fee2e2;
    border: 1px solid #ef4444;
    color: #991b1b;
}

/* NOTICE DE LIMITE */
.notice {
    background: white;
    border-radius: 15px;
    padding: 16px 20px;
    margin-bottom: 20px;
    border-left: 4px solid;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
}

.notice-warning {
    background: #fffbeb;
    border-color: #f59e0b;
    color: #92400e;
}

.notice-error {
    background: #fef2f2;
    border-color: #ef4444;
    color: #991b1b;
}

/* CONTAINER DE LISTAS */
.listas-salvas-container {
    background: white;
    border-radius: 20px;
    padding: 20px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.08);
}

#listas-salvas {
    margin-bottom: 25px;
}

/* CARDS DE LISTA */
.lista-card {
    background: white;
    border-radius: 18px;
    padding: 20px;
    margin-bottom: 15px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
    border: 1px solid #e5e7eb;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.lista-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

/* CABEÇALHO DA LISTA */
.lista-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 15px;
    gap: 15px;
}

.lista-info {
    flex: 1;
}

.lista-supermercado {
    font-size: 18px;
    font-weight: 800;
    color: #2d3748;
    margin-bottom: 5px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.lista-supermercado::before {
    content: '🏪';
    font-size: 20px;
}

.lista-data {
    font-size: 13px;
    color: #718096;
    display: flex;
    align-items: center;
    gap: 6px;
}

.lista-data::before {
    content: '📅';
    font-size: 14px;
}

.lista-actions {
    display: flex;
    gap: 8px;
}

.action-btn {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 18px;
}

.action-btn:active {
    transform: scale(0.95);
}

.btn-visualizar {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.2);
}

.btn-editar {
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.2);
}

.btn-excluir {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.2);
}

/* RESUMO DA LISTA */
.lista-resumo {
    background: #f8fafc;
    border-radius: 15px;
    padding: 16px;
    margin-bottom: 15px;
}

.resumo-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.resumo-item {
    text-align: center;
    padding: 12px;
    background: white;
    border-radius: 12px;
    border: 1px solid #e5e7eb;
}

.resumo-label {
    font-size: 12px;
    font-weight: 600;
    color: #718096;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
    display: block;
}

.resumo-valor {
    font-size: 16px;
    font-weight: 800;
    color: #2d3748;
}

.resumo-valor.total {
    color: #059669;
    font-size: 18px;
}

/* ITENS DA LISTA */
.lista-itens {
    margin-top: 15px;
}

.itens-header {
    font-size: 14px;
    font-weight: 600;
    color: #4a5568;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.itens-header::before {
    content: '🛒';
    font-size: 16px;
}

.itens-container {
    max-height: 200px;
    overflow-y: auto;
    padding-right: 10px;
}

.itens-container::-webkit-scrollbar {
    width: 6px;
}

.itens-container::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 3px;
}

.itens-container::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

.itens-container::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

.item-linha {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    background: white;
    border-radius: 10px;
    margin-bottom: 8px;
    border: 1px solid #e5e7eb;
}

.item-nome {
    flex: 1;
    font-size: 14px;
    font-weight: 600;
    color: #374151;
}

.item-quantidade {
    font-size: 13px;
    color: #667eea;
    font-weight: 700;
    margin: 0 12px;
    background: #e0e7ff;
    padding: 4px 8px;
    border-radius: 6px;
    min-width: 40px;
    text-align: center;
}

.item-valor {
    font-size: 14px;
    font-weight: 700;
    color: #059669;
    min-width: 70px;
    text-align: right;
}

/* BOTÃO CARREGAR MAIS */
.carregar-mais-container {
    text-align: center;
    padding-top: 20px;
    border-top: 1px solid #e5e7eb;
}

#carregar-mais-listas {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 14px 30px;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.2);
}

#carregar-mais-listas:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.3);
}

#carregar-mais-listas:active {
    transform: translateY(0);
}

/* LOADING STATE */
.carregando-listas {
    text-align: center;
    padding: 40px 20px;
}

.carregando-listas .spinner {
    margin: 0 auto 20px auto;
    width: 40px;
    height: 40px;
    border: 3px solid #e0e7ff;
    border-top-color: #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.carregando-listas p {
    color: #64748b;
    font-size: 15px;
    font-weight: 500;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* MENSAGEM SEM LISTAS */
.sem-listas {
    text-align: center;
    padding: 50px 20px;
}

.sem-listas .icon {
    font-size: 48px;
    margin-bottom: 20px;
    color: #cbd5e1;
}

.sem-listas h3 {
    color: #4b5563;
    font-size: 18px;
    margin-bottom: 10px;
}

.sem-listas p {
    color: #6b7280;
    font-size: 15px;
    line-height: 1.5;
}

/* MODAL ADICIONAR ITEM */
.modal-adicionar-item {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-adicionar-content {
    background: white;
    border-radius: 20px;
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
    animation: modalSlideUp 0.3s ease-out;
}

@keyframes modalSlideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-adicionar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid #e5e7eb;
}

.modal-adicionar-header h3 {
    font-size: 18px;
    font-weight: 700;
    color: #2d3748;
    margin: 0;
}

.btn-fechar-modal {
    background: #ef4444;
    color: white;
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 18px;
}

.modal-adicionar-body {
    padding: 20px;
}

.modal-field {
    margin-bottom: 20px;
}

.modal-field label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: #4a5568;
    margin-bottom: 8px;
}

.modal-field input {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    font-size: 16px;
    background: #f8fafc;
    transition: all 0.2s ease;
}

.modal-field input:focus {
    border-color: #667eea;
    background: white;
    outline: none;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.modal-fields-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.modal-adicionar-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-top: 25px;
}

.modal-adicionar-buttons button {
    padding: 14px 20px;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.modal-adicionar-buttons button:active {
    transform: scale(0.97);
}

.btn-confirmar-adicionar {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.2);
}

.btn-cancelar-adicionar {
    background: #edf2f7;
    color: #4a5568;
}

/* RESPONSIVIDADE */
@media (max-width: 768px) {
    .lista-supermercado-container {
        padding: 15px 12px;
    }
    
    .filtro-listas-container {
        padding: 16px;
    }
    
    #form-filtrar-listas {
        grid-template-columns: 1fr;
    }
    
    .filtro-buttons {
        flex-direction: column;
    }
    
    .lista-card {
        padding: 16px;
    }
    
    .lista-header {
        flex-direction: column;
        align-items: stretch;
    }
    
    .lista-actions {
        justify-content: center;
    }
    
    .resumo-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    .item-linha {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .item-quantidade {
        margin: 0;
        align-self: flex-start;
    }
    
    .item-valor {
        align-self: flex-start;
    }
    
    .modal-fields-grid {
        grid-template-columns: 1fr;
    }
    
    .modal-adicionar-buttons {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .lista-supermercado-container h2 {
        font-size: 22px;
    }
    
    .lista-supermercado {
        font-size: 16px;
    }
    
    .action-btn {
        width: 40px;
        height: 40px;
        font-size: 16px;
    }
    
    .resumo-valor {
        font-size: 15px;
    }
}

/* ANIMAÇÕES */
.lista-card {
    animation: fadeInUp 0.4s ease-out;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* PREVENIR ZOOM EM INPUTS */
@media screen and (max-width: 768px) {
    input, select, textarea {
        font-size: 16px !important;
    }
}

/* SCANNER MODAL (simplificado) */
.scanner-modal-lista {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #0f172a;
    z-index: 1000;
}

.scanner-modal-lista-content {
    height: 100%;
    display: flex;
    flex-direction: column;
}

.scanner-modal-lista-header {
    padding: 60px 20px 20px;
    background: #1e293b;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.scanner-modal-lista-header h3 {
    color: white;
    font-size: 20px;
    font-weight: 700;
    margin: 0;
}

#fechar-scanner-lista {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: none;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.scanner-modal-lista-body {
    flex: 1;
    padding: 20px;
    display: flex;
    flex-direction: column;
}

.scanner-viewport-lista {
    flex: 1;
    position: relative;
    overflow: hidden;
    border-radius: 20px;
    background: #1e293b;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.scanner-input-group-lista {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
}

.scanner-input-lista {
    flex: 1;
    padding: 16px;
    border: 2px solid #334155;
    border-radius: 15px;
    font-size: 16px;
    background: #1e293b;
    color: white;
}

.scanner-search-btn-lista {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 15px;
    padding: 0 24px;
    font-size: 16px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}