/* ========================================
   CLIENTES PAGE - ESTILOS OTIMIZADOS
   ======================================== */

:root {
    --card-bg: #1e2a3f;
    --card-border: #2d3e52;
    --row-hover: #252d3d;
    --success-color: #22c55e;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
}

body {
    min-height: 100vh;
}

.subheading {
    color: var(--muted);
    margin-top: 6px;
    font-size: 14px;
}

.header-actions {
    display: flex;
    gap: 12px;
}

/* ========================================
   AÇÕES EM MASSA
   ======================================== */

.bulk-actions-panel {
    background: linear-gradient(135deg, rgba(30,41,59,0.95) 0%, rgba(15,23,42,0.95) 100%);
    border: 1px solid rgba(139,92,246,0.2);
    border-radius: 12px;
    padding: 18px;
    margin-bottom: 24px;
}

.bulk-actions-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.bulk-actions-title {
    font-size: 15px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text);
}

.bulk-actions-title i {
    color: #8b5cf6;
}

.bulk-action-result {
    font-size: 13px;
    padding: 6px 12px;
    border-radius: 20px;
    background: rgba(34,197,94,0.1);
    color: #22c55e;
    border: 1px solid rgba(34,197,94,0.3);
    display: none;
    animation: slideDown 0.3s ease;
}

.bulk-action-result.visible {
    display: flex;
    align-items: center;
    gap: 8px;
}

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

.bulk-action-result.error {
    background: rgba(239,68,68,0.1);
    border-color: rgba(239,68,68,0.3);
    color: #ef4444;
}

.bulk-actions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 10px;
}

.bulk-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 14px 10px;
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,0.08);
    background: rgba(255,255,255,0.03);
    color: var(--text);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
}

.bulk-btn i {
    font-size: 20px;
    transition: transform 0.2s ease;
}

.bulk-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.bulk-btn:active {
    transform: translateY(0);
}

.bulk-btn.bulk-sync {
    border-color: rgba(34,197,94,0.3);
    background: rgba(34,197,94,0.1);
}

.bulk-btn.bulk-sync:hover {
    background: rgba(34,197,94,0.2);
    border-color: rgba(34,197,94,0.5);
}

.bulk-btn.bulk-sync i {
    color: #22c55e;
}

.bulk-btn.bulk-renew {
    border-color: rgba(59,130,246,0.3);
    background: rgba(59,130,246,0.1);
}

.bulk-btn.bulk-renew:hover {
    background: rgba(59,130,246,0.2);
    border-color: rgba(59,130,246,0.5);
}

.bulk-btn.bulk-renew i {
    color: #3b82f6;
}

.bulk-btn.bulk-export {
    border-color: rgba(139,92,246,0.3);
    background: rgba(139,92,246,0.1);
}

.bulk-btn.bulk-export:hover {
    background: rgba(139,92,246,0.2);
    border-color: rgba(139,92,246,0.5);
}

.bulk-btn.bulk-export i {
    color: #8b5cf6;
}

.bulk-btn.bulk-import {
    border-color: rgba(16,185,129,0.3);
    background: rgba(16,185,129,0.1);
}

.bulk-btn.bulk-import:hover {
    background: rgba(16,185,129,0.2);
    border-color: rgba(16,185,129,0.5);
}

.bulk-btn.bulk-import i {
    color: #10b981;
}

.bulk-btn.bulk-notify {
    border-color: rgba(234,179,8,0.3);
    background: rgba(234,179,8,0.1);
}

.bulk-btn.bulk-notify:hover {
    background: rgba(234,179,8,0.2);
    border-color: rgba(234,179,8,0.5);
}

.bulk-btn.bulk-notify i {
    color: #eab308;
}

/* ========================================
   CONTAINER PRINCIPAL
   ======================================== */

.clients-container {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 20px;
    margin-bottom: 24px;
}

@media (max-width: 1200px) {
    .clients-container {
        grid-template-columns: 1fr;
    }
}

/* ========================================
   PAINÉIS GERAIS
   ======================================== */

.panel {
    background: var(--card);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.3s ease;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    background: linear-gradient(180deg, rgba(255,255,255,0.05) 0%, transparent 100%);
}

.panel-title {
    font-size: 16px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text);
}

.panel-title i {
    font-size: 18px;
    color: #8b5cf6;
}

.panel-content {
    padding: 18px;
}

.btn-collapse {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 18px;
    transition: all 0.2s ease;
    padding: 4px 8px;
}

.btn-collapse:hover {
    color: var(--text);
    transform: rotate(180deg);
}

.list-stats {
    display: flex;
    gap: 8px;
}

.stat-badge {
    background: rgba(139,92,246,0.1);
    border: 1px solid rgba(139,92,246,0.3);
    color: #8b5cf6;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

/* ========================================
   FORMULÁRIO
   ======================================== */

.form-panel .panel-content {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.form-hint {
    font-size: 13px;
    color: var(--text-muted);
    margin: 0;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 6px;
}

.form-group label i {
    font-size: 14px;
    color: #8b5cf6;
}

.form-group input,
.form-group select {
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    color: var(--text);
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.2s ease;
}

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

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 10px;
}

@media (max-width: 768px) {
    .form-row {
        grid-template-columns: 1fr;
    }
}

.form-status {
    padding: 12px 14px;
    border-radius: 8px;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.form-status.info {
    background: rgba(59,130,246,0.1);
    border: 1px solid rgba(59,130,246,0.3);
    color: #3b82f6;
}

.form-status.success {
    background: rgba(34,197,94,0.1);
    border: 1px solid rgba(34,197,94,0.3);
    color: #22c55e;
}

.form-status.error {
    background: rgba(239,68,68,0.1);
    border: 1px solid rgba(239,68,68,0.3);
    color: #ef4444;
}

.form-actions {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 8px;
    margin-top: 8px;
}

@media (max-width: 768px) {
    .form-actions {
        grid-template-columns: 1fr;
    }
}

.form-actions .btn,
.form-actions .btn-outline {
    font-size: 13px;
    padding: 10px 14px;
}

/* ========================================
   LISTA DE CLIENTES
   ======================================== */

.list-content {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.list-controls {
    display: flex;
    gap: 10px;
}

.search-field {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
}

.search-field i {
    color: var(--text-muted);
    font-size: 14px;
}

.search-field input {
    flex: 1;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    color: var(--text);
    padding: 9px 12px;
    border-radius: 8px;
    font-size: 13px;
    transition: all 0.2s ease;
}

.search-field input:focus {
    outline: none;
    background: rgba(139,92,246,0.1);
    border-color: #8b5cf6;
}

#status-filter {
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    color: var(--text);
    padding: 9px 12px;
    border-radius: 8px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s ease;
}

#status-filter:hover,
#status-filter:focus {
    outline: none;
    background: rgba(139,92,246,0.1);
    border-color: #8b5cf6;
}

/* ========================================
   TABELA
   ======================================== */

.table-container {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.data-table thead {
    background: rgba(255,255,255,0.03);
    border-bottom: 2px solid rgba(255,255,255,0.1);
}

.data-table th {
    text-align: left;
    padding: 12px 10px;
    font-weight: 600;
    color: var(--text-muted);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.data-table td {
    padding: 12px 10px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    color: var(--text);
}

.data-table tbody tr {
    transition: all 0.2s ease;
}

.data-table tbody tr:hover {
    background: var(--row-hover);
}

.data-table tbody tr td:first-child {
    border-left: 3px solid transparent;
}

.data-table tbody tr:hover td:first-child {
    border-left-color: #8b5cf6;
}

.col-status {
    width: 30px;
}

.col-name {
    min-width: 140px;
}

.col-expiry {
    min-width: 120px;
}

.col-connections {
    width: 80px;
    text-align: center;
}

.col-server {
    min-width: 140px;
}

.col-contact {
    min-width: 140px;
}

.col-actions {
    width: 50px;
    text-align: center;
}

/* Status Badge in Table */
.status-badge-table {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.status-badge-table.active {
    background: #22c55e;
    box-shadow: 0 0 8px rgba(34,197,94,0.5);
}

.status-badge-table.expired {
    background: #ef4444;
    box-shadow: 0 0 8px rgba(239,68,68,0.5);
}

/* Badge styling */
.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}

.badge.active {
    background: rgba(34,197,94,0.2);
    color: #22c55e;
    border: 1px solid rgba(34,197,94,0.4);
}

.badge.expired {
    background: rgba(239,68,68,0.2);
    color: #ef4444;
    border: 1px solid rgba(239,68,68,0.4);
}

.badge.pending {
    background: rgba(234,179,8,0.2);
    color: #eab308;
    border: 1px solid rgba(234,179,8,0.4);
}

/* Row Details */
.row-details {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.row-main {
    font-weight: 600;
    color: var(--text);
}

.row-sub {
    font-size: 12px;
    color: var(--text-muted);
}

.plan-value {
    font-size: 12px;
    color: #22c55e;
    font-weight: 600;
}

/* Action Buttons */
.action-buttons-mini {
    display: flex;
    gap: 4px;
}

.btn-action {
    background: rgba(139,92,246,0.1);
    border: 1px solid rgba(139,92,246,0.3);
    color: #8b5cf6;
    padding: 6px 10px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 12px;
}

.btn-action.success {
    background: rgba(34,197,94,0.1);
    border: 1px solid rgba(34,197,94,0.3);
    color: #22c55e;
}

.btn-action.success:hover {
    background: #22c55e;
    border-color: #22c55e;
    color: white;
}

.btn-action.warning {
    background: rgba(245,158,11,0.1);
    border: 1px solid rgba(245,158,11,0.3);
    color: #f59e0b;
}

.btn-action.warning:hover {
    background: #f59e0b;
    border-color: #f59e0b;
    color: white;
}

.btn-action:disabled {
    opacity: 0.3;
    cursor: not-allowed;
    pointer-events: none;
}

.btn-action:hover {
    background: #8b5cf6;
    border-color: #8b5cf6;
    color: white;
    transform: scale(1.05);
}

.data-table tbody tr td:last-child .btn-action {
    opacity: 1;
    transform: scale(1);
    pointer-events: auto;
}

.data-table tbody tr:hover td:last-child .btn-action {
    opacity: 1;
    transform: scale(1);
    pointer-events: auto;
}

.loading {
    text-align: center;
    color: var(--text-muted);
    padding: 40px 20px;
}

.loading i {
    font-size: 24px;
    margin-right: 8px;
}

/* ========================================
   MODAL DE AÇÕES
   ======================================== */

.client-actions-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(5px);
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.client-actions-content {
    background: linear-gradient(135deg, #1e2a3f 0%, #171e2b 100%);
    border-radius: 14px;
    border: 1px solid rgba(139,92,246,0.3);
    padding: 24px;
    width: 90%;
    max-width: 500px;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 20px 40px rgba(0,0,0,0.4);
    animation: slideUp 0.3s ease;
}

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

.client-actions-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 18px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.client-actions-header h3 {
    margin: 0;
    font-size: 1.3rem;
    font-weight: 700;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 10px;
}

.close-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 24px;
    cursor: pointer;
    transition: color 0.2s;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-btn:hover {
    color: #fff;
}

.client-info-section {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    background: rgba(0,0,0,0.3);
    padding: 14px;
    border-radius: 10px;
    margin-bottom: 18px;
    border: 1px solid rgba(139,92,246,0.2);
}

.info-item {
    display: flex;
    flex-direction: column;
}

.info-item span {
    font-size: 11px;
    color: var(--text-muted);
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.info-item strong {
    font-size: 14px;
    color: #fff;
    font-weight: 600;
}

.status-toggle-btn {
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.15);
    color: var(--text);
    padding: 8px 14px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 600;
    width: 100%;
}

.status-toggle-btn.active {
    background: rgba(34,197,94,0.2);
    border-color: rgba(34,197,94,0.5);
    color: #22c55e;
}

.status-toggle-btn i {
    font-size: 16px;
}

/* ========================================
   SEÇÃO DE CREDENCIAIS
   ======================================== */

.credentials-section {
    background: rgba(0,0,0,0.4);
    border: 1px solid rgba(139,92,246,0.2);
    border-radius: 10px;
    padding: 14px;
    margin: 14px 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.credential-item {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.credential-label {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
}

.credential-label i {
    color: #8b5cf6;
    font-size: 13px;
}

.credential-value {
    display: flex;
    gap: 8px;
    align-items: center;
}

.credential-input {
    flex: 1;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(139,92,246,0.3);
    color: #fff;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-family: 'Courier New', monospace;
    word-break: break-all;
}

.credential-input:focus {
    outline: none;
    background: rgba(139,92,246,0.1);
    border-color: #8b5cf6;
}

.credential-copy-btn {
    background: rgba(139,92,246,0.2);
    border: 1px solid rgba(139,92,246,0.4);
    color: #8b5cf6;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 38px;
    height: 36px;
    font-size: 13px;
}

.credential-copy-btn:hover {
    background: rgba(139,92,246,0.4);
    border-color: #8b5cf6;
    transform: scale(1.05);
}

.credential-copy-btn i {
    font-size: 14px;
}

.client-actions-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 14px;
}

.action-btn {
    background: rgba(139,92,246,0.1);
    border: 1px solid rgba(139,92,246,0.3);
    color: #ddd;
    padding: 12px;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 12px;
    font-weight: 600;
    text-align: center;
    min-height: 70px;
}

.action-btn:hover {
    background: rgba(139,92,246,0.25);
    border-color: #8b5cf6;
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(139,92,246,0.2);
}

.action-btn i {
    font-size: 18px;
}

.action-btn[data-action="delete"] {
    border-color: rgba(239,68,68,0.3);
    background: rgba(239,68,68,0.1);
    color: #ef4444;
}

.action-btn[data-action="delete"]:hover {
    background: rgba(239,68,68,0.2);
    border-color: #ef4444;
    color: #fff;
}

.action-btn[data-action="sync"] {
    border-color: rgba(34,197,94,0.3);
    background: rgba(34,197,94,0.1);
    color: #22c55e;
}

.action-btn[data-action="sync"]:hover {
    background: rgba(34,197,94,0.2);
    border-color: #22c55e;
    color: #fff;
}

.action-btn[data-action="renew"] {
    border-color: rgba(59,130,246,0.3);
    background: rgba(59,130,246,0.1);
    color: #3b82f6;
}

.action-btn[data-action="renew"]:hover {
    background: rgba(59,130,246,0.2);
    border-color: #3b82f6;
    color: #fff;
}

.client-actions-footer {
    margin-top: 14px;
    text-align: center;
    font-size: 11px;
    color: var(--text-muted);
    padding-top: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

/* ========================================
   RESPONSIVIDADE
   ======================================== */

@media (max-width: 768px) {
    .bulk-actions-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .bulk-btn {
        font-size: 11px;
        padding: 12px 8px;
    }
    
    .clients-container {
        grid-template-columns: 1fr;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .data-table {
        font-size: 12px;
    }
    
    .data-table th,
    .data-table td {
        padding: 10px 8px;
    }
    
    .col-server {
        display: none;
    }
    
    .action-btn {
        min-height: 60px;
        padding: 10px;
        font-size: 11px;
    }
    
    .action-btn i {
        font-size: 16px;
    }
    
    .client-actions-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .header-actions {
        flex-direction: column;
    }
    
    .bulk-actions-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .bulk-btn {
        font-size: 10px;
        padding: 10px 6px;
    }
    
    .bulk-btn i {
        font-size: 16px;
    }
    
    .form-actions {
        grid-template-columns: 1fr;
    }
    
    .list-controls {
        flex-direction: column;
    }
    
    #status-filter {
        width: 100%;
    }
    
    .col-connections,
    .col-contact {
        display: none;
    }
    
    .data-table th,
    .data-table td {
        padding: 8px 6px;
    }
    
    .client-actions-content {
        width: 95%;
        max-width: 100%;
        padding: 16px;
    }
    
    .client-actions-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .action-btn {
        min-height: 50px;
        font-size: 10px;
        padding: 8px;
    }
}
