/**
 * Estilos do Add-on de Assinaturas
 *
 * @package Desi_Pet_Shower_Subscription
 * @since 1.1.0
 * @updated 1.2.0 - Melhorias de layout e UX
 * @updated 1.2.1 - Botões modernos e melhorias de formulário
 * @updated 1.3.0 - Layout de cards empilhados verticalmente (padrão Serviços)
 */

/* ==========================================================================
   Layout geral e cabeçalho (alinhado à aba Serviços)
   ========================================================================== */

.dps-subscription-wrapper {
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    /* padding is inherited from .dps-section (24px) - do not override */
}

/* Layout empilhado: cards um abaixo do outro */
.dps-subscriptions-stacked {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* Header padronizado como na aba Clientes - herda estilos globais do base plugin */
/* A classe .dps-section-title herda do dps-base.css com border-bottom e margin corretos */

#dps-section-assinaturas .dps-section-title__icon {
    font-size: 1.2em;
}

/* ==========================================================================
   Cards Surface - Assinaturas (padrão Serviços)
   ========================================================================== */

#dps-section-assinaturas .dps-surface {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 24px;
}

#dps-section-assinaturas .dps-surface--info {
    border-left: 4px solid #0ea5e9;
}

#dps-section-assinaturas .dps-surface--neutral {
    border-left: 4px solid #6b7280;
}

#dps-section-assinaturas .dps-surface__title {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 0 8px;
    font-size: 18px;
    font-weight: 600;
    color: #374151;
}

#dps-section-assinaturas .dps-surface__description {
    margin: 0 0 20px;
    color: #6b7280;
    font-size: 14px;
}

/* Painel de estatísticas inline */
#dps-section-assinaturas .dps-inline-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 20px;
    padding: 0;
    list-style: none;
}

#dps-section-assinaturas .dps-inline-stats--panel {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 20px;
}

#dps-section-assinaturas .dps-inline-stats li {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
    min-width: 160px;
}

#dps-section-assinaturas .dps-inline-stats__label {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

#dps-section-assinaturas .dps-inline-stats__label small {
    font-size: 12px;
    color: #9ca3af;
}

#dps-section-assinaturas .dps-inline-stats__value {
    font-size: 24px;
    font-weight: 700;
    color: #374151;
}

/* Status badges para estatísticas */
#dps-section-assinaturas .dps-status-badge--scheduled {
    background: #dbeafe;
    color: #1d4ed8;
}

#dps-section-assinaturas .dps-status-badge--paid {
    background: #d1fae5;
    color: #047857;
}

#dps-section-assinaturas .dps-status-badge--pending {
    background: #fef3c7;
    color: #b45309;
}

#dps-section-assinaturas .dps-status-badge--cancelled {
    background: #f3f4f6;
    color: #6b7280;
}

/* Aviso informativo */
.dps-info-notice {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 16px;
    background: linear-gradient(135deg, #eff6ff 0%, #f0f9ff 100%);
    border: 1px solid #bfdbfe;
    border-radius: 8px;
    margin-top: 16px;
}

.dps-info-notice__icon {
    font-size: 20px;
    flex-shrink: 0;
}

.dps-info-notice__text {
    margin: 0;
    font-size: 14px;
    color: #1e40af;
    line-height: 1.5;
}

/* Card de edição */
#dps-section-assinaturas .dps-subscription-edit-card .dps-surface__description {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

/* Link de cancelar edição */
.dps-cancel-edit {
    color: #ef4444;
    text-decoration: none;
    font-weight: 500;
    margin-left: 8px;
}

.dps-cancel-edit:hover {
    color: #dc2626;
    text-decoration: underline;
}

/* ==========================================================================
   Mantém compatibilidade com layout antigo
   ========================================================================== */

.dps-subscription-content {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.dps-subscription-header {
    display: none; /* Oculta header antigo, usa o novo padrão */
}

.dps-subscription-title h3 {
    margin: 0 0 6px;
    font-size: 20px;
    color: #0f172a;
}

.dps-subscription-subtitle {
    margin: 0;
    color: #6b7280;
    font-size: 14px;
}

/* Cartão principal do formulário */
.dps-card {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.05);
    overflow: hidden;
}

.dps-card__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 20px 24px;
    border-bottom: 1px solid #e5e7eb;
    background: linear-gradient(90deg, #f9fafb 0%, #ffffff 100%);
}

.dps-card__title {
    margin: 6px 0 2px;
    font-size: 20px;
    color: #0f172a;
}

.dps-card__eyebrow {
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-size: 12px;
    color: #6b7280;
    margin: 0;
}

.dps-card__hint {
    margin: 4px 0 0;
    color: #6b7280;
    font-size: 13px;
}

.dps-card__actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.dps-card__body {
    padding: 20px 24px 24px;
}

.dps-card--form .dps-subscription-form {
    max-width: 100%;
    margin: 0;
}

.dps-subscription-header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

#dps-section-assinaturas h4 {
    margin: 0 0 12px;
    color: #0f172a;
}

/* ==========================================================================
   Botões padronizados (seguindo padrão da aba Agendamentos)
   ========================================================================== */

#dps-section-assinaturas .dps-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 12px 20px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 15px;
    line-height: 1.1;
    text-decoration: none;
    border: 1px solid #e5e7eb;
    cursor: pointer;
    transition: all 0.2s ease;
    background: #ffffff;
    color: #374151;
}

#dps-section-assinaturas .dps-btn:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.3);
}

#dps-section-assinaturas .dps-btn--primary {
    background: linear-gradient(135deg, #0ea5e9 0%, #0284c7 100%);
    color: #ffffff;
    border: none;
    box-shadow: 0 2px 8px rgba(14, 165, 233, 0.25);
}

#dps-section-assinaturas .dps-btn--primary:hover {
    background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
    box-shadow: 0 4px 12px rgba(14, 165, 233, 0.35);
    transform: translateY(-1px);
    color: #ffffff;
}

#dps-section-assinaturas .dps-btn--primary:active {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(14, 165, 233, 0.2);
}

#dps-section-assinaturas .dps-btn--soft {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    color: #374151;
}

#dps-section-assinaturas .dps-btn--soft:hover {
    border-color: #0ea5e9;
    color: #0ea5e9;
    background: #f9fafb;
}

#dps-section-assinaturas .dps-btn--icon .dps-btn-icon {
    width: 24px;
    height: 24px;
    border-radius: 6px;
    background: rgba(14, 165, 233, 0.12);
}

/* ==========================================================================
   Status de Pagamento nas Tabelas
   ========================================================================== */

table.dps-table tr.pay-status-pendente {
    background-color: #fff8e1;
}

table.dps-table tr.pay-status-pago {
    background-color: #e6ffed;
}

table.dps-table tr.pay-status-em_atraso {
    background-color: #fee2e2;
}

/* Linha cancelada (opacidade reduzida) */
table.dps-table tr.dps-canceled-row {
    background-color: #f9fafb;
    opacity: 0.85;
}

/* ==========================================================================
   Cards de Resumo (Dashboard)
   ========================================================================== */

.dps-subscription-dashboard {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.dps-stat-card {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    transition: box-shadow 0.2s ease;
}

.dps-stat-card:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.dps-stat-number {
    display: block;
    font-size: 28px;
    font-weight: 600;
    color: #374151;
    line-height: 1.2;
}

.dps-stat-label {
    display: block;
    font-size: 13px;
    color: #6b7280;
    margin-top: 4px;
}

.dps-stat-card.dps-stat-warning .dps-stat-number {
    color: #f59e0b;
}

.dps-stat-card.dps-stat-success .dps-stat-number {
    color: #10b981;
}

/* ==========================================================================
   Formulário de Assinatura
   ========================================================================== */

.dps-subscription-form {
    max-width: 600px;
    margin-bottom: 32px;
}

/* Hint de campo */
.dps-subscription-form .dps-field-hint {
    margin: 0 0 12px 0;
    font-size: 13px;
    color: #6b7280;
}

/* Grid de checkboxes para seleção de pets */
.dps-checkbox-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 8px;
    padding: 12px;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    max-height: 200px;
    overflow-y: auto;
}

.dps-checkbox-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.dps-checkbox-item:hover {
    border-color: #0ea5e9;
    background: #f0f9ff;
}

.dps-checkbox-item input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin: 0;
    accent-color: #0ea5e9;
}

.dps-checkbox-item input[type="checkbox"]:checked + .dps-checkbox-label {
    font-weight: 500;
    color: #0284c7;
}

.dps-checkbox-label {
    font-size: 14px;
    color: #374151;
}

.dps-pets-count {
    margin: 8px 0 0 0;
    font-size: 13px;
    color: #6b7280;
}

.dps-pets-count span {
    font-weight: 600;
    color: #0ea5e9;
}

/* Grid de 3 colunas para seção de tosa */
.dps-form-row--3col {
    grid-template-columns: auto 1fr 1fr;
    align-items: end;
}

/* Seção de Tosa */
.dps-tosa-section {
    margin-top: 16px;
    padding: 16px;
    background: #fefce8;
    border: 1px solid #fde68a;
    border-radius: 8px;
}

.dps-tosa-section .dps-extras-title {
    margin: 0 0 12px 0;
    font-size: 14px;
    color: #854d0e;
}

/* Checkbox inline */
.dps-checkbox-inline {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    padding: 8px 0;
}

.dps-checkbox-inline input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: #0ea5e9;
}

.dps-checkbox-inline span {
    font-size: 14px;
    color: #374151;
}

/* Campos condicionais de tosa */
.dps-tosa-conditional {
    transition: opacity 0.2s ease;
}

.dps-tosa-conditional .dps-input-with-prefix {
    display: flex;
    align-items: center;
    gap: 6px;
}

.dps-subscription-form .dps-fieldset,
.dps-subscription-form fieldset {
    border: 1px solid #e5e7eb;
    padding: 20px;
    margin-bottom: 20px;
    border-radius: 4px;
    background: #ffffff;
}

.dps-subscription-form .dps-fieldset legend,
.dps-subscription-form fieldset legend {
    font-weight: 600;
    color: #374151;
    padding: 0 8px;
    font-size: 15px;
}

.dps-subscription-form .dps-form-row {
    display: grid;
    gap: 16px;
    margin-bottom: 16px;
}

.dps-subscription-form .dps-form-row--stacked {
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.dps-subscription-form .dps-form-row:last-child {
    margin-bottom: 0;
}

.dps-subscription-form .dps-form-row--2col {
    grid-template-columns: repeat(2, 1fr);
}

.dps-subscription-form .dps-form-field {
    display: flex;
    flex-direction: column;
}

.dps-subscription-form .dps-form-field label {
    display: block;
    font-weight: 500;
    color: #374151;
    margin-bottom: 6px;
    font-size: 14px;
}

.dps-subscription-form .dps-form-field select,
.dps-subscription-form .dps-form-field input[type="text"],
.dps-subscription-form .dps-form-field input[type="number"],
.dps-subscription-form .dps-form-field input[type="date"],
.dps-subscription-form .dps-form-field input[type="time"] {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #e5e7eb;
    border-radius: 4px;
    font-size: 14px;
    color: #374151;
}

.dps-subscription-form .dps-form-field select:focus,
.dps-subscription-form .dps-form-field input:focus {
    border-color: #0ea5e9;
    outline: none;
    box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.1);
}

.dps-subscription-form .dps-form-field--muted label {
    color: #6b7280;
}

.dps-inline-text {
    color: #6b7280;
    margin: 4px 0 0;
    font-size: 13px;
}

.dps-subscription-form .dps-required {
    color: #ef4444;
}

.dps-subscription-form .dps-form-actions {
    margin-top: 24px;
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    padding: 20px;
    background: linear-gradient(to right, #f9fafb 0%, #ffffff 100%);
    border-radius: 8px;
    border: 1px solid #e5e7eb;
}

.dps-extras-section {
    margin-top: 12px;
    padding: 16px;
    border: 1px dashed #e5e7eb;
    border-radius: 10px;
    background: #f9fafb;
}

.dps-extras-header {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.dps-extras-title {
    margin: 0;
    font-size: 15px;
    color: #0f172a;
}

.dps-extras-hint {
    margin: 0;
    color: #6b7280;
    font-size: 13px;
}

.dps-extras-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin: 12px 0;
}

.dps-extra-row {
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 12px;
    background: #ffffff;
}

.dps-extra-row-fields {
    display: grid;
    grid-template-columns: 1fr 160px auto;
    gap: 10px;
    align-items: center;
}

.dps-extra-description-field input,
.dps-extra-value-field input {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
}

.dps-input-with-prefix {
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Estilo para .dps-input-prefix como span DENTRO de .dps-input-with-prefix */
.dps-input-with-prefix .dps-input-prefix {
    background: #f3f4f6;
    color: #6b7280;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    padding: 6px 8px;
    font-size: 13px;
}

.dps-btn--outline {
    border-style: dashed;
    border-color: #0ea5e9;
    color: #0ea5e9;
    background: #ffffff;
}

.dps-btn--outline:hover {
    background: #e0f2fe;
    border-color: #0284c7;
}

.dps-badge-row {
    display: flex;
    gap: 8px;
    align-items: center;
    margin: 10px 0 6px;
}

.dps-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 13px;
    color: #374151;
    background: #f3f4f6;
    border: 1px solid #e5e7eb;
}

.dps-badge--primary {
    color: #0ea5e9;
    background: #e0f2fe;
    border-color: #bae6fd;
}

/* ==========================================================================
   Botões de Ação do Formulário - Estilo Moderno
   ========================================================================== */

.dps-subscription-form .dps-btn-submit {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: #ffffff;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.25);
    min-width: 180px;
}

.dps-subscription-form .dps-btn-submit:hover {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.35);
    transform: translateY(-1px);
    color: #ffffff;
}

.dps-subscription-form .dps-btn-submit:active {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(16, 185, 129, 0.2);
}

.dps-subscription-form .dps-btn-submit:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.3), 0 2px 8px rgba(16, 185, 129, 0.25);
}

.dps-subscription-form .dps-btn-cancel {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    background: #ffffff;
    color: #6b7280;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 120px;
}

.dps-subscription-form .dps-btn-cancel:hover {
    background: #f9fafb;
    border-color: #d1d5db;
    color: #374151;
}

.dps-subscription-form .dps-btn-cancel:active {
    background: #f3f4f6;
}

.dps-subscription-form .dps-btn-cancel:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(107, 114, 128, 0.15);
}

/* Ícones nos botões */
.dps-btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
}

/* ==========================================================================
   Barra de Progresso de Atendimentos
   ========================================================================== */

.dps-progress-bar {
    position: relative;
    height: 24px;
    background: #f3f4f6;
    border-radius: 12px;
    overflow: hidden;
    min-width: 80px;
}

.dps-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #10b981, #34d399);
    border-radius: 12px;
    transition: width 0.3s ease;
}

.dps-progress-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 12px;
    font-weight: 600;
    color: #374151;
    white-space: nowrap;
}

/* ==========================================================================
   Ações da Tabela e Botões
   ========================================================================== */

.dps-subscription-actions {
    margin-bottom: 24px;
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

/* ==========================================================================
   Botão Principal "Nova Assinatura" - Estilo Moderno
   ========================================================================== */

.dps-btn-new-subscription {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 14px 24px;
    background: linear-gradient(135deg, #0ea5e9 0%, #0284c7 100%);
    color: #ffffff;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(14, 165, 233, 0.25);
}

.dps-btn-new-subscription:hover {
    background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
    box-shadow: 0 4px 12px rgba(14, 165, 233, 0.35);
    transform: translateY(-1px);
    color: #ffffff;
}

.dps-btn-new-subscription:active {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(14, 165, 233, 0.2);
}

.dps-btn-new-subscription:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.3), 0 2px 8px rgba(14, 165, 233, 0.25);
}

.dps-btn-new-subscription .dps-btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    font-size: 14px;
}

.dps-subscription-actions .button {
    margin-right: 0;
}

/* Botões de ação na tabela */
.dps-action-buttons {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
}

.dps-action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 4px;
    text-decoration: none;
    transition: background-color 0.2s ease;
    font-size: 16px;
}

.dps-action-btn:hover {
    background-color: #f3f4f6;
}

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

/* Botão de ação desabilitado */
.dps-action-btn.dps-action-disabled {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
}

.dps-action-btn.dps-action-disabled:hover {
    background-color: transparent;
}

.dps-action-btn.dps-action-charge:hover {
    background-color: #d1fae5;
}

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

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

/* ==========================================================================
   Wrapper de Tabela
   ========================================================================== */

.dps-subscription-table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 20px;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
    background: #ffffff;
}

.dps-subscription-table-wrapper table.dps-table {
    margin-bottom: 0;
    border: none;
    width: 100%;
}

.dps-subscription-table-wrapper table.dps-table th {
    background: #f9fafb;
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #6b7280;
    padding: 12px 16px;
    border-bottom: 1px solid #e5e7eb;
    white-space: nowrap;
}

.dps-subscription-table-wrapper table.dps-table td {
    padding: 12px 16px;
    vertical-align: middle;
    border-bottom: 1px solid #f3f4f6;
}

.dps-subscription-table-wrapper table.dps-table tbody tr:last-child td {
    border-bottom: none;
}

/* Tabela de canceladas com estilo mais sutil */
.dps-subscription-table-wrapper.dps-canceled-table {
    opacity: 0.9;
}

/* ==========================================================================
   Textos e Badges
   ========================================================================== */

.dps-text-secondary {
    color: #6b7280;
    font-size: 13px;
}

.dps-text-muted {
    color: #9ca3af;
    font-size: 12px;
}

/* Badges de status */
.dps-status-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.dps-status-badge.dps-status-pago {
    background-color: #d1fae5;
    color: #047857;
}

.dps-status-badge.dps-status-pendente {
    background-color: #fef3c7;
    color: #b45309;
}

.dps-status-badge.dps-status-em_atraso {
    background-color: #fee2e2;
    color: #b91c1c;
}

/* ==========================================================================
   Select de Pagamento
   ========================================================================== */

.dps-payment-form {
    display: inline-block;
}

.dps-select-payment {
    padding: 6px 10px;
    border: 1px solid #e5e7eb;
    border-radius: 4px;
    font-size: 13px;
    background: #ffffff;
    cursor: pointer;
    min-width: 100px;
}

.dps-select-payment:focus {
    border-color: #0ea5e9;
    outline: none;
}

/* ==========================================================================
   Estados Vazios e Títulos de Seção
   ========================================================================== */

.dps-empty-state {
    padding: 48px 24px;
    text-align: center;
    color: #6b7280;
    background: #f9fafb;
    border-radius: 8px;
    border: 1px dashed #e5e7eb;
}

.dps-empty-state__icon {
    display: block;
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.6;
}

.dps-empty-state__title {
    margin: 0 0 8px 0;
    font-size: 18px;
    font-weight: 600;
    color: #374151;
}

.dps-empty-state__description {
    margin: 0;
    font-size: 14px;
    color: #6b7280;
}

.dps-empty-state--muted {
    background: transparent;
    border: none;
    padding: 16px 0;
    text-align: left;
}

/* ==========================================================================
   Responsividade
   ========================================================================== */

@media (max-width: 768px) {
    /* Padding is inherited from .dps-section - no override needed */
    
    #dps-section-assinaturas .dps-section-title {
        font-size: 20px;
        gap: 8px;
    }
    
    #dps-section-assinaturas .dps-surface {
        padding: 16px;
    }
    
    #dps-section-assinaturas .dps-inline-stats {
        flex-direction: column;
    }
    
    #dps-section-assinaturas .dps-inline-stats li {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        min-width: 100%;
    }
    
    #dps-section-assinaturas .dps-inline-stats__value {
        font-size: 20px;
    }
    
    .dps-info-notice {
        flex-direction: column;
        gap: 8px;
    }

    .dps-subscription-header {
        flex-direction: column;
        align-items: flex-start;
        padding: 16px;
        gap: 12px;
    }

    .dps-subscription-header-actions {
        width: 100%;
        justify-content: flex-start;
    }

    .dps-subscription-header-actions .dps-btn {
        width: 100%;
        justify-content: center;
    }

    .dps-subscription-dashboard {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .dps-subscription-form .dps-form-row--2col {
        grid-template-columns: 1fr;
    }
    
    .dps-subscription-actions {
        flex-direction: column;
    }
    
    .dps-subscription-actions .button,
    .dps-subscription-actions .dps-btn-new-subscription {
        width: 100%;
        text-align: center;
        justify-content: center;
    }
    
    .dps-subscription-form .dps-form-actions {
        flex-direction: column;
        padding: 16px;
    }
    
    .dps-subscription-form .dps-form-actions .button,
    .dps-subscription-form .dps-btn-submit,
    .dps-subscription-form .dps-btn-cancel {
        width: 100%;
        text-align: center;
        justify-content: center;
    }
}

/* Mobile (640px) - Tabela vira cards */
@media (max-width: 640px) {
    .dps-subscription-table-wrapper {
        border: none;
        overflow: visible;
        background: transparent;
    }
    
    .dps-subscription-table-wrapper table.dps-table {
        min-width: 0;
    }
    
    .dps-subscription-table-wrapper table.dps-table thead {
        display: none;
    }
    
    .dps-subscription-table-wrapper table.dps-table tbody {
        display: flex;
        flex-direction: column;
        gap: 16px;
    }
    
    .dps-subscription-table-wrapper table.dps-table tbody tr {
        display: flex;
        flex-direction: column;
        border: 1px solid #e5e7eb;
        border-radius: 8px;
        padding: 16px;
        background: #ffffff;
    }
    
    .dps-subscription-table-wrapper table.dps-table tbody tr.pay-status-pendente {
        border-left: 4px solid #f59e0b;
    }
    
    .dps-subscription-table-wrapper table.dps-table tbody tr.pay-status-pago {
        border-left: 4px solid #10b981;
    }
    
    .dps-subscription-table-wrapper table.dps-table tbody tr.pay-status-em_atraso {
        border-left: 4px solid #ef4444;
    }
    
    .dps-subscription-table-wrapper table.dps-table tbody td {
        display: grid;
        grid-template-columns: 100px 1fr;
        gap: 8px;
        padding: 8px 0;
        border-bottom: 1px solid #f3f4f6;
        border-top: none;
        border-left: none;
        border-right: none;
    }
    
    .dps-subscription-table-wrapper table.dps-table tbody td:first-child {
        padding-top: 0;
    }
    
    .dps-subscription-table-wrapper table.dps-table tbody td:last-child {
        border-bottom: none;
        padding-bottom: 0;
    }
    
    .dps-subscription-table-wrapper table.dps-table tbody td::before {
        content: attr(data-label);
        font-weight: 600;
        color: #6b7280;
        font-size: 11px;
        letter-spacing: 0.03em;
        text-transform: uppercase;
    }
    
    /* Barra de progresso em mobile */
    .dps-subscription-table-wrapper .dps-progress-bar {
        width: 100%;
        max-width: 200px;
    }
    
    /* Ações em mobile - horizontal com wrap */
    .dps-subscription-table-wrapper table.dps-table tbody td.dps-col-actions {
        grid-template-columns: 1fr;
        padding-top: 12px;
        margin-top: 4px;
        border-top: 1px solid #e5e7eb;
    }
    
    .dps-subscription-table-wrapper table.dps-table tbody td.dps-col-actions::before {
        display: none;
    }
    
    .dps-subscription-table-wrapper table.dps-table tbody td.dps-col-actions .dps-action-buttons {
        justify-content: flex-start;
    }
}

@media (max-width: 480px) {
    .dps-subscription-header {
        padding: 14px;
    }

    .dps-subscription-title h3 {
        font-size: 18px;
    }

    .dps-subscription-subtitle {
        font-size: 13px;
    }

    .dps-subscription-dashboard {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
    
    .dps-stat-card {
        padding: 16px 12px;
    }
    
    .dps-stat-number {
        font-size: 22px;
    }
    
    .dps-stat-label {
        font-size: 11px;
    }
    
    .dps-subscription-table-wrapper table.dps-table tbody td {
        grid-template-columns: 90px 1fr;
        font-size: 13px;
    }
    
    .dps-subscription-table-wrapper table.dps-table tbody td::before {
        font-size: 10px;
    }
    
    .dps-progress-text {
        font-size: 11px;
    }
    
    .dps-subscription-form {
        max-width: 100%;
    }
}

/* ==========================================================================
   Estados de Formulário (Loading, Erro, Disabled)
   ========================================================================== */

/* Campo com erro de validação */
.dps-subscription-form .dps-field-error {
    border-color: #ef4444 !important;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.15) !important;
}

.dps-subscription-form .dps-field-error:focus {
    border-color: #dc2626 !important;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.25) !important;
}

/* Botão em estado de loading */
.dps-subscription-form .dps-btn-loading {
    opacity: 0.7;
    cursor: wait;
    pointer-events: none;
}

.dps-subscription-form .dps-btn-loading::before {
    content: '';
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: dps-spin 0.6s linear infinite;
    margin-right: 8px;
}

@keyframes dps-spin {
    to {
        transform: rotate(360deg);
    }
}

/* Formulário de pagamento em loading */
.dps-payment-form.dps-form-loading {
    opacity: 0.6;
    pointer-events: none;
}

.dps-payment-form.dps-form-loading .dps-select-payment {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2'%3E%3Cpath d='M12 2v4M12 18v4M4.93 4.93l2.83 2.83M16.24 16.24l2.83 2.83M2 12h4M18 12h4M4.93 19.07l2.83-2.83M16.24 7.76l2.83-2.83'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
    background-size: 16px;
}

/* Select de pagamento desabilitado */
.dps-select-payment:disabled {
    opacity: 0.6;
    cursor: wait;
}

/* Botão submit desabilitado */
.dps-subscription-form .dps-btn-submit:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* ==========================================================================
   Acessibilidade
   ========================================================================== */

/* Focus visible para navegação por teclado */
.dps-subscription-form input:focus-visible,
.dps-subscription-form select:focus-visible,
.dps-subscription-form textarea:focus-visible,
.dps-subscription-form button:focus-visible {
    outline: 2px solid #0ea5e9;
    outline-offset: 2px;
}

/* Screen reader only text */
.dps-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}
