/**
 * Merchant Hub - Staff Affiliate Styles
 * Modern, clean, responsive styling for Staff Portal (My Account) and Admin Dashboard
 */

/* ==========================================================================
   Staff Dashboard Portal (My Account & Shortcode)
   ========================================================================== */

.at-aff-portal-wrap {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    color: #1e293b;
    margin: 15px 0 40px;
}

/* Header Banner */
.at-aff-header {
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #0369a1 100%);
    border-radius: 16px;
    padding: 24px 28px;
    color: #ffffff;
    box-shadow: 0 10px 25px -5px rgba(15, 23, 42, 0.2);
    margin-bottom: 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
}
.at-aff-header-info h2 {
    color: #ffffff !important;
    font-size: 24px;
    font-weight: 700;
    margin: 0 0 6px !important;
    line-height: 1.2;
}
.at-aff-header-info p {
    color: #94a3b8;
    font-size: 14px;
    margin: 0 !important;
}
.at-aff-header-badge {
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(8px);
    border-radius: 12px;
    padding: 8px 16px;
    text-align: right;
}
.at-aff-header-badge .badge-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #93c5fd;
    font-weight: 600;
    display: block;
}
.at-aff-header-badge .badge-code {
    font-size: 18px;
    font-weight: 800;
    color: #38bdf8;
    letter-spacing: 1px;
}

/* Affiliate Link Generator Tool */
.at-aff-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    padding: 22px 24px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.04);
    margin-bottom: 24px;
}
.at-aff-card-title {
    font-size: 17px;
    font-weight: 700;
    color: #0f172a;
    margin: 0 0 16px !important;
    display: flex;
    align-items: center;
    gap: 8px;
}
.at-aff-card-title .dashicons {
    color: #0284c7;
    font-size: 20px;
}

.at-aff-link-generator-grid {
    display: grid;
    grid-template-columns: 1fr 200px;
    gap: 20px;
    align-items: center;
}
@media (max-width: 768px) {
    .at-aff-link-generator-grid {
        grid-template-columns: 1fr;
    }
}
.at-aff-input-group {
    margin-bottom: 14px;
}
.at-aff-input-group label {
    font-size: 13px;
    font-weight: 600;
    color: #475569;
    margin-bottom: 6px;
    display: block;
}
.at-aff-input-wrapper {
    display: flex;
    gap: 8px;
}
.at-aff-input-wrapper input {
    flex: 1;
    border: 1px solid #cbd5e1 !important;
    border-radius: 8px !important;
    padding: 10px 14px !important;
    font-size: 14px !important;
    background: #f8fafc;
    color: #0f172a;
    transition: all 0.2s ease;
    height: 42px !important;
    margin-bottom: 0 !important;
}
.at-aff-input-wrapper input:focus {
    border-color: #0284c7 !important;
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.15) !important;
    outline: none;
}
.at-aff-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 18px;
    font-size: 13px;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    border: none;
    transition: all 0.2s ease;
    white-space: nowrap;
    text-decoration: none !important;
}
.at-aff-btn-primary {
    background: #0284c7;
    color: #ffffff !important;
}
.at-aff-btn-primary:hover {
    background: #0369a1;
    transform: translateY(-1px);
}
.at-aff-btn-success {
    background: #10b981;
    color: #ffffff !important;
}
.at-aff-btn-success:hover {
    background: #059669;
}
.at-aff-qr-box {
    text-align: center;
    background: #f8fafc;
    border-radius: 12px;
    padding: 14px;
    border: 1px dashed #cbd5e1;
}

/* Date Range Filter Toolbar */
.at-aff-filter-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 20px;
    background: #ffffff;
    padding: 12px 18px;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
}
.at-aff-filter-group {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}
.at-aff-filter-btn {
    padding: 6px 14px;
    font-size: 13px;
    border-radius: 20px;
    border: 1px solid #e2e8f0;
    background: #f8fafc;
    color: #475569;
    text-decoration: none !important;
    font-weight: 500;
    transition: all 0.15s ease;
}
.at-aff-filter-btn:hover, .at-aff-filter-btn.active {
    background: #0284c7;
    color: #ffffff !important;
    border-color: #0284c7;
}

/* KPI Summary Cards */
.at-aff-kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}
.at-aff-kpi-card {
    background: #ffffff;
    border-radius: 14px;
    padding: 20px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.03);
    position: relative;
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.at-aff-kpi-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.06);
}
.at-aff-kpi-card::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
}
.at-aff-kpi-card.kpi-clicks::before { background: #3b82f6; }
.at-aff-kpi-card.kpi-leads::before { background: #8b5cf6; }
.at-aff-kpi-card.kpi-orders::before { background: #f59e0b; }
.at-aff-kpi-card.kpi-revenue::before { background: #10b981; }
.at-aff-kpi-card.kpi-cr::before { background: #06b6d4; }

.at-aff-kpi-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}
.at-aff-kpi-label {
    font-size: 13px;
    font-weight: 600;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.at-aff-kpi-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}
.kpi-clicks .at-aff-kpi-icon { background: #eff6ff; color: #3b82f6; }
.kpi-leads .at-aff-kpi-icon { background: #f5f3ff; color: #8b5cf6; }
.kpi-orders .at-aff-kpi-icon { background: #fffbeb; color: #f59e0b; }
.kpi-revenue .at-aff-kpi-icon { background: #ecfdf5; color: #10b981; }
.kpi-cr .at-aff-kpi-icon { background: #ecfeff; color: #06b6d4; }

.at-aff-kpi-val {
    font-size: 26px;
    font-weight: 800;
    color: #0f172a;
    line-height: 1.1;
    margin-bottom: 4px;
}
.at-aff-kpi-sub {
    font-size: 12px;
    color: #94a3b8;
}

/* Data Tables */
.at-aff-table-wrap {
    overflow-x: auto;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
}
.at-aff-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    text-align: left;
    background: #ffffff;
    margin: 0 !important;
}
.at-aff-table th {
    background: #f8fafc;
    color: #475569;
    font-weight: 700;
    padding: 12px 14px;
    border-bottom: 1px solid #e2e8f0;
    text-transform: uppercase;
    font-size: 11px;
    letter-spacing: 0.5px;
}
.at-aff-table td {
    padding: 12px 14px;
    border-bottom: 1px solid #f1f5f9;
    color: #334155;
    vertical-align: middle;
}
.at-aff-table tr:hover td {
    background: #f8fafc;
}

/* Status Badges */
.at-aff-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 9999px;
    font-size: 11px;
    font-weight: 700;
    line-height: 1.3;
}
.at-aff-badge-new { background: #e0f2fe; color: #0369a1; border: 1px solid #bae6fd; }
.at-aff-badge-processing { background: #fef3c7; color: #b45309; border: 1px solid #fde68a; }
.at-aff-badge-completed { background: #d1fae5; color: #047857; border: 1px solid #a7f3d0; }
.at-aff-badge-cancelled { background: #fee2e2; color: #b91c1c; border: 1px solid #fecaca; }
.at-aff-badge-contacted { background: #ede9fe; color: #6d28d9; border: 1px solid #ddd6fe; }
.at-aff-badge-confirmed { background: #ccfbf1; color: #0f766e; border: 1px solid #99f6e4; }

/* Empty state */
.at-aff-empty-state {
    text-align: center;
    padding: 36px 16px;
    color: #94a3b8;
}
.at-aff-empty-state .dashicons {
    font-size: 42px;
    width: 42px;
    height: 42px;
    margin-bottom: 8px;
    color: #cbd5e1;
}

/* Tabs inside Portal */
.at-aff-tabs {
    display: flex;
    border-bottom: 2px solid #e2e8f0;
    margin-bottom: 20px;
    gap: 8px;
}
.at-aff-tab-item {
    padding: 10px 18px;
    font-size: 14px;
    font-weight: 600;
    color: #64748b;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    text-decoration: none !important;
    transition: all 0.2s ease;
}
.at-aff-tab-item:hover {
    color: #0284c7;
}
.at-aff-tab-item.active {
    color: #0284c7;
    border-bottom-color: #0284c7;
}

/* ==========================================================================
   Admin View Enhancements
   ========================================================================== */
.at-admin-aff-wrap {
    margin: 20px 20px 0 2px;
}
.at-admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 12px;
}
.at-admin-header h1 {
    font-size: 24px;
    font-weight: 700;
    color: #0f172a;
    margin: 0;
}
.at-admin-card {
    background: #ffffff;
    border: 1px solid #ccd0d4;
    box-shadow: 0 1px 1px rgba(0,0,0,.04);
    padding: 20px;
    margin-bottom: 20px;
}

/* ==========================================================================
   Affiliate Registration Form & Status Cards
   ========================================================================== */

/* Dashboard Invitation Card */
.at-aff-invite-card {
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 60%, #0369a1 100%);
    border-radius: 16px;
    padding: 24px 28px;
    color: #ffffff;
    box-shadow: 0 10px 25px -5px rgba(15, 23, 42, 0.2);
    margin: 20px 0 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
}
.at-aff-invite-content h3 {
    color: #ffffff !important;
    font-size: 20px;
    font-weight: 700;
    margin: 0 0 8px !important;
}
.at-aff-invite-content p {
    color: #cbd5e1;
    font-size: 14px;
    margin: 0 0 10px !important;
    max-width: 600px;
    line-height: 1.5;
}
.at-aff-invite-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(16, 185, 129, 0.2);
    border: 1px solid rgba(16, 185, 129, 0.4);
    color: #6ee7b7;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

/* Registration Form Card */
.at-aff-reg-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    padding: 30px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
    max-width: 720px;
    margin: 20px auto 40px;
}
.at-aff-reg-header {
    text-align: center;
    margin-bottom: 26px;
    border-bottom: 1px solid #f1f5f9;
    padding-bottom: 20px;
}
.at-aff-reg-header h2 {
    font-size: 24px;
    font-weight: 800;
    color: #0f172a;
    margin: 0 0 8px !important;
}
.at-aff-reg-header p {
    color: #64748b;
    font-size: 14px;
    margin: 0;
}

/* Email Banner inside Form */
.at-aff-email-notice {
    border-radius: 10px;
    padding: 14px 18px;
    margin-bottom: 20px;
    font-size: 13px;
    line-height: 1.5;
    display: flex;
    align-items: flex-start;
    gap: 10px;
}
.at-aff-email-notice-interspace {
    background: #ecfdf5;
    border: 1px solid #a7f3d0;
    color: #065f46;
}
.at-aff-email-notice-interspace .dashicons {
    color: #10b981;
    font-size: 20px;
}
.at-aff-email-notice-normal {
    background: #f0f9ff;
    border: 1px solid #bae6fd;
    color: #0369a1;
}
.at-aff-email-notice-normal .dashicons {
    color: #0284c7;
    font-size: 20px;
}

/* Form Fields */
.at-aff-form-row {
    margin-bottom: 18px;
}
.at-aff-form-row label {
    display: block;
    font-size: 13px;
    font-weight: 700;
    color: #334155;
    margin-bottom: 6px;
}
.at-aff-form-row input[type="text"],
.at-aff-form-row input[type="email"],
.at-aff-form-row input[type="tel"],
.at-aff-form-row textarea {
    width: 100% !important;
    border: 1px solid #cbd5e1 !important;
    border-radius: 8px !important;
    padding: 10px 14px !important;
    font-size: 14px !important;
    background: #f8fafc;
    color: #0f172a;
    transition: all 0.2s ease;
    box-sizing: border-box;
}
.at-aff-form-row input:focus,
.at-aff-form-row textarea:focus {
    border-color: #0284c7 !important;
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.15) !important;
    outline: none;
}
.at-aff-form-hint {
    font-size: 12px;
    color: #64748b;
    margin-top: 5px;
    line-height: 1.4;
}

/* Status Cards (Pending / Rejected) */
.at-aff-status-card {
    background: #ffffff;
    border-radius: 16px;
    padding: 36px 30px;
    text-align: center;
    max-width: 680px;
    margin: 20px auto 40px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
}
.at-aff-status-card.status-pending {
    border: 1px solid #fef3c7;
}
.at-aff-status-icon-wrap {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    margin: 0 auto 16px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.status-pending .at-aff-status-icon-wrap {
    background: #fef3c7;
    color: #f59e0b;
}
.status-pending .dashicons {
    font-size: 36px;
    width: 36px;
    height: 36px;
}
.at-aff-status-card h3 {
    font-size: 22px;
    font-weight: 800;
    color: #0f172a;
    margin: 0 0 10px !important;
}
.at-aff-status-card p {
    color: #64748b;
    font-size: 14px;
    line-height: 1.6;
    margin: 0 0 20px !important;
}
.at-aff-status-details {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 16px 20px;
    text-align: left;
    margin-bottom: 20px;
    font-size: 13px;
}
.at-aff-status-details div {
    margin-bottom: 8px;
    display: flex;
    justify-content: space-between;
}
.at-aff-status-details div:last-child {
    margin-bottom: 0;
}
.at-aff-status-details strong {
    color: #475569;
}
.at-aff-status-details span {
    font-weight: 600;
    color: #0f172a;
}

