/* CSS específico para página de clientes */

/* Integration Badge */
.integration-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.25rem 0.5rem;
    background-color: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 0.375rem;
    font-size: 0.75rem;
    font-weight: 500;
    color: #374151;
    white-space: nowrap;
}

.integration-badge:hover {
    background-color: #f1f5f9;
    border-color: #cbd5e1;
}

.integration-icon {
    font-size: 0.875rem;
    line-height: 1;
}

.integration-name {
    text-transform: capitalize;
}

/* Specific integration colors */
.integration-badge[title*="Hotmart"] {
    background-color: #fef3c7;
    border-color: #f59e0b;
    color: #92400e;
}

.integration-badge[title*="Kiwify"] {
    background-color: #dcfce7;
    border-color: #22c55e;
    color: #166534;
}

.integration-badge[title*="CartPanda"] {
    background-color: #e0e7ff;
    border-color: #6366f1;
    color: #3730a3;
}

.integration-badge[title*="Kirvano"] {
    background-color: #fef3c7;
    border-color: #d97706;
    color: #92400e;
}

.integration-badge[title*="Ticto"] {
    background-color: #ede9fe;
    border-color: #8b5cf6;
    color: #5b21b6;
}

.integration-badge[title*="Payt"] {
    background-color: #ecfdf5;
    border-color: #10b981;
    color: #047857;
}

.integration-badge[title*="Lastlink"] {
    background-color: #fef2f2;
    border-color: #ef4444;
    color: #991b1b;
}

.integration-badge[title*="Pepper"] {
    background-color: #fef3c7;
    border-color: #f59e0b;
    color: #92400e;
}

.integration-badge[title*="Disruptty"] {
    background-color: #f0f9ff;
    border-color: #0ea5e9;
    color: #0c4a6e;
}

.integration-badge[title*="Doppus"] {
    background-color: #fefce8;
    border-color: #eab308;
    color: #713f12;
}

.integration-badge[title*="Manual"] {
    background-color: #f3f4f6;
    border-color: #9ca3af;
    color: #374151;
}

/* Title with icon */
.page-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.title-icon {
    color: #64748b;
    flex-shrink: 0;
}

/* Filters Section */
.filters-section {
    background-color: white;
    border-radius: 0.75rem;
    border: 1px solid #e2e8f0;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    display: grid;
    grid-template-columns: 2fr 1.2fr 1fr 1fr 1fr auto;
    gap: 1rem;
    align-items: end;
}

.search-filter,
.select-filter,
.date-filter {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.search-filter label,
.select-filter label,
.date-filter label {
    font-size: 0.875rem;
    font-weight: 500;
    color: #374151;
}

/* Search Input */
.search-input-container {
    position: relative;
}

.search-icon {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: #9ca3af;
    pointer-events: none;
}

.search-input {
    width: 100%;
    padding: 0.625rem 0.75rem 0.625rem 2.5rem;
    border: 1px solid #d1d5db;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    transition: all 0.2s ease;
    background-color: white;
}

.search-input:focus {
    outline: none;
    border-color: #8b5cf6;
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.1);
}

.search-input::placeholder {
    color: #9ca3af;
}

/* Select and Date Inputs */
.filter-select,
.date-input {
    width: 100%;
    padding: 0.625rem 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    background-color: white;
    transition: all 0.2s ease;
}

.filter-select:focus,
.date-input:focus {
    outline: none;
    border-color: #8b5cf6;
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.1);
}

.filter-select {
    cursor: pointer;
}

/* Clear Filters Button */
.filter-actions {
    display: flex;
    align-items: end;
}

.clear-filters-btn {
    background: none;
    border: none;
    color: #8b5cf6;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 0.375rem;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.clear-filters-btn:hover {
    background-color: #f3f4f6;
    color: #7c3aed;
}

/* Results Summary */
.results-summary {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
    font-size: 0.875rem;
    color: #64748b;
}

.filter-icon {
    color: #9ca3af;
}

/* Clients Container */
.clients-container {
    background-color: white;
    border-radius: 0.75rem;
    border: 1px solid #e2e8f0;
    overflow: hidden;
}

/* Empty State Customization for Clients */
.clients-container .empty-state {
    border: none;
    border-radius: 0;
    margin-top: 0;
}

/* Clients Table */
.clients-table-container {
    overflow-x: auto;
}

.clients-table {
    width: 100%;
    border-collapse: collapse;
}

.clients-table th {
    background-color: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    padding: 1rem;
    text-align: left;
    font-size: 0.875rem;
    font-weight: 600;
    color: #374151;
}

.clients-table td {
    padding: 1rem;
    border-bottom: 1px solid #f1f5f9;
    font-size: 0.875rem;
    color: #374151;
}

.clients-table tbody tr:hover {
    background-color: #f8fafc;
}

.clients-table tbody tr:last-child td {
    border-bottom: none;
}

/* Status Badge */
.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 500;
}

.status-badge.active {
    background-color: #dcfce7;
    color: #166534;
}

.status-badge.inactive {
    background-color: #fef2f2;
    color: #991b1b;
}

.status-badge.suspended {
    background-color: #fef3c7;
    color: #92400e;
}

.status-badge.pending {
    background-color: #e0e7ff;
    color: #3730a3;
}

/* Actions Column */
.action-buttons-table {
    display: flex;
    gap: 0.5rem;
}

/* Modal Loading Spinner */
.modal-spinner {
    display: none;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    border-radius: 0.75rem;
}

.modal-spinner.active {
    display: flex;
}

.spinner {
    width: 32px;
    height: 32px;
    border: 3px solid #e5e7eb;
    border-top: 3px solid #3b82f6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Form Messages */
.form-messages {
    margin-bottom: 1rem;
}

.form-message {
    padding: 0.75rem;
    border-radius: 0.5rem;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    border: 1px solid;
    animation: slideDown 0.3s ease-out;
}

.form-message-content {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.form-message-content svg {
    flex-shrink: 0;
}

.form-success {
    background-color: #dcfce7;
    border-color: #16a34a;
    color: #166534;
}

.form-error {
    background-color: #fef2f2;
    border-color: #ef4444;
    color: #991b1b;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.action-btn {
    padding: 0.375rem;
    border: none;
    border-radius: 0.375rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.action-btn.edit {
    background-color: #eff6ff;
    color: #2563eb;
}

.action-btn.edit:hover {
    background-color: #dbeafe;
}

.action-btn.delete {
    background-color: #fef2f2;
    color: #dc2626;
}

.action-btn.delete:hover {
    background-color: #fee2e2;
}

/* Mobile Responsiveness */
@media (max-width: 1024px) {
    .filters-section {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .filter-actions {
        justify-content: center;
    }
}

@media (max-width: 768px) {
    .page-header {
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
    }

    .action-buttons {
        width: 100%;
    }

    .btn {
        width: 100%;
        justify-content: center;
    }

    .filters-section {
        padding: 1rem;
    }

    .clients-table {
        font-size: 0.75rem;
    }

    .clients-table th,
    .clients-table td {
        padding: 0.75rem 0.5rem;
    }

    /* Stack table on mobile */
    .clients-table-container {
        overflow-x: scroll;
    }
}

@media (max-width: 640px) {
    .page-title {
        font-size: 1.5rem;
    }

    .title-icon {
        width: 20px;
        height: 20px;
    }

    .results-summary {
        font-size: 0.75rem;
    }
}

/* Loading Spinner Container */
.loading-spinner-container {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4rem 2rem;
    min-height: 300px;
}

.clients-loading-spinner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

/* Spinner Animation - apenas o círculo gira */
.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #f3f4f6;
    border-top: 3px solid #8b5cf6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.loading-text {
    color: #64748b;
    font-size: 0.875rem;
    font-weight: 500;
    margin: 0;
    /* Texto não gira */
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

/* Legacy Loading State */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    color: #64748b;
}

.loading svg {
    animation: spin 1s linear infinite;
}

/* Menu active state for clients page */
.menu-link.active {
    color: #8b5cf6;
    background-color: #ede9fe;
}

/* Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    backdrop-filter: blur(4px);
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal-container {
    background-color: white;
    border-radius: 1rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    transform: scale(0.95) translateY(20px);
    transition: all 0.3s ease;
}

.modal-overlay.active .modal-container {
    transform: scale(1) translateY(0);
}

.modal-small {
    max-width: 400px;
}

/* Modal Header */
.modal-header {
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    padding: 1.5rem 1.5rem 1rem 1.5rem;
    border-bottom: 1px solid #f1f5f9;
}

.modal-title {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    font-size: 1.125rem;
    font-weight: 600;
    color: #1e293b;
    margin: 0;
    text-align: center;
}

.modal-close {
    background: none;
    border: none;
    color: #64748b;
    position: absolute;
    right: 1.5rem;
    top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 0.5rem;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    background-color: #f1f5f9;
    color: #374151;
}

/* Modal Content */
.modal-content {
    padding: 1.5rem;
}

.modal-form {
    padding: 1.5rem;
}

.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: #374151;
    margin-bottom: 0.5rem;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid #d1d5db;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    transition: all 0.2s ease;
    background-color: white;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #8b5cf6;
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.1);
}

.form-group input::placeholder {
    color: #9ca3af;
}

/* Modal Actions */
.modal-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid #f1f5f9;
}

.btn-danger {
    background-color: #ef4444;
    color: white;
    border: 1px solid #ef4444;
}

.btn-danger:hover {
    background-color: #dc2626;
    border-color: #dc2626;
    transform: translateY(-1px);
}

/* Delete Modal Specific Styles */
.delete-warning {
    display: flex;
    justify-content: center;
    margin-bottom: 1.5rem;
}

.warning-icon {
    color: #f59e0b;
    background-color: #fef3c7;
    padding: 1rem;
    border-radius: 50%;
}

.delete-message {
    text-align: center;
    font-size: 1rem;
    color: #374151;
    margin-bottom: 0.5rem;
}

.delete-submessage {
    text-align: center;
    font-size: 0.875rem;
    color: #64748b;
    margin-bottom: 0;
}

.text-red {
    color: #ef4444;
}

.text-primary {
    color: #8b5cf6;
}

/* Confirm Modal Specific Styles */
.confirm-icon {
    display: flex;
    justify-content: center;
    margin-bottom: 1.5rem;
}

.info-icon {
    color: #3b82f6;
    background-color: #dbeafe;
    padding: 1rem;
    border-radius: 50%;
}

.confirm-message {
    text-align: center;
    font-size: 1rem;
    color: #374151;
    margin-bottom: 0.5rem;
}

.confirm-submessage {
    text-align: center;
    font-size: 0.875rem;
    color: #64748b;
    margin-bottom: 0;
}

/* Mobile Responsiveness for Modals */
@media (max-width: 640px) {
    .modal-container {
        width: 95%;
        margin: 1rem;
    }
    
    .modal-header {
        padding: 1rem 1rem 0.75rem 1rem;
    }
    
    .modal-form,
    .modal-content {
        padding: 1rem;
    }
    
    .modal-title {
        font-size: 1rem;
    }
    
    .modal-actions {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .modal-actions .btn {
        width: 100%;
        justify-content: center;
    }
    
    .form-group input,
    .form-group select {
        padding: 0.625rem 0.875rem;
    }
}

/* Animation for modal backdrop */
@keyframes modalFadeIn {
    from {
        opacity: 0;
        backdrop-filter: blur(0px);
    }
    to {
        opacity: 1;
        backdrop-filter: blur(4px);
    }
}

@keyframes modalSlideIn {
    from {
        transform: scale(0.95) translateY(20px);
        opacity: 0;
    }
    to {
        transform: scale(1) translateY(0);
        opacity: 1;
    }
}

/* Loading state for form submission */
.modal-form.loading .btn {
    opacity: 0.7;
    pointer-events: none;
}

.modal-form.loading .btn svg {
    animation: spin 1s linear infinite;
}

/* Success feedback */
.form-success {
    background-color: #dcfce7;
    border: 1px solid #bbf7d0;
    color: #166534;
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.form-error {
    background-color: #fef2f2;
    border: 1px solid #fecaca;
    color: #991b1b;
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}