/* ========== AFFILIATE MODAL PROFISSIONAL ========== */
.affiliate-modal-content {
    position: relative;
    max-width: 480px;
    width: 90%;
    background: linear-gradient(rgba(24, 24, 27, 0.95), rgba(24, 24, 27, 0.95));
    backdrop-filter: blur(20px);
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: white;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    max-height: 85vh;
    overflow: hidden;
}

.affiliate-modal-header {
    padding: 1.5rem 1.5rem 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    background: linear-gradient(135deg, rgba(var(--theme-bg-rgb), 0.1) 0%, transparent 100%);
    position: relative;
}

.affiliate-modal-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: #ffffff;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding-right: 2rem;
}

.affiliate-modal-title i {
    color: var(--theme-text);
    font-size: 1.25rem;
}

.affiliate-modal-close {
    position: absolute;
    top: 1.25rem;
    right: 1.25rem;
    width: 28px;
    height: 28px;
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 1.25rem;
    border-radius: 6px;
}

.affiliate-modal-close:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.05);
}

#affiliate-modal-body {
    overflow-y: auto;
    padding: 1.25rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

#affiliate-modal-body::-webkit-scrollbar {
    width: 5px;
}

#affiliate-modal-body::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.02);
    border-radius: 10px;
}

#affiliate-modal-body::-webkit-scrollbar-thumb {
    background: rgba(var(--theme-bg-rgb), 0.4);
    border-radius: 10px;
}

#affiliate-modal-body::-webkit-scrollbar-thumb:hover {
    background: rgba(var(--theme-bg-rgb), 0.6);
}

/* Link Section */
.affiliate-link-section {
    background: rgba(255, 255, 255, 0.04);
    border: 1.5px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 1rem;
}

.section-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.9);
    margin: 0 0 0.75rem 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.section-title i {
    color: var(--theme-text);
    font-size: 1rem;
}

.link-container {
    display: flex;
    background: rgba(255, 255, 255, 0.04);
    border: 1.5px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    overflow: hidden;
    transition: all 0.3s;
}

.link-container:focus-within {
    border-color: var(--theme-text);
    box-shadow: 0 0 0 3px rgba(var(--theme-bg-rgb), 0.15);
}

#affiliate-link-input {
    flex: 1;
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.8);
    padding: 0.75rem;
    font-size: 0.8rem;
    outline: none;
}

#copy-link-btn {
    background: var(--theme-bg);
    border: none;
    color: var(--theme-text);
    padding: 0 1rem;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

#copy-link-btn:hover {
    filter: brightness(1.1);
}

/* Stats Overview */
.affiliate-stats-overview {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
}

.stat-card {
    background: rgba(255, 255, 255, 0.04);
    border: 1.5px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 1rem 0.75rem;
    text-align: center;
    transition: all 0.3s;
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--theme-text);
    opacity: 0;
    transition: opacity 0.3s;
}

.stat-card:hover {
    background: rgba(255, 255, 255, 0.06);
    transform: translateY(-2px);
}

.stat-card:hover::before {
    opacity: 1;
}

.stat-icon {
    width: 36px;
    height: 36px;
    margin: 0 auto 0.5rem;
    background: rgba(var(--theme-bg-rgb), 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--theme-text);
    font-size: 1.1rem;
}

.stat-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--theme-text);
    margin: 0.25rem 0;
}

.stat-label {
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.5);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

.affiliate-actions {
    display: flex;
    gap: 0.75rem;
}

.affiliate-action-btn {
    flex: 1;
    border: none;
    padding: 0.9rem 1rem;
    border-radius: 12px;
    font-size: 0.9rem;
    font-weight: 800;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: all 0.25s ease;
    background: var(--theme-bg);
    color: var(--theme-text);
    box-shadow: 0 4px 15px rgba(var(--theme-bg-rgb), 0.25);
}

.affiliate-action-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(var(--theme-bg-rgb), 0.35);
    filter: brightness(1.08);
}

/* Performance Chart */
.affiliate-chart-section {
    background: rgba(255, 255, 255, 0.04);
    border: 1.5px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 1rem;
}

.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.chart-period-selector {
    display: flex;
    gap: 0.375rem;
    background: rgba(255, 255, 255, 0.03);
    padding: 0.25rem;
    border-radius: 8px;
}

.period-btn {
    padding: 0.375rem 0.75rem;
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.7rem;
    font-weight: 600;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.3s;
}

.period-btn:hover {
    color: rgba(255, 255, 255, 0.8);
    background: rgba(255, 255, 255, 0.05);
}

.period-btn.active {
    background: var(--theme-bg);
    color: var(--theme-text);
}

.chart-canvas-container {
    position: relative;
    height: 150px;
    margin-bottom: 0.5rem;
}

#affiliate-earnings-chart {
    width: 100% !important;
    height: 100% !important;
}

/* Conversion Funnel */
.conversion-funnel {
    background: rgba(255, 255, 255, 0.04);
    border: 1.5px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 1rem;
}

.funnel-step {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
    position: relative;
}

.funnel-step:last-child {
    margin-bottom: 0;
}

.funnel-icon {
    width: 32px;
    height: 32px;
    background: rgba(var(--theme-bg-rgb), 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--theme-text);
    font-size: 0.9rem;
    flex-shrink: 0;
}

.funnel-content {
    flex: 1;
}

.funnel-label {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 0.25rem;
}

.funnel-bar-container {
    position: relative;
    height: 8px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    overflow: hidden;
}

.funnel-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--theme-bg), var(--theme-text));
    border-radius: 10px;
    transition: width 1s ease;
}

.funnel-stats {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 0.25rem;
}

.funnel-value {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--theme-text);
}

.funnel-percentage {
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.5);
}

/* History Table */
.affiliate-history-section {
    background: rgba(255, 255, 255, 0.04);
    border: 1.5px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 1rem;
}

#affiliate-history-list {
    overflow-y: auto;
    max-height: 250px;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

#affiliate-history-list::-webkit-scrollbar {
    width: 4px;
}

#affiliate-history-list::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.02);
    border-radius: 10px;
}

#affiliate-history-list::-webkit-scrollbar-thumb {
    background: rgba(var(--theme-bg-rgb), 0.4);
    border-radius: 10px;
}

.history-item-affiliate {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    padding: 0.75rem;
    display: grid;
    grid-template-columns: 2fr 1.5fr;
    gap: 0.75rem;
    align-items: center;
    transition: all 0.3s;
}

.history-item-affiliate:hover {
    background: rgba(255, 255, 255, 0.06);
    transform: translateX(3px);
}

.history-col {
    display: flex;
    flex-direction: column;
}

.history-label {
    font-size: 0.625rem;
    color: rgba(255, 255, 255, 0.5);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    margin-bottom: 0.25rem;
    font-weight: 600;
}

.history-value {
    font-size: 0.8rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.9);
}

.history-value.success {
    color: #22c55e;
}

/* Empty/Loading States */
.empty-state,
.loading-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2.5rem 1.5rem;
    text-align: center;
}

.empty-state-icon,
.loading-state-icon {
    font-size: 2.5rem;
    margin-bottom: 0.75rem;
    opacity: 0.3;
}

.empty-state-text,
.loading-state-text {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.5);
    line-height: 1.5;
}

.loading-state-icon {
    animation: spin-pulse 2s ease-in-out infinite;
}

@keyframes spin-pulse {
    0%, 100% { opacity: 0.2; transform: rotate(0deg) scale(1); }
    50% { opacity: 0.4; transform: rotate(180deg) scale(1.05); }
}

/* ========== AFFILIATE WITHDRAW MODAL (igual ao saque padrão) ========== */
.affiliate-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(12px);
    z-index: 1400;
    opacity: 0;
    visibility: hidden;
    transition: all 0.35s ease;
}

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

.affiliate-withdraw-container {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1450;
    overflow-y: auto;
    padding: 20px;
    opacity: 0;
    visibility: hidden;
    transition: all 0.35s ease;
}

.affiliate-withdraw-container.active {
    opacity: 1;
    visibility: visible;
}

.affiliate-withdraw-wrapper {
    width: 100%;
    max-width: 440px;
    position: relative;
}

.affiliate-withdraw-card {
    background: linear-gradient(rgba(24, 24, 27, 0.95), rgba(24, 24, 27, 0.95));
    backdrop-filter: blur(20px);
    border-radius: 20px;
    overflow: hidden;
    position: relative;
    border: 1px solid rgba(255, 255, 255, 0.08);
    width: 100%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.affiliate-withdraw-close {
    position: absolute;
    top: 155px;
    right: 20px;
    width: 32px;
    height: 32px;
    background: var(--theme-text);
    border: none;
    color: rgb(2 2 2);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 1.5rem;
    z-index: 100;
    border-radius: 8px;
}

.affiliate-withdraw-close:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.05);
}

.affiliate-withdraw-header-img {
    width: 100%;
    height: 126px;
    object-fit: cover;
    display: block;
}

.affiliate-withdraw-body {
    padding: 2rem;
    position: relative;
}

.affiliate-withdraw-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #ffffff;
    margin: 0 0 1.5rem 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.affiliate-withdraw-title i {
    color: var(--theme-text);
}

.affiliate-input-group {
    margin-bottom: 1.25rem;
}

.affiliate-input-label {
    display: block;
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.affiliate-form-group-with-icon {
    position: relative;
    display: flex;
    align-items: center;
}

.affiliate-input-icon-left {
    position: absolute;
    left: 16px;
    color: rgba(255, 255, 255, 0.3);
    font-size: 1.1rem;
    pointer-events: none;
    transition: color 0.3s;
    z-index: 2;
}

.affiliate-amount-input,
.affiliate-text-input {
    width: 100%;
    padding: 14px 16px 14px 48px;
    background: rgba(255, 255, 255, 0.04);
    border: 1.5px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    color: #ffffff;
    font-size: 0.95rem;
    transition: all 0.3s;
    box-sizing: border-box;
}

.affiliate-amount-input::placeholder,
.affiliate-text-input::placeholder {
    color: rgba(255, 255, 255, 0.25);
}

.affiliate-amount-input:focus,
.affiliate-text-input:focus {
    outline: none;
    background: rgba(255, 255, 255, 0.06);
    border-color: var(--theme-bg);
    box-shadow: 0 0 0 3px rgba(var(--theme-bg-rgb), 0.15);
}

.affiliate-form-group-with-icon:focus-within .affiliate-input-icon-left {
    color: var(--theme-text);
}

.affiliate-max-balance {
    display: block;
    text-align: right;
    color: var(--theme-text);
    font-size: 0.8rem;
    margin-top: 0.5rem;
    font-weight: 600;
}

.affiliate-pix-input-container {
    display: flex;
    gap: 8px;
    position: relative;
}

.affiliate-pix-key-type-btn {
    min-width: 110px;
    padding: 14px 12px;
    background: rgba(255, 255, 255, 0.04);
    border: 1.5px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.3s;
    font-weight: 600;
    cursor: pointer;
    flex-shrink: 0;
}

.affiliate-pix-key-type-btn i { font-size: 1.1rem; }

.affiliate-pix-key-type-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.15);
}

.affiliate-pix-key-type-btn.active {
    border-color: var(--theme-text);
    color: var(--theme-text);
    background: rgba(var(--theme-bg-rgb), 0.1);
}

.affiliate-pix-input {
    flex: 1;
    padding: 14px 16px;
    background: rgba(255, 255, 255, 0.04);
    border: 1.5px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    color: white;
    font-size: 0.95rem;
    min-width: 0;
    transition: all 0.3s ease;
}

.affiliate-pix-input::placeholder { color: rgba(255, 255, 255, 0.25); }

.affiliate-pix-input:focus {
    outline: none;
    border-color: var(--theme-bg);
    background: rgba(255, 255, 255, 0.06);
    box-shadow: 0 0 0 3px rgba(var(--theme-bg-rgb), 0.15);
}

.affiliate-pix-type-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    background: linear-gradient(rgba(24, 24, 27, 0.98), rgba(24, 24, 27, 0.98));
    border: 1.5px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 8px;
    display: none;
    flex-direction: column;
    gap: 4px;
    z-index: 2000;
    min-width: 180px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.affiliate-pix-type-dropdown.active { display: flex; }

.affiliate-pix-type-option {
    padding: 10px 12px;
    background: transparent;
    border: none;
    border-radius: 8px;
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: left;
}

.affiliate-pix-type-option:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff;
}

.affiliate-pix-type-option.selected {
    background: rgba(var(--theme-bg-rgb), 0.2);
    color: var(--theme-text);
}

.affiliate-pix-type-option i {
    font-size: 1.1rem;
    width: 20px;
    text-align: center;
}

.affiliate-dual-inputs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.affiliate-generate-btn {
    width: 100%;
    border: none;
    padding: 15px 24px;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: all 0.3s ease;
    background: var(--theme-bg);
    color: var(--theme-text);
    box-shadow: 0 4px 15px rgba(var(--theme-bg-rgb), 0.3);
    margin-top: 0.5rem;
}

.affiliate-generate-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(var(--theme-bg-rgb), 0.4);
    filter: brightness(1.1);
}

@media (max-width: 480px) {
    .affiliate-modal-content { width: 100%; max-height: 84vh; }
    .affiliate-modal-header { padding: 1.25rem 1.25rem 0.875rem; }
    .affiliate-modal-title { font-size: 1.1rem; }
    #affiliate-modal-body { padding: 1rem 1.25rem; gap: 0.875rem; }
    .affiliate-stats-overview { gap: 0.5rem; }
    .stat-card { padding: 0.75rem 0.5rem; }
    .stat-icon { width: 32px; height: 32px; font-size: 1rem; }
    .stat-value { font-size: 1.1rem; }
    .stat-label { font-size: 0.65rem; }
    .chart-canvas-container { height: 120px; }
    .history-item-affiliate { grid-template-columns: 1fr; gap: 0.5rem; }
    .history-col { flex-direction: row; justify-content: space-between; align-items: center; }
    #copy-link-btn { padding: 0 0.75rem; font-size: 0.75rem; }

    .affiliate-withdraw-close { top: 129px; right: 20px; }
    .affiliate-withdraw-body { padding: 1.5rem; }
    .affiliate-withdraw-title { font-size: 1.3rem; }
    .affiliate-dual-inputs { grid-template-columns: 1fr; gap: 1rem; }
    .affiliate-pix-key-type-btn { min-width: 95px; padding: 12px 8px; font-size: 0.8rem; }
}

@media (max-width: 360px) {
    .affiliate-stats-overview { grid-template-columns: 1fr; }
    .stat-value { font-size: 1rem; }
}