/* Frontend Styles for Cadastro de Empresas Plugin */

/* Container Principal */
.cadastro-empresas-lista {
    margin: 20px 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen-Sans, Ubuntu, Cantarell, 'Helvetica Neue', sans-serif;
}

/* Grid de Empresas */
.empresas-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 24px;
    margin: 24px 0;
}

/* Card da Empresa */
.empresa-card {
    background: white;
    border: 1px solid #e1e5e9;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
    position: relative;
}

.empresa-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

/* Categoria Badge */
.empresa-categoria {
    color: white;
    padding: 12px 16px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    position: relative;
}

.empresa-categoria::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: rgba(255, 255, 255, 0.3);
}

/* Conteúdo da Empresa */
.empresa-content {
    padding: 20px;
}

.empresa-sala {
    color: #6c757d;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.empresa-nome {
    margin: 0 0 16px 0;
    color: #2c3e50;
    font-size: 20px;
    font-weight: 700;
    line-height: 1.3;
}

.empresa-ramo {
    color: #495057;
    margin-bottom: 12px;
    font-style: italic;
    font-size: 14px;
}

.empresa-telefone {
    color: #2c3e50;
    margin-bottom: 8px;
    font-weight: 500;
    font-size: 15px;
}

.empresa-telefone::before {
    content: '📞';
    margin-right: 8px;
}

.empresa-email {
    margin-bottom: 16px;
    font-size: 14px;
}

.empresa-email a {
    color: #0073aa;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s ease;
}

.empresa-email a:hover {
    color: #005a87;
    text-decoration: underline;
}

.empresa-email::before {
    content: '✉️';
    margin-right: 8px;
}

.empresa-endereco {
    color: #6c757d;
    font-size: 13px;
    margin-bottom: 12px;
    line-height: 1.4;
}

.empresa-endereco::before {
    content: '📍';
    margin-right: 8px;
}

/* QR Code */
.empresa-qrcode {
    text-align: center;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid #e9ecef;
}

.empresa-qrcode img {
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Paginação */
.empresas-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin: 40px 0;
    flex-wrap: wrap;
}

.page-link,
.page-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    padding: 0 12px;
    border: 2px solid #e1e5e9;
    text-decoration: none;
    color: #495057;
    border-radius: 8px;
    font-weight: 500;
    transition: all 0.2s ease;
    background: white;
}

.page-link:hover {
    background-color: #0073aa;
    color: white;
    border-color: #0073aa;
    transform: translateY(-2px);
}

.page-number.current {
    background-color: #0073aa;
    color: white;
    border-color: #0073aa;
    box-shadow: 0 4px 12px rgba(0, 115, 170, 0.3);
}

/* Formulário de Pesquisa */
.cadastro-empresas-pesquisa {
    margin: 24px 0;
    padding: 24px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 12px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
}

.search-fields {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    align-items: center;
}

.search-input {
    flex: 1;
    min-width: 250px;
    padding: 12px 16px;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    font-size: 15px;
    transition: border-color 0.2s ease;
    background: white;
}

.search-input:focus {
    outline: none;
    border-color: #0073aa;
    box-shadow: 0 0 0 3px rgba(0, 115, 170, 0.1);
}

.categoria-filter {
    padding: 12px 16px;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    font-size: 15px;
    min-width: 180px;
    background: white;
    cursor: pointer;
}

.categoria-filter:focus {
    outline: none;
    border-color: #0073aa;
}

.search-button {
    padding: 12px 24px;
    background: linear-gradient(135deg, #0073aa 0%, #005a87 100%);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 15px;
    font-weight: 600;
    transition: all 0.2s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.search-button:hover {
    background: linear-gradient(135deg, #005a87 0%, #004a73 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 115, 170, 0.3);
}

/* Mensagem Vazia */
.no-empresas {
    text-align: center;
    color: #6c757d;
    font-style: italic;
    padding: 60px 20px;
    background: #f8f9fa;
    border-radius: 12px;
    margin: 20px 0;
}

.no-empresas::before {
    content: '🔍';
    font-size: 48px;
    display: block;
    margin-bottom: 16px;
}

/* QR Code Individual */
.cadastro-empresa-qrcode {
    text-align: center;
    margin: 24px 0;
    padding: 24px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
}

.cadastro-empresa-qrcode h4 {
    margin-bottom: 16px;
    color: #2c3e50;
    font-size: 18px;
}

.cadastro-empresa-qrcode img {
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}

/* Categoria Específica */
.cadastro-empresas-categoria .categoria-titulo {
    margin-bottom: 16px;
    font-size: 28px;
    font-weight: 700;
    text-align: center;
}

.categoria-descricao {
    color: #6c757d;
    margin-bottom: 24px;
    font-style: italic;
    text-align: center;
    font-size: 16px;
}

/* Loading States */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 32px;
    height: 32px;
    margin: -16px 0 0 -16px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #0073aa;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Temas Alternativos */
.empresas-grid.theme-minimal .empresa-card {
    border: none;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    border-radius: 6px;
}

.empresas-grid.theme-modern .empresa-card {
    border-radius: 16px;
    background: linear-gradient(145deg, #ffffff 0%, #f8f9fa 100%);
}

/* Responsividade */
@media (max-width: 768px) {
    .empresas-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    .search-fields {
        flex-direction: column;
        align-items: stretch;
    }
    
    .search-input,
    .categoria-filter,
    .search-button {
        width: 100%;
        margin-bottom: 8px;
    }
    
    .empresas-pagination {
        gap: 4px;
    }
    
    .page-link,
    .page-number {
        min-width: 36px;
        height: 36px;
        padding: 0 8px;
        font-size: 14px;
    }
    
    .empresa-content {
        padding: 16px;
    }
    
    .empresa-nome {
        font-size: 18px;
    }
    
    .cadastro-empresas-pesquisa {
        padding: 16px;
    }
}

@media (max-width: 480px) {
    .empresas-grid {
        gap: 12px;
    }
    
    .empresa-content {
        padding: 12px;
    }
    
    .empresa-nome {
        font-size: 16px;
    }
    
    .cadastro-empresas-pesquisa {
        margin: 16px 0;
        padding: 12px;
    }
}

/* Impressão */
@media print {
    .empresas-grid {
        display: block;
    }
    
    .empresa-card {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #ddd;
        margin-bottom: 16px;
    }
    
    .search-button,
    .empresas-pagination,
    .cadastro-empresas-pesquisa {
        display: none;
    }
    
    .empresa-qrcode {
        display: none;
    }
}

/* Acessibilidade */
.empresa-card:focus-within {
    outline: 2px solid #0073aa;
    outline-offset: 2px;
}

.search-input:focus,
.categoria-filter:focus,
.search-button:focus {
    outline: 2px solid #0073aa;
    outline-offset: 2px;
}

/* Modo Escuro */
@media (prefers-color-scheme: dark) {
    .empresa-card {
        background: #1e1e1e;
        border-color: #333;
        color: #e0e0e0;
    }
    
    .empresa-nome {
        color: #ffffff;
    }
    
    .empresa-sala,
    .empresa-ramo,
    .empresa-endereco {
        color: #b0b0b0;
    }
    
    .cadastro-empresas-pesquisa {
        background: linear-gradient(135deg, #2a2a2a 0%, #1e1e1e 100%);
    }
    
    .search-input,
    .categoria-filter {
        background: #2a2a2a;
        border-color: #444;
        color: #e0e0e0;
    }
    
    .no-empresas {
        background: #2a2a2a;
        color: #b0b0b0;
    }
}

/* Animações */
.empresa-card {
    animation: fadeInUp 0.6s ease-out;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Stagger animation para múltiplos cards */
.empresa-card:nth-child(1) { animation-delay: 0.1s; }
.empresa-card:nth-child(2) { animation-delay: 0.2s; }
.empresa-card:nth-child(3) { animation-delay: 0.3s; }
.empresa-card:nth-child(4) { animation-delay: 0.4s; }
.empresa-card:nth-child(5) { animation-delay: 0.5s; }
.empresa-card:nth-child(6) { animation-delay: 0.6s; }

/* Controles da listagem */
.empresas-controls {
    --vp-primary: #00A24C;
    --vp-primary-dark: #007f3c;
    --vp-accent: #88B13D;
    --vp-surface: #f6fbf4;
    --vp-border: #d6e9d7;
    --vp-text: #204128;
    margin: 20px 0;
    padding: 12px 14px;
    border: 1px solid var(--vp-border);
    border-radius: 16px;
    background: linear-gradient(180deg, #ffffff 0%, var(--vp-surface) 100%);
    box-shadow: 0 8px 20px rgba(0, 162, 76, 0.08);
}

.empresas-controls-form {
    display: flex;
    align-items: center;
    gap: 12px;
}

.control-left {
    display: flex;
    align-items: stretch;
    gap: 0;
    flex: 0 0 auto;
    height: 44px;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
}

.per-page-select {
    box-sizing: border-box;
    height: 44px !important;
    min-height: 44px;
    max-height: 44px;
    min-width: 52px;
    padding: 0 6px;
    border: 1px solid var(--vp-border);
    border-radius: 12px;
    background: #fff;
    color: var(--vp-text);
    font-size: 14px;
    font-weight: 600;
    line-height: 1;
    margin: 0;
    appearance: none;
    -webkit-appearance: none;
    text-align: center;
    text-align-last: center;
}

.per-page-text {
    display: none;
}

.control-right {
    flex: 1 1 auto;
    min-width: 0;
}

.empresas-controls .search-container {
    display: flex;
    align-items: stretch;
    gap: 10px;
    width: 100%;
}

.empresas-controls .search-input {
    box-sizing: border-box;
    flex: 1 1 auto;
    min-width: 0;
    height: 44px !important;
    min-height: 44px;
    max-height: 44px;
    padding: 0 16px;
    border: 1px solid var(--vp-border);
    border-radius: 12px;
    background: #fff;
    color: var(--vp-text);
    font-size: 15px;
    line-height: 1.2;
    margin: 0;
    box-shadow: none;
}

.empresas-controls .search-input::placeholder {
    color: #6f8e73;
}

.empresas-controls .search-button {
    box-sizing: border-box;
    width: 44px;
    height: 44px !important;
    min-height: 44px !important;
    max-height: 44px;
    flex: 0 0 44px;
    padding: 0;
    border: none;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--vp-primary) 0%, var(--vp-accent) 100%);
    color: #fff;
    box-shadow: none;
    transform: none;
    text-transform: none;
    letter-spacing: 0;
    line-height: 1;
    margin: 0;
    appearance: none;
    -webkit-appearance: none;
}

.empresas-controls .search-button:hover {
    background: linear-gradient(135deg, var(--vp-primary-dark) 0%, var(--vp-primary) 100%);
    box-shadow: none;
    transform: none;
}

.empresas-controls .search-icon {
    display: inline-flex;
    width: 20px;
    height: 20px;
    align-items: center;
    justify-content: center;
}

.empresas-controls .search-icon svg {
    width: 20px;
    height: 20px;
    display: block;
    fill: currentColor;
}

.empresas-controls .search-input:focus,
.empresas-controls .per-page-select:focus,
.empresas-controls .search-button:focus {
    outline: none;
    border-color: var(--vp-primary);
    box-shadow: 0 0 0 3px rgba(0, 162, 76, 0.12);
}

.empresas-table thead th {
    background: linear-gradient(180deg, #dff1df 0%, #cfe7c8 100%);
    color: #204128;
    border-bottom: 2px solid #88B13D;
}

.empresas-table thead th a {
    color: #204128;
}

.empresas-table thead th .sort {
    font-size: 0.85em;
    opacity: 0.3;
    transition: opacity 0.2s ease;
}
.empresas-table thead th .sort.active {
    opacity: 1;
    color: #3d6a1b;
    font-weight: 700;
}
.empresas-table thead th a:hover .sort {
    opacity: 0.7;
}

.empresas-table tbody td {
    border-bottom: 1px solid #d6e9d7;
    color: #2b3b2e;
}

.empresas-table tbody tr:nth-child(odd) {
    background: #ffffff;
}

.empresas-table tbody tr:nth-child(even) {
    background: #f6fbf4;
}

@media (max-width: 640px) {
    .empresas-controls {
        padding: 12px;
    }

    .empresas-controls-form {
        display: grid;
        grid-template-columns: auto 1fr;
        gap: 8px;
        align-items: center;
    }

    .control-left {
        width: auto;
        min-width: 0;
        padding: 0;
    }

    .per-page-select {
        min-width: 50px;
        padding: 0 8px;
    }

    .per-page-text {
        display: none;
    }

    .empresas-controls .search-container {
        gap: 8px;
    }

    .empresas-controls .search-input {
        font-size: 14px;
        padding: 0 14px;
    }
}

/* ========================================
   Filter Bar - Modern Collapsible
   ======================================== */

.filter-bar {
    margin-top: 10px;
}

.filter-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    background: linear-gradient(135deg, var(--vp-primary, #00A24C) 0%, var(--vp-accent, #88B13D) 100%);
    color: #fff;
    border-radius: 12px;
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    transition: all 0.25s ease;
    user-select: none;
    box-shadow: 0 2px 8px rgba(0, 162, 76, 0.15);
}

.filter-toggle:hover {
    box-shadow: 0 4px 16px rgba(0, 162, 76, 0.3);
    transform: translateY(-1px);
}

.filter-toggle:active {
    transform: translateY(0);
    box-shadow: 0 1px 4px rgba(0, 162, 76, 0.15);
}

.filter-toggle:focus-visible {
    outline: 2px solid var(--vp-primary, #00A24C);
    outline-offset: 2px;
}

.filter-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    flex-shrink: 0;
}

.filter-toggle-text {
    flex: 1;
    white-space: nowrap;
}

.filter-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 22px;
    background: rgba(255, 255, 255, 0.25);
    color: #fff;
    border-radius: 11px;
    font-size: 12px;
    font-weight: 700;
    padding: 0 6px;
    flex-shrink: 0;
}

.filter-arrow {
    font-size: 11px;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
}

.filter-arrow.open {
    transform: rotate(180deg);
}

.filter-panel-form {
    margin-top: 8px;
}

.filter-panel {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 10px;
    padding: 14px 16px;
    background: var(--vp-surface, #f6fbf4);
    border: 1px solid var(--vp-border, #d6e9d7);
    border-radius: 12px;
    animation: vpFilterSlideDown 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes vpFilterSlideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    min-width: 0;
}

.filter-group .filter-label {
    font-weight: 600;
    color: var(--vp-text, #204128);
    font-size: 13px;
    white-space: nowrap;
    flex-shrink: 0;
}

.filter-select {
    height: 38px;
    padding: 0 30px 0 10px;
    border: 1px solid var(--vp-border, #d6e9d7);
    border-radius: 10px;
    background: #fff;
    color: var(--vp-text, #204128);
    font-size: 13px;
    font-weight: 500;
    flex: 1;
    min-width: 0;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23204128' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
    background-size: 10px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.filter-select:hover {
    border-color: var(--vp-primary, #00A24C);
}

.filter-select:focus {
    outline: none;
    border-color: var(--vp-primary, #00A24C);
    box-shadow: 0 0 0 3px rgba(0, 162, 76, 0.12);
}

.filter-clear {
    display: inline-flex;
    align-items: center;
    height: 32px;
    padding: 0 12px;
    background: #fff;
    border: 1px solid var(--vp-border, #d6e9d7);
    border-radius: 8px;
    color: var(--vp-text, #204128);
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.filter-clear:hover {
    background: #fff0f0;
    border-color: #e74c3c;
    color: #e74c3c;
    text-decoration: none;
}

@media (max-width: 640px) {
    .filter-panel {
        grid-template-columns: 1fr;
        padding: 10px;
        gap: 8px;
    }

    .filter-group {
        width: 100%;
    }

    .filter-select {
        flex: 1;
    }

    .filter-toggle {
        width: 100%;
        justify-content: flex-start;
    }
}
