/* PHC GO - Documentos Multi-Empresa - Estilos Frontend */

.phc-container-modern {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    max-width: 1200px;
    margin: 0 auto;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 25px 50px rgba(0,0,0,0.15);
    position: relative;
}

.phc-header {
    background: rgba(255,255,255,0.1);
    backdrop-filter: blur(20px);
    padding: 2rem;
    text-align: center;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    position: relative;
    z-index: 1;
}

.phc-header-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    filter: drop-shadow(0 4px 8px rgba(0,0,0,0.3));
}

.phc-header h1 {
    color: white;
    font-size: 2.5rem;
    font-weight: 700;
    margin: 0 0 0.5rem 0;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.phc-header-subtitle {
    color: rgba(255,255,255,0.8);
    font-size: 1.1rem;
    margin: 0;
    font-weight: 300;
}

#phc-results {
    background: white;
    position: relative;
    z-index: 1;
}

.phc-toolbar {
    background: rgba(255,255,255,0.95);
    backdrop-filter: blur(10px);
    padding: 1.5rem 2rem;
    display: flex;
    align-items: flex-start;
    gap: 1.5rem;
    border-bottom: 1px solid rgba(0,0,0,0.05);
}

.phc-search-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.phc-search-input {
    width: 100%;
    padding: 1rem 1.5rem;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    font-size: 1rem;
    transition: all 0.3s ease;
    background: white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.phc-search-input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.phc-search-filters {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.phc-filter-select {
    padding: 0.75rem 1rem;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    background: white;
    color: #374151;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 150px;
}

.phc-toolbar-actions {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.phc-btn-refresh, .phc-btn-export {
    background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
    color: white;
    border: none;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s ease;
    white-space: nowrap;
    min-width: 120px;
}

.phc-btn-export {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

.phc-btn-refresh:hover, .phc-btn-export:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(139, 92, 246, 0.4);
}

.phc-summary-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    padding: 2rem;
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
}

.phc-stat-card {
    background: white;
    padding: 1.5rem;
    border-radius: 16px;
    text-align: center;
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.phc-stat-card::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #667eea, #764ba2);
}

.phc-stat-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 25px rgba(0,0,0,0.1);
}

.phc-stat-number {
    font-size: 2.5rem;
    font-weight: 800;
    color: #1e293b;
    margin-bottom: 0.5rem;
}

.phc-stat-label {
    color: #64748b;
    font-weight: 500;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.phc-company-section {
    margin: 2rem;
    background: white;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 8px 25px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
}

.phc-company-header {
    background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
    color: white;
    padding: 1.5rem 2rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.phc-company-icon {
    font-size: 1.8rem;
}

.phc-company-name {
    font-size: 1.3rem;
    font-weight: 600;
    flex-grow: 1;
}

.phc-company-count {
    background: rgba(255,255,255,0.15);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.9rem;
}

.phc-client-section {
    padding: 2rem;
}

.phc-success {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    padding: 1rem 1.5rem;
    border-radius: 12px;
    margin-bottom: 1.5rem;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.phc-success h4 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
}

.phc-tab-buttons {
    display: flex;
    background: #f8fafc;
    padding: 0.5rem;
    border-radius: 12px;
    margin-bottom: 1.5rem;
    gap: 0.5rem;
}

.phc-tab-button {
    flex: 1;
    padding: 1rem 1.5rem;
    background: transparent;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    color: #64748b;
    transition: all 0.3s ease;
}

.phc-tab-button.active {
    background: white;
    color: #1e293b;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.phc-tab-content {
    display: none;
}

.phc-tab-content.active {
    display: block;
}

.phc-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.phc-table thead th {
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    color: #1e293b;
    font-weight: 600;
    padding: 1rem 1.5rem;
    text-align: left;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.phc-table tbody tr {
    border-bottom: 1px solid #f1f5f9;
    transition: all 0.2s ease;
}

.phc-table tbody tr:hover {
    background: #f8fafc;
}

.phc-table tbody td {
    padding: 1rem 1.5rem;
    color: #334155;
    vertical-align: middle;
}

.phc-pdf-download {
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.phc-pdf-download:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(59, 130, 246, 0.4);
}

.phc-btn-download-receipt {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

.phc-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
}

.phc-status-active {
    background: #dcfce7;
    color: #16a34a;
}

.phc-status-voided {
    background: #fecaca;
    color: #dc2626;
}

.phc-info, .phc-error-modern {
    background: white;
    padding: 2rem;
    border-radius: 16px;
    margin: 2rem;
    text-align: center;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.phc-login-required {
    background: white;
    padding: 3rem;
    border-radius: 16px;
    margin: 2rem;
    text-align: center;
    box-shadow: 0 8px 25px rgba(0,0,0,0.1);
}

.phc-login-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.8;
}

.phc-btn-login {
    display: inline-block;
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
    color: white;
    padding: 1rem 2rem;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 600;
    margin-top: 1rem;
    transition: all 0.3s ease;
}

.phc-btn-login:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(59, 130, 246, 0.4);
    color: white;
    text-decoration: none;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.phc-loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid #f3f4f6;
    border-radius: 50%;
    border-top-color: #3b82f6;
    animation: spin 1s ease-in-out infinite;
    margin-right: 0.5rem;
}

/* Responsividade Mobile */
@media (max-width: 768px) {
    .phc-container-modern { 
        margin: 0.5rem; 
        border-radius: 15px;
    }
    
    .phc-header { 
        padding: 1.5rem 1rem; 
    }
    
    .phc-header-icon {
        font-size: 2rem;
    }
    
    .phc-header h1 { 
        font-size: 1.5rem; 
    }
    
    .phc-header-subtitle {
        font-size: 0.95rem;
    }
    
    .phc-toolbar { 
        flex-direction: column; 
        gap: 1rem;
        padding: 1rem;
    }
    
    .phc-search-container {
        width: 100%;
    }
    
    .phc-search-input {
        padding: 0.875rem 1rem;
        font-size: 16px; /* Evita zoom no iOS */
    }
    
    .phc-search-filters { 
        flex-direction: column;
        width: 100%;
    }
    
    .phc-filter-select {
        width: 100%;
        font-size: 16px; /* Evita zoom no iOS */
    }
    
    .phc-toolbar-actions { 
        flex-direction: row;
        width: 100%;
        gap: 0.5rem;
    }
    
    .phc-btn-refresh, .phc-btn-export {
        flex: 1;
        padding: 0.875rem 0.5rem;
        font-size: 0.9rem;
    }
    
    .phc-summary-stats {
        grid-template-columns: 1fr 1fr;
        gap: 1rem;
        padding: 1rem;
    }
    
    .phc-stat-card {
        padding: 1rem;
    }
    
    .phc-stat-number {
        font-size: 1.75rem;
    }
    
    .phc-stat-label {
        font-size: 0.75rem;
    }
    
    .phc-company-section {
        margin: 1rem;
    }
    
    .phc-company-header {
        padding: 1rem;
        flex-wrap: wrap;
    }
    
    .phc-company-icon {
        font-size: 1.5rem;
    }
    
    .phc-company-name {
        font-size: 1.1rem;
        flex: 1 1 auto;
    }
    
    .phc-company-count {
        font-size: 0.85rem;
        padding: 0.375rem 0.75rem;
    }
    
    .phc-client-section {
        padding: 1rem;
    }
    
    .phc-success {
        padding: 0.875rem 1rem;
    }
    
    .phc-success h4 {
        font-size: 1rem;
    }
    
    .phc-tab-buttons {
        flex-direction: column;
        padding: 0.375rem;
        gap: 0.25rem;
    }
    
    .phc-tab-button {
        padding: 0.875rem 1rem;
        font-size: 0.9rem;
    }
    
    /* Tabela responsiva com scroll horizontal */
    .phc-tab-content {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .phc-table {
        min-width: 600px;
        font-size: 0.85rem;
    }
    
    .phc-table thead th {
        padding: 0.75rem 0.875rem;
        font-size: 0.75rem;
    }
    
    .phc-table tbody td {
        padding: 0.75rem 0.875rem;
    }
    
    .phc-pdf-download {
        padding: 0.5rem 0.875rem;
        font-size: 0.8rem;
    }
    
    .phc-login-required {
        padding: 2rem 1rem;
        margin: 1rem;
    }
    
    .phc-login-icon {
        font-size: 3rem;
    }
}

/* Mobile muito pequeno */
@media (max-width: 375px) {
    .phc-header h1 {
        font-size: 1.25rem;
    }
    
    .phc-summary-stats {
        grid-template-columns: 1fr;
    }
    
    .phc-stat-card {
        padding: 0.875rem;
    }
    
    .phc-company-name {
        font-size: 1rem;
        width: 100%;
        margin-bottom: 0.5rem;
    }
    
    .phc-toolbar-actions {
        flex-direction: column;
    }
    
    .phc-btn-refresh, .phc-btn-export {
        width: 100%;
    }
}

/* Landscape mobile */
@media (max-width: 768px) and (orientation: landscape) {
    .phc-header {
        padding: 1rem;
    }
    
    .phc-header h1 {
        font-size: 1.75rem;
    }
    
    .phc-summary-stats {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* Indicador de scroll na tabela */
@media (max-width: 768px) {
    .phc-tab-content::after {
        content: "→ Deslize para ver mais";
        display: block;
        text-align: center;
        padding: 0.5rem;
        color: #6c757d;
        font-size: 0.75rem;
        font-style: italic;
    }
    
    .phc-tab-content::-webkit-scrollbar {
        height: 6px;
    }
    
    .phc-tab-content::-webkit-scrollbar-track {
        background: #f1f1f1;
        border-radius: 3px;
    }
    
    .phc-tab-content::-webkit-scrollbar-thumb {
        background: #888;
        border-radius: 3px;
    }
}

/* Cards mobile para tabelas */
@media (max-width: 768px) {
    .phc-table thead {
        display: none;
    }
    
    .phc-table tbody {
        display: block;
    }
    
    .phc-table tbody tr {
        display: block;
        margin-bottom: 1rem;
        background: white;
        border: 1px solid #e2e8f0;
        border-radius: 12px;
        padding: 1rem;
        box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    }
    
    .phc-table tbody tr:hover {
        box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    }
    
    .phc-table tbody td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 0.5rem 0;
        border-bottom: 1px solid #f1f5f9;
    }
    
    .phc-table tbody td:last-child {
        border-bottom: none;
        padding-top: 0.75rem;
    }
    
    .phc-table tbody td::before {
        content: attr(data-label);
        font-weight: 600;
        color: #64748b;
        font-size: 0.85rem;
        text-transform: uppercase;
        letter-spacing: 0.5px;
    }
    
    .phc-table tbody td[data-label="Ações"] {
        justify-content: center;
    }
    
    .phc-table tbody td[data-label="Ações"]::before {
        display: none;
    }
    
    .phc-pdf-download {
        width: 100%;
        padding: 0.75rem;
    }
    
    /* Remove indicador de scroll quando em modo card */
    .phc-tab-content::after {
        display: none;
    }
}

/* Touch-friendly mobile */
@media (pointer: coarse) {
    .phc-pdf-download,
    .phc-btn-refresh,
    .phc-btn-export,
    .phc-tab-button,
    .phc-btn-login {
        min-height: 44px; /* iOS touch target */
    }
}

/* Forçar conteúdo a ajustar sem scroll horizontal no mobile */
@media (max-width: 768px) {
    /* Tabela ocupa 100% e quebra linhas quando preciso */
    .phc-table { 
        min-width: 0; 
        width: 100%; 
        table-layout: fixed; 
    }
    .phc-table thead th,
    .phc-table tbody td { 
        white-space: normal; 
        word-wrap: break-word; 
        overflow-wrap: anywhere; 
    }

    /* Cartões mais compactos */
    .phc-table tbody tr { 
        padding: 0.75rem; 
    }

    /* Botão não ocupa a linha inteira e cabe no cartão */
    .phc-pdf-download {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: auto;
        max-width: 100%;
        padding: 0.5rem 1rem;
        font-size: 0.85rem;
        white-space: nowrap;
        overflow: visible;
        text-indent: 0;
        color: #fff !important;
    }
    
    /* Garantir que o texto do botão seja visível */
    .phc-pdf-download::before,
    .phc-pdf-download::after {
        display: none;
    }
}
