/**
 * Earnings Dashboard Styles
 * Version: 2026-01-08a
 * Follows Viva automation page patterns
 */

/* ============================================
   EARNINGS PAGE SPECIFIC STYLES
   ============================================ */

.earnings-page {
    max-width: 1200px;
}

/* Setup Banner */
.earnings-setup-banner {
    background: linear-gradient(135deg, #ECFDF5 0%, #D1FAE5 100%);
}

.earnings-setup-icon {
    background: #10B981;
}

/* Metric Cards */
.earnings-metric-card {
    position: relative;
}

.earnings-metric-value {
    font-size: 28px;
    font-weight: 700;
    color: #111827;
}

.automation-metric-sublabel {
    font-size: 12px;
    color: #6B7280;
    margin-top: 4px;
}

/* ============================================
   TABLES
   ============================================ */

.earnings-table-container {
    overflow-x: auto;
    margin-top: 16px;
}

.earnings-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.earnings-table thead {
    background: #F9FAFB;
    border-bottom: 1px solid #EAECF0;
}

.earnings-table th {
    padding: 12px 16px;
    text-align: left;
    font-weight: 500;
    color: #667085;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.earnings-table th.text-right,
.earnings-table td.text-right {
    text-align: right;
}

.earnings-table tbody tr {
    border-bottom: 1px solid #EAECF0;
    transition: background 0.15s ease;
}

.earnings-table tbody tr:hover {
    background: #F9FAFB;
}

.earnings-table td {
    padding: 14px 16px;
    color: #374151;
}

.earnings-table-loading {
    text-align: center;
}

.earnings-table-loading td {
    padding: 40px 16px;
    color: #6B7280;
}

.earnings-table-loading .automation-loading-spinner {
    display: inline-block;
    margin-right: 8px;
    vertical-align: middle;
}

/* Transaction status badges */
.earnings-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 100px;
    font-size: 12px;
    font-weight: 500;
}

.earnings-status-badge--completed,
.earnings-status-badge--paid {
    background: #ECFDF5;
    color: #059669;
}

.earnings-status-badge--pending {
    background: #FEF3C7;
    color: #D97706;
}

.earnings-status-badge--failed {
    background: #FEE2E2;
    color: #DC2626;
}

.earnings-status-badge--refunded {
    background: #F3F4F6;
    color: #6B7280;
}

/* Amount styles */
.earnings-amount {
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.earnings-amount--positive {
    color: #059669;
}

.earnings-amount--negative {
    color: #DC2626;
}

.earnings-amount--fee {
    color: #6B7280;
}

/* Customer info */
.earnings-customer {
    display: flex;
    flex-direction: column;
}

.earnings-customer-name {
    font-weight: 500;
    color: #111827;
}

.earnings-customer-email {
    font-size: 12px;
    color: #6B7280;
}

/* ============================================
   EMPTY STATES
   ============================================ */

.earnings-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 24px;
    text-align: center;
}

.earnings-empty-state svg {
    color: #D1D5DB;
    margin-bottom: 16px;
}

.earnings-empty-state h3 {
    font-size: 16px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 8px;
}

.earnings-empty-state p {
    font-size: 14px;
    color: #6B7280;
    max-width: 300px;
}

/* ============================================
   FILTERS
   ============================================ */

.earnings-filters {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.earnings-filter-group {
    display: flex;
    gap: 12px;
}

.earnings-select {
    padding: 8px 32px 8px 12px;
    border: 1px solid #D1D5DB;
    border-radius: 8px;
    font-size: 14px;
    color: #374151;
    background: white;
    background-image: url("data:image/svg+xml,%3Csvg width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236B7280' stroke-width='2' xmlns='http://www.w3.org/2000/svg'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    cursor: pointer;
    appearance: none;
}

.earnings-select:hover {
    border-color: #9810FA;
}

.earnings-select:focus {
    outline: none;
    border-color: #9810FA;
    box-shadow: 0 0 0 3px rgba(152, 16, 250, 0.1);
}

.earnings-search {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border: 1px solid #D1D5DB;
    border-radius: 8px;
    background: white;
}

.earnings-search svg {
    color: #9CA3AF;
    flex-shrink: 0;
}

.earnings-search input {
    border: none;
    outline: none;
    font-size: 14px;
    color: #374151;
    width: 200px;
    background: transparent;
}

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

.earnings-search:focus-within {
    border-color: #9810FA;
    box-shadow: 0 0 0 3px rgba(152, 16, 250, 0.1);
}

/* ============================================
   PAGINATION
   ============================================ */

.earnings-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin-top: 24px;
    padding-top: 16px;
    border-top: 1px solid #EAECF0;
}

.earnings-pagination-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border: 1px solid #D1D5DB;
    border-radius: 8px;
    background: white;
    font-size: 14px;
    color: #374151;
    cursor: pointer;
    transition: all 0.15s ease;
}

.earnings-pagination-btn:hover:not(:disabled) {
    border-color: #9810FA;
    color: #9810FA;
}

.earnings-pagination-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.earnings-pagination-info {
    font-size: 14px;
    color: #6B7280;
}

/* ============================================
   BANK ACCOUNT CARD
   ============================================ */

.earnings-bank-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px 24px;
    background: white;
    border: 1px solid #EAECF0;
    border-radius: 12px;
    margin-bottom: 24px;
}

.earnings-bank-icon {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #F3F4F6;
    border-radius: 10px;
    color: #6B7280;
}

.earnings-bank-info {
    flex: 1;
}

.earnings-bank-name {
    font-size: 16px;
    font-weight: 600;
    color: #111827;
    margin-bottom: 2px;
}

.earnings-bank-last4 {
    font-size: 14px;
    color: #6B7280;
    font-family: 'SF Mono', 'Monaco', monospace;
}

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

.earnings-bank-action-btn {
    padding: 8px 16px;
    border: 1px solid #D1D5DB;
    border-radius: 8px;
    background: white;
    font-size: 14px;
    color: #374151;
    cursor: pointer;
    transition: all 0.15s ease;
}

.earnings-bank-action-btn:hover {
    border-color: #9810FA;
    color: #9810FA;
}

/* ============================================
   SETTINGS
   ============================================ */

.earnings-settings-card {
    background: white;
    border: 1px solid #EAECF0;
    border-radius: 12px;
    overflow: hidden;
}

.earnings-setting-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid #EAECF0;
}

.earnings-setting-row:last-child {
    border-bottom: none;
}

.earnings-setting-info {
    flex: 1;
}

.earnings-setting-label {
    font-size: 14px;
    font-weight: 500;
    color: #111827;
    margin-bottom: 4px;
}

.earnings-setting-desc {
    font-size: 13px;
    color: #6B7280;
}

.earnings-setting-control {
    flex-shrink: 0;
    margin-left: 24px;
}

/* Toggle Switch */
.earnings-toggle {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}

.earnings-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.earnings-toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #D1D5DB;
    transition: 0.3s;
    border-radius: 24px;
}

.earnings-toggle-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.3s;
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

.earnings-toggle input:checked + .earnings-toggle-slider {
    background-color: #9810FA;
}

.earnings-toggle input:checked + .earnings-toggle-slider:before {
    transform: translateX(20px);
}

/* Input with prefix */
.earnings-input-with-prefix {
    display: flex;
    align-items: center;
    border: 1px solid #D1D5DB;
    border-radius: 8px;
    overflow: hidden;
}

.earnings-input-prefix {
    padding: 8px 12px;
    background: #F9FAFB;
    color: #6B7280;
    font-size: 14px;
    border-right: 1px solid #D1D5DB;
}

.earnings-input {
    padding: 8px 12px;
    border: none;
    font-size: 14px;
    color: #374151;
    width: 100px;
    outline: none;
}

.earnings-input:focus {
    outline: none;
}

.earnings-input-with-prefix:focus-within {
    border-color: #9810FA;
    box-shadow: 0 0 0 3px rgba(152, 16, 250, 0.1);
}

/* Tax Status */
.earnings-tax-status {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px 24px;
}

.earnings-tax-status-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
}

.earnings-tax-status-icon--pending {
    background: #FEF3C7;
    color: #D97706;
}

.earnings-tax-status-icon--complete {
    background: #ECFDF5;
    color: #059669;
}

.earnings-tax-info {
    flex: 1;
}

.earnings-tax-title {
    font-size: 14px;
    font-weight: 500;
    color: #111827;
    margin-bottom: 2px;
}

.earnings-tax-desc {
    font-size: 13px;
    color: #6B7280;
}

/* Stripe Status */
.earnings-stripe-status {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px 24px;
}

.earnings-stripe-logo {
    width: 60px;
    flex-shrink: 0;
}

.earnings-stripe-info {
    flex: 1;
}

.earnings-stripe-title {
    font-size: 14px;
    font-weight: 500;
    color: #111827;
    margin-bottom: 2px;
}

.earnings-stripe-desc {
    font-size: 13px;
    color: #6B7280;
}

/* ============================================
   PAYOUT SETUP WIZARD
   ============================================ */

.stripe-connect-container {
    min-height: 200px;
    margin-top: 24px;
}

.earnings-bank-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 24px;
}

.earnings-bank-option {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 20px;
    background: white;
    border: 1px solid #EAECF0;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.15s ease;
    text-align: left;
}

.earnings-bank-option:hover {
    border-color: #9810FA;
    box-shadow: 0 0 0 3px rgba(152, 16, 250, 0.1);
}

.earnings-bank-option-icon {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #F3F4F6;
    border-radius: 10px;
    color: #6B7280;
}

.earnings-bank-option:hover .earnings-bank-option-icon {
    background: #F3E8FF;
    color: #9810FA;
}

.earnings-bank-option-content {
    flex: 1;
}

.earnings-bank-option-title {
    display: block;
    font-size: 15px;
    font-weight: 600;
    color: #111827;
    margin-bottom: 2px;
}

.earnings-bank-option-desc {
    display: block;
    font-size: 13px;
    color: #6B7280;
}

.earnings-bank-option-arrow {
    color: #9CA3AF;
}

.earnings-bank-option:hover .earnings-bank-option-arrow {
    color: #9810FA;
}

/* Manual Bank Form */
.earnings-manual-bank-form {
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid #EAECF0;
}

/* Success Summary */
.earnings-success-summary {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 24px;
    padding: 20px;
    background: #F9FAFB;
    border-radius: 12px;
}

.earnings-success-item {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
    color: #059669;
}

.earnings-success-item svg {
    flex-shrink: 0;
}

/* ============================================
   REQUEST PAYOUT MODAL
   ============================================ */

.earnings-payout-available {
    text-align: center;
    padding: 24px;
    background: #F9FAFB;
    border-radius: 12px;
    margin-bottom: 24px;
}

.earnings-payout-label {
    font-size: 13px;
    color: #6B7280;
    margin-bottom: 8px;
}

.earnings-payout-amount {
    font-size: 36px;
    font-weight: 700;
    color: #059669;
}

.earnings-payout-destination {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #EAECF0;
}

.earnings-payout-dest-label {
    font-size: 13px;
    color: #6B7280;
    margin-bottom: 8px;
}

.earnings-payout-dest-info {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
    color: #374151;
}

.earnings-payout-dest-info svg {
    color: #6B7280;
}

.earnings-payout-timeline {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 20px;
    padding: 12px 16px;
    background: #FEF3C7;
    border-radius: 8px;
    font-size: 13px;
    color: #92400E;
}

.earnings-payout-timeline svg {
    flex-shrink: 0;
}

/* ============================================
   PAYOUT METHOD SELECTOR
   ============================================ */

.earnings-setting-intro {
    font-size: 14px;
    color: #6B7280;
    padding: 16px 24px;
    border-bottom: 1px solid #EAECF0;
    margin: 0;
}

.earnings-payout-method-option {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 24px;
    border-bottom: 1px solid #EAECF0;
    transition: background 0.15s ease;
}

.earnings-payout-method-option:last-of-type {
    border-bottom: none;
}

.earnings-payout-method-option:hover {
    background: #F9FAFB;
}

.earnings-payout-method-option.disabled {
    opacity: 0.6;
    pointer-events: none;
}

/* Radio button styling */
.earnings-method-radio {
    position: relative;
    cursor: pointer;
}

.earnings-method-radio input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
}

.earnings-method-radio-custom {
    display: block;
    width: 20px;
    height: 20px;
    border: 2px solid #D1D5DB;
    border-radius: 50%;
    transition: all 0.15s ease;
    position: relative;
}

.earnings-method-radio input:checked + .earnings-method-radio-custom {
    border-color: #9810FA;
}

.earnings-method-radio input:checked + .earnings-method-radio-custom::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 10px;
    height: 10px;
    background: #9810FA;
    border-radius: 50%;
}

/* Method icon */
.earnings-method-icon {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    flex-shrink: 0;
}

.earnings-method-icon--bank {
    background: #F3F4F6;
    color: #6B7280;
}

.earnings-method-icon--paypal {
    background: #E8F4FF;
}

.earnings-method-icon--venmo {
    background: #EDF8FF;
}

/* Method info */
.earnings-method-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.earnings-method-name {
    font-size: 15px;
    font-weight: 500;
    color: #111827;
}

.earnings-method-status {
    font-size: 13px;
    color: #6B7280;
}

.earnings-method-status.connected {
    color: #059669;
}

/* Action buttons */
.earnings-method-action-btn {
    padding: 8px 16px;
    border: 1px solid #D1D5DB;
    border-radius: 8px;
    background: white;
    font-size: 14px;
    font-weight: 500;
    color: #374151;
    cursor: pointer;
    transition: all 0.15s ease;
}

.earnings-method-action-btn:hover {
    border-color: #9810FA;
    color: #9810FA;
}

.earnings-method-disconnect-btn {
    border-color: #FCA5A5;
    color: #DC2626;
}

.earnings-method-disconnect-btn:hover {
    background: #FEE2E2;
    border-color: #DC2626;
    color: #DC2626;
}

/* Toggle for Venmo */
.earnings-toggle--small {
    width: 36px;
    height: 20px;
}

.earnings-toggle--small .earnings-toggle-slider:before {
    height: 14px;
    width: 14px;
}

.earnings-toggle--small input:checked + .earnings-toggle-slider:before {
    transform: translateX(16px);
}

/* Method note at bottom */
.earnings-method-note {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 16px 24px;
    background: #F9FAFB;
    font-size: 13px;
    color: #6B7280;
    margin: 0;
}

.earnings-method-note svg {
    flex-shrink: 0;
    color: #9CA3AF;
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 768px) {
    .earnings-filters {
        flex-direction: column;
        align-items: stretch;
    }

    .earnings-filter-group {
        flex-wrap: wrap;
    }

    .earnings-search {
        width: 100%;
    }

    .earnings-search input {
        width: 100%;
    }

    .earnings-table {
        font-size: 13px;
    }

    .earnings-table th,
    .earnings-table td {
        padding: 10px 12px;
    }

    .earnings-bank-card {
        flex-direction: column;
        text-align: center;
    }

    .earnings-bank-info {
        text-align: center;
    }

    .earnings-setting-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .earnings-setting-control {
        margin-left: 0;
    }

    .earnings-tax-status,
    .earnings-stripe-status {
        flex-direction: column;
        text-align: center;
    }

    .earnings-tax-info,
    .earnings-stripe-info {
        text-align: center;
    }

    .automation-metrics-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .earnings-metric-value {
        font-size: 22px;
    }
}

@media (max-width: 480px) {
    .automation-metrics-grid {
        grid-template-columns: 1fr;
    }

    .earnings-pagination {
        flex-direction: column;
        gap: 12px;
    }
}
