/**
 * Portal do Cliente - Estilos Centralizados
 * @package QistokServidorLicencas
 * @version 2.2.10
 */

/* ===========================
   VARIÁVEIS CSS
   =========================== */
:root {
    /* Cores Principais — paleta vinho do tema Qistok */
    --qistok-primary: #a31e3f;
    --qistok-primary-dark: #7d1530;
    --qistok-primary-light: #c44563;
    --qistok-secondary: #a31e3f;

    /* Cores de Status */
    --qistok-success: #10b981;
    --qistok-success-dark: #059669;
    --qistok-warning: #f59e0b;
    --qistok-warning-dark: #92400e;
    --qistok-danger: #ef4444;
    --qistok-danger-dark: #991b1b;
    --qistok-info: #3b82f6;
    --qistok-info-dark: #1e40af;

    /* Cores de Texto */
    --qistok-text-primary: #1e293b;
    --qistok-text-secondary: #64748b;
    --qistok-text-muted: #94a3b8;

    /* Backgrounds */
    --qistok-bg-white: #ffffff;
    --qistok-bg-gray-50: #f8fafc;
    --qistok-bg-gray-100: #f1f5f9;
    --qistok-bg-gray-200: #e2e8f0;

    /* Bordas */
    --qistok-border-color: #e2e8f0;
    --qistok-border-radius: 12px;
    --qistok-border-radius-sm: 6px;
    --qistok-border-radius-lg: 16px;

    /* Sombras */
    --qistok-shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.1);
    --qistok-shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
    --qistok-shadow-lg: 0 10px 40px rgba(163, 30, 63, 0.25);
    --qistok-shadow-xl: 0 20px 60px rgba(0, 0, 0, 0.3);

    /* Transições */
    --qistok-transition: all 0.2s ease;
    --qistok-transition-slow: all 0.3s ease;

    /* Fontes */
    --qistok-font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* ===========================
   RESET E BASE
   =========================== */
.qistok-portal,
.qistok-faturas-wrapper,
.qistok-downloads-wrapper,
.qistok-suporte-wrapper,
.qistok-notificacoes-wrapper,
.qistok-historico-wrapper,
.qistok-dominios-wrapper {
    font-family: var(--qistok-font-family);
    color: var(--qistok-text-primary);
    line-height: 1.6;
}

.qistok-portal h2,
.qistok-portal h3,
.qistok-portal h4,
.qistok-faturas-wrapper h2,
.qistok-faturas-wrapper h3,
.qistok-downloads-wrapper h2,
.qistok-downloads-wrapper h3,
.qistok-suporte-wrapper h2,
.qistok-suporte-wrapper h3,
.qistok-notificacoes-wrapper h2,
.qistok-notificacoes-wrapper h3,
.qistok-historico-wrapper h2,
.qistok-historico-wrapper h3,
.qistok-dominios-wrapper h2,
.qistok-dominios-wrapper h3,
.qistok-dominios-wrapper h4 {
    color: var(--qistok-text-primary);
    font-weight: 700;
}

.qistok-portal p,
.qistok-faturas-wrapper p,
.qistok-downloads-wrapper p,
.qistok-suporte-wrapper p,
.qistok-notificacoes-wrapper p,
.qistok-historico-wrapper p,
.qistok-dominios-wrapper p {
    color: var(--qistok-text-secondary);
}

/* Esconder conteúdo padrão do WooCommerce apenas nas páginas do plugin */
.woocommerce-MyAccount-content.qistok-portal-page > p:first-child,
.woocommerce-MyAccount-content > .qistok-portal > p:first-child,
.woocommerce-MyAccount-content > .qistok-faturas-wrapper > p:first-child,
.woocommerce-MyAccount-content > .qistok-downloads-wrapper > p:first-child,
.woocommerce-MyAccount-content > .qistok-suporte-wrapper > p:first-child,
.woocommerce-MyAccount-content > .qistok-notificacoes-wrapper > p:first-child,
.woocommerce-MyAccount-content > .qistok-historico-wrapper > p:first-child,
.woocommerce-MyAccount-content > .qistok-dominios-wrapper > p:first-child {
    display: none !important;
}

/* ===========================
   LAYOUT PRINCIPAL
   =========================== */
.qistok-portal {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Descrição da página */
.qistok-page-description {
    margin: 0 0 24px 0;
    font-size: 16px;
    color: var(--qistok-text-secondary);
    font-weight: 600;
}

/* ===========================
   WELCOME BANNER
   =========================== */
.qistok-welcome {
    background: linear-gradient(135deg, var(--qistok-primary) 0%, var(--qistok-primary-dark) 100%);
    color: #ffffff;
    padding: 40px;
    border-radius: var(--qistok-border-radius-lg);
    margin-bottom: 30px;
    box-shadow: var(--qistok-shadow-lg);
}

.qistok-welcome h2 {
    margin: 0 0 10px 0;
    font-size: 32px;
    font-weight: 700;
    color: white;
}

.qistok-welcome p {
    margin: 0;
    opacity: 0.9;
    font-size: 16px;
    color: white;
}

/* ===========================
   GRIDS DE ESTATÍSTICAS
   =========================== */
.qistok-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.qistok-stat-card {
    background: var(--qistok-bg-white);
    border-radius: var(--qistok-border-radius);
    padding: 24px;
    box-shadow: var(--qistok-shadow-sm);
    transition: var(--qistok-transition);
    border-left: 4px solid var(--qistok-primary);
}

.qistok-stat-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--qistok-shadow-md);
}

.qistok-stat-card.success {
    border-left-color: var(--qistok-success);
}

.qistok-stat-card.warning {
    border-left-color: var(--qistok-warning);
}

.qistok-stat-card.danger {
    border-left-color: var(--qistok-danger);
}

.qistok-stat-icon {
    font-size: 36px;
    margin-bottom: 12px;
}

.qistok-stat-value {
    font-size: 42px;
    font-weight: 700;
    color: var(--qistok-text-primary);
    margin: 10px 0;
    line-height: 1;
}

.qistok-stat-label {
    font-size: 14px;
    color: var(--qistok-text-secondary);
    font-weight: 600;
}

/* ===========================
   SEÇÕES
   =========================== */
.qistok-section {
    background: var(--qistok-bg-white);
    border-radius: var(--qistok-border-radius);
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: var(--qistok-shadow-sm);
}

.qistok-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 2px solid var(--qistok-bg-gray-100);
}

.qistok-section-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--qistok-text-primary);
    margin: 0;
}

/* ===========================
   BOTÕES
   =========================== */
.qistok-btn {
    padding: 10px 20px;
    border-radius: var(--qistok-border-radius-sm);
    font-weight: 600;
    text-decoration: none;
    display: inline-block;
    transition: var(--qistok-transition);
    border: none;
    cursor: pointer;
    font-size: 14px;
    line-height: 1.5;
}

.qistok-btn-primary {
    background: var(--qistok-primary);
    color: white;
}

.qistok-btn-primary:hover {
    background: var(--qistok-primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(163, 30, 63, 0.35);
    color: white;
}

.qistok-btn-success {
    background: var(--qistok-success);
    color: white;
}

.qistok-btn-success:hover {
    background: var(--qistok-success-dark);
    color: white;
}

.qistok-btn-danger {
    background: #fee2e2;
    color: var(--qistok-danger-dark);
}

.qistok-btn-danger:hover {
    background: #fecaca;
}

/* ===========================
   BADGES
   =========================== */
.qistok-badge {
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    display: inline-block;
}

.qistok-badge-ativo {
    background: #d1fae5;
    color: #065f46;
}

.qistok-badge-expirado {
    background: #fee2e2;
    color: var(--qistok-danger-dark);
}

.qistok-badge-principal {
    background: #dbeafe;
    color: var(--qistok-info-dark);
}

.qistok-badge-extra {
    background: #e9d5ff;
    color: #6b21a8;
}

/* ===========================
   ALERTAS
   =========================== */
.qistok-alert {
    padding: 16px 20px;
    border-radius: 10px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.qistok-alert-warning {
    background: #fef3c7;
    border-left: 4px solid var(--qistok-warning);
    color: var(--qistok-warning-dark);
}

.qistok-alert-info {
    background: #dbeafe;
    border-left: 4px solid var(--qistok-info);
    color: var(--qistok-info-dark);
}

.qistok-alert-success {
    background: #d1fae5;
    border-left: 4px solid var(--qistok-success);
    color: #065f46;
}

.qistok-alert-danger {
    background: #fee2e2;
    border-left: 4px solid var(--qistok-danger);
    color: var(--qistok-danger-dark);
}

/* ===========================
   CARDS DE LICENÇAS
   =========================== */
.qistok-licenca-item,
.qistok-licenca-card {
    padding: 16px;
    border: 2px solid var(--qistok-border-color);
    border-radius: 10px;
    margin-bottom: 12px;
    transition: var(--qistok-transition);
    background: var(--qistok-bg-white);
}

.qistok-licenca-item:hover,
.qistok-licenca-card:hover {
    border-color: var(--qistok-primary);
    background: var(--qistok-bg-gray-50);
}

.qistok-licenca-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--qistok-border-color);
}

.qistok-licenca-titulo {
    font-size: 18px;
    font-weight: 600;
    color: var(--qistok-text-primary);
    margin: 0;
}

.qistok-licenca-status {
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.qistok-status-ativo {
    background: #d1fae5;
    color: #065f46;
}

.qistok-status-expirado {
    background: #fee2e2;
    color: var(--qistok-danger-dark);
}

/* ===========================
   NOTIFICAÇÕES
   =========================== */
.qistok-notif-item {
    padding: 12px 16px;
    border-left: 3px solid var(--qistok-primary);
    background: var(--qistok-bg-gray-50);
    border-radius: 6px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: var(--qistok-transition);
}

.qistok-notif-item:hover {
    background: var(--qistok-bg-gray-100);
}

.qistok-notif-item.nao-lida {
    background: #dbeafe;
    font-weight: 600;
    border-left-color: var(--qistok-info);
}

/* ===========================
   MODAL
   =========================== */
.qistok-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 1000; /* Valor razoável para overlay de modal */
    align-items: center;
    justify-content: center;
    overflow-y: auto;
    padding: 20px;
    animation: qistok-fadeIn 0.2s ease;
}

.qistok-modal.active {
    display: flex;
}

.qistok-modal-content {
    background: white;
    width: 100%;
    max-width: 800px;
    max-height: 90vh;
    overflow-y: auto;
    border-radius: var(--qistok-border-radius);
    box-shadow: var(--qistok-shadow-xl);
    animation: qistok-slideUp 0.3s ease;
}

.qistok-modal-header {
    padding: 24px;
    border-bottom: 1px solid var(--qistok-border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    background: white;
    z-index: 10;
}

.qistok-modal-body {
    padding: 24px;
}

.qistok-close-btn {
    background: none;
    border: none;
    font-size: 28px;
    cursor: pointer;
    color: var(--qistok-text-secondary);
    padding: 0;
    line-height: 1;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: var(--qistok-transition);
}

.qistok-close-btn:hover {
    background: var(--qistok-bg-gray-100);
    color: var(--qistok-text-primary);
}

/* ===========================
   TICKETS
   =========================== */
.qistok-ticket-card {
    padding: 24px;
    border: 1px solid var(--qistok-border-color);
    margin-bottom: 16px;
    border-radius: var(--qistok-border-radius);
    cursor: pointer;
    transition: var(--qistok-transition);
    background: var(--qistok-bg-white);
    box-shadow: var(--qistok-shadow-sm);
}

.qistok-ticket-card:hover {
    box-shadow: var(--qistok-shadow-md);
    border-color: var(--qistok-info);
    transform: translateY(-2px);
}

.qistok-ticket-status {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.qistok-resposta {
    padding: 20px;
    margin: 12px 0;
    border-radius: 8px;
}

.qistok-resposta-cliente {
    background: #f0f4f8;
    border-left: 4px solid var(--qistok-text-secondary);
}

.qistok-resposta-admin {
    background: #e0f2fe;
    border-left: 4px solid #0284c7;
}

/* ===========================
   DOMÍNIOS
   =========================== */
.qistok-limites-info {
    background: var(--qistok-bg-gray-50);
    padding: 16px 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
}

.qistok-dominio-item {
    background: var(--qistok-bg-gray-50);
    border: 1px solid var(--qistok-border-color);
    border-radius: 8px;
    padding: 16px 20px;
    margin-bottom: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}

.qistok-dominio-item.ativo {
    background: #ecfdf5;
    border-color: var(--qistok-success);
}

.qistok-dominio-info {
    flex: 1;
    min-width: 200px;
}

.qistok-dominio-url {
    font-weight: 600;
    color: var(--qistok-text-primary);
    font-size: 14px;
    word-break: break-all;
}

.qistok-dominio-meta {
    font-size: 12px;
    color: var(--qistok-text-secondary);
    margin-top: 4px;
}

.qistok-progress-bar {
    height: 6px;
    background: var(--qistok-bg-gray-200);
    border-radius: 3px;
    overflow: hidden;
    margin-top: 8px;
}

.qistok-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--qistok-success), var(--qistok-success-dark));
    transition: width 0.3s;
}

.qistok-add-dominio {
    margin-top: 20px;
    padding: 20px;
    background: var(--qistok-bg-gray-50);
    border-radius: 8px;
}

.qistok-add-dominio input {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--qistok-border-color);
    border-radius: var(--qistok-border-radius-sm);
    font-size: 14px;
    box-sizing: border-box;
}

/* ===========================
   TABELAS RESPONSIVAS
   =========================== */
.qistok-table-wrapper {
    overflow-x: auto;
    margin: 0 -24px;
    padding: 0 24px;
}

.qistok-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 600px;
}

.qistok-table thead tr {
    background: #f9fafb;
}

.qistok-table th {
    padding: 12px;
    text-align: left;
    border-bottom: 2px solid #e5e7eb;
    font-weight: 600;
    color: var(--qistok-text-primary);
}

.qistok-table td {
    padding: 12px;
    border-bottom: 1px solid #e5e7eb;
    color: var(--qistok-text-secondary);
}

/* ===========================
   TOAST NOTIFICATIONS
   =========================== */
.qistok-toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1100; /* Acima do modal para visibilidade */
    max-width: 400px;
}

.qistok-toast {
    background: white;
    border-radius: 8px;
    padding: 16px 20px;
    margin-bottom: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    gap: 12px;
    animation: qistok-slideInRight 0.3s ease;
    border-left: 4px solid var(--qistok-info);
}

.qistok-toast.success {
    border-left-color: var(--qistok-success);
}

.qistok-toast.error {
    border-left-color: var(--qistok-danger);
}

.qistok-toast.warning {
    border-left-color: var(--qistok-warning);
}

.qistok-toast-icon {
    font-size: 24px;
    flex-shrink: 0;
}

.qistok-toast-content {
    flex: 1;
}

.qistok-toast-title {
    font-weight: 600;
    color: var(--qistok-text-primary);
    margin-bottom: 4px;
}

.qistok-toast-message {
    font-size: 14px;
    color: var(--qistok-text-secondary);
}

.qistok-toast-close {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: var(--qistok-text-muted);
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: var(--qistok-transition);
}

.qistok-toast-close:hover {
    background: var(--qistok-bg-gray-100);
    color: var(--qistok-text-primary);
}

/* ===========================
   LOADING SPINNER
   =========================== */
.qistok-spinner {
    border: 3px solid #f3f3f3;
    border-radius: 50%;
    border-top: 3px solid var(--qistok-primary);
    width: 40px;
    height: 40px;
    animation: qistok-spin 1s linear infinite;
    margin: 0 auto;
}

.qistok-spinner-sm {
    width: 20px;
    height: 20px;
    border-width: 2px;
}

/* ===========================
   EMPTY STATES
   =========================== */
.qistok-empty-state {
    text-align: center;
    padding: 60px 20px;
    background: var(--qistok-bg-gray-50);
    border-radius: var(--qistok-border-radius);
    box-shadow: var(--qistok-shadow-sm);
}

.qistok-empty-state-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.qistok-empty-state h3 {
    color: var(--qistok-text-secondary);
    margin-top: 15px;
}

.qistok-empty-state p {
    margin: 0;
    color: var(--qistok-text-secondary);
}

/* ===========================
   ANIMAÇÕES
   =========================== */
@keyframes qistok-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes qistok-fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes qistok-slideUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes qistok-slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes qistok-slideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

/* ===========================
   RESPONSIVIDADE
   =========================== */
@media (max-width: 768px) {
    .qistok-portal {
        padding: 12px;
    }

    .qistok-welcome {
        padding: 24px;
    }

    .qistok-welcome h2 {
        font-size: 24px;
    }

    .qistok-stats-grid {
        grid-template-columns: 1fr;
    }

    .qistok-stat-value {
        font-size: 32px;
    }

    .qistok-section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .qistok-licenca-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .qistok-modal-content {
        max-height: 95vh;
    }

    .qistok-ticket-card {
        padding: 16px;
    }

    .qistok-toast-container {
        left: 12px;
        right: 12px;
        max-width: none;
    }

    .qistok-limites-info {
        flex-direction: column;
        align-items: flex-start;
    }

    .qistok-dominio-item {
        flex-direction: column;
        align-items: flex-start;
    }

    .qistok-add-dominio input {
        width: 100%;
        margin-bottom: 8px;
    }
}

@media (max-width: 480px) {
    .qistok-welcome {
        padding: 20px;
    }

    .qistok-welcome h2 {
        font-size: 20px;
    }

    .qistok-section {
        padding: 16px;
    }

    .qistok-modal-header,
    .qistok-modal-body {
        padding: 16px;
    }
}

/* ===========================
   UTILITÁRIOS
   =========================== */
.qistok-text-center {
    text-align: center;
}

.qistok-mb-0 {
    margin-bottom: 0 !important;
}

.qistok-mt-4 {
    margin-top: 16px;
}

.qistok-hidden {
    display: none !important;
}

.qistok-flex {
    display: flex;
}

.qistok-flex-between {
    display: flex;
    justify-content: space-between;
}

.qistok-gap-2 {
    gap: 8px;
}

.qistok-gap-4 {
    gap: 16px;
}
